1 // Copyright 2015 The Weave Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ 6 #define LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ 7 8 #include <memory> 9 #include <set> 10 #include <string> 11 12 #include "src/privet/privet_types.h" 13 14 namespace weave { 15 namespace privet { 16 17 // Interface to provide WiFi functionality for PrivetHandler. 18 class WifiDelegate { 19 public: 20 WifiDelegate() = default; 21 virtual ~WifiDelegate() {} 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, 35 ErrorPtr* error) = 0; 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 49 } // namespace privet 50 } // namespace weave 51 52 #endif // LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_ 53