[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 1 | // Copyright 2014 The Chromium 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 COMPONENTS_WIFI_NETWORK_PROPERTIES_H_ |
| 6 | #define COMPONENTS_WIFI_NETWORK_PROPERTIES_H_ |
| 7 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame^] | 8 | #include <stdint.h> |
| 9 | |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 10 | #include <list> |
| 11 | #include <set> |
pneubeck | 63f02baf | 2015-01-13 17:14:27 | [diff] [blame] | 12 | #include <string> |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 13 | |
| 14 | #include "base/values.h" |
| 15 | #include "components/wifi/wifi_export.h" |
| 16 | |
| 17 | namespace wifi { |
| 18 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame^] | 19 | typedef int32_t Frequency; |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 20 | |
| 21 | enum FrequencyEnum { |
| 22 | kFrequencyAny = 0, |
| 23 | kFrequencyUnknown = 0, |
| 24 | kFrequency2400 = 2400, |
| 25 | kFrequency5000 = 5000 |
| 26 | }; |
| 27 | |
| 28 | typedef std::set<Frequency> FrequencySet; |
| 29 | |
| 30 | // Network Properties, can be used to parse the result of |GetProperties| and |
| 31 | // |GetVisibleNetworks|. |
| 32 | struct WIFI_EXPORT NetworkProperties { |
| 33 | NetworkProperties(); |
| 34 | ~NetworkProperties(); |
| 35 | |
| 36 | std::string connection_state; |
| 37 | std::string guid; |
| 38 | std::string name; |
| 39 | std::string ssid; |
| 40 | std::string bssid; |
| 41 | std::string type; |
| 42 | std::string security; |
| 43 | // |password| field is used to pass wifi password for network creation via |
| 44 | // |CreateNetwork| or connection via |StartConnect|. It does not persist |
| 45 | // once operation is completed. |
| 46 | std::string password; |
| 47 | // WiFi Signal Strength. 0..100 |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame^] | 48 | uint32_t signal_strength; |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 49 | bool auto_connect; |
| 50 | Frequency frequency; |
| 51 | FrequencySet frequency_set; |
| 52 | |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 53 | scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const; |
| 54 | // Updates only properties set in |value|. |
| 55 | bool UpdateFromValue(const base::DictionaryValue& value); |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame^] | 56 | static std::string MacAddressAsString(const uint8_t mac_as_int[6]); |
[email protected] | ca11059e | 2014-06-04 08:41:22 | [diff] [blame] | 57 | static bool OrderByType(const NetworkProperties& l, |
| 58 | const NetworkProperties& r); |
| 59 | }; |
| 60 | |
| 61 | typedef std::list<NetworkProperties> NetworkList; |
| 62 | |
| 63 | } // namespace wifi |
| 64 | |
| 65 | #endif // COMPONENTS_WIFI_NETWORK_PROPERTIES_H_ |