blob: ae5e52022023852432897d4d3b30c56e9b9c87ba [file] [log] [blame]
Vitaly Buka4615e0d2015-10-14 15:35:12 -07001// Copyright 2015 The Weave Authors. All rights reserved.
Vitaly Buka7ce499f2015-06-09 08:04:11 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Vitaly Buka912b6982015-07-06 11:13:03 -07005#ifndef LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_
6#define LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_
Vitaly Buka7ce499f2015-06-09 08:04:11 -07007
8#include <memory>
9#include <set>
10#include <string>
11
Stefan Sauer2d16dfa2015-09-25 17:08:35 +020012#include "src/privet/privet_types.h"
Vitaly Buka7ce499f2015-06-09 08:04:11 -070013
Vitaly Bukab6f015a2015-07-09 14:59:23 -070014namespace weave {
15namespace privet {
Vitaly Buka7ce499f2015-06-09 08:04:11 -070016
Vitaly Buka7ce499f2015-06-09 08:04:11 -070017// Interface to provide WiFi functionality for PrivetHandler.
18class WifiDelegate {
19 public:
20 WifiDelegate() = default;
21 virtual ~WifiDelegate() = default;
22
23 // Returns status of the WiFi connection.
24 virtual const ConnectionState& GetConnectionState() const = 0;
25
26 // Returns status of the last WiFi setup.
27 virtual const SetupState& GetSetupState() const = 0;
28
29 // Starts WiFi setup. Device should try to connect to provided SSID and
30 // password and store them on success. Result of setup should be available
31 // using GetSetupState().
32 // Final setup state can be retrieved with GetSetupState().
33 virtual bool ConfigureCredentials(const std::string& ssid,
34 const std::string& password,
Vitaly Buka0801a1f2015-08-14 10:03:46 -070035 ErrorPtr* error) = 0;
Vitaly Buka7ce499f2015-06-09 08:04:11 -070036
37 // Returns SSID of the currently configured WiFi network. Empty string, if
38 // WiFi has not been configured yet.
39 virtual std::string GetCurrentlyConnectedSsid() const = 0;
40
41 // Returns SSID of the WiFi network hosted by this device. Empty if device is
42 // not in setup or P2P modes.
43 virtual std::string GetHostedSsid() const = 0;
44
45 // Returns list of supported WiFi types. Currently it's just frequencies.
46 virtual std::set<WifiType> GetTypes() const = 0;
47};
48
Vitaly Bukab6f015a2015-07-09 14:59:23 -070049} // namespace privet
50} // namespace weave
Vitaly Buka7ce499f2015-06-09 08:04:11 -070051
Vitaly Buka912b6982015-07-06 11:13:03 -070052#endif // LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_