Vitaly Buka | 4615e0d | 2015-10-14 15:35:12 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Weave Authors. All rights reserved. |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Vitaly Buka | 912b698 | 2015-07-06 11:13:03 -0700 | [diff] [blame] | 5 | #ifndef LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ |
| 6 | #define LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 7 | |
| 8 | #include <memory> |
| 9 | #include <set> |
| 10 | #include <string> |
| 11 | |
Stefan Sauer | 2d16dfa | 2015-09-25 17:08:35 +0200 | [diff] [blame] | 12 | #include "src/privet/privet_types.h" |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 13 | |
Vitaly Buka | b6f015a | 2015-07-09 14:59:23 -0700 | [diff] [blame] | 14 | namespace weave { |
| 15 | namespace privet { |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 16 | |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 17 | // Interface to provide WiFi functionality for PrivetHandler. |
| 18 | class 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 Buka | 0801a1f | 2015-08-14 10:03:46 -0700 | [diff] [blame] | 35 | ErrorPtr* error) = 0; |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 36 | |
| 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 Buka | b6f015a | 2015-07-09 14:59:23 -0700 | [diff] [blame] | 49 | } // namespace privet |
| 50 | } // namespace weave |
Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 51 | |
Vitaly Buka | 912b698 | 2015-07-06 11:13:03 -0700 | [diff] [blame] | 52 | #endif // LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ |