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