OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 5 #ifndef CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
6 #define CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 6 #define CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const NetworkGuidListCallback& networks_changed_observer, | 113 const NetworkGuidListCallback& networks_changed_observer, |
114 const NetworkGuidListCallback& network_list_changed_observer) = 0; | 114 const NetworkGuidListCallback& network_list_changed_observer) = 0; |
115 | 115 |
116 // Request update of Connected Network information. Send |NetworksChanged| | 116 // Request update of Connected Network information. Send |NetworksChanged| |
117 // event on completion. | 117 // event on completion. |
118 virtual void RequestConnectedNetworkUpdate() = 0; | 118 virtual void RequestConnectedNetworkUpdate() = 0; |
119 | 119 |
120 protected: | 120 protected: |
121 WiFiService() {} | 121 WiFiService() {} |
122 | 122 |
123 typedef int32 Frequency; | |
124 enum FrequencyEnum { | |
125 kFrequencyAny = 0, | |
126 kFrequencyUnknown = 0, | |
127 kFrequency2400 = 2400, | |
128 kFrequency5000 = 5000 | |
129 }; | |
130 | |
131 typedef std::set<Frequency> FrequencySet; | |
132 // Network Properties, used as result of |GetProperties| and | |
133 // |GetVisibleNetworks|. | |
134 struct WIFI_EXPORT NetworkProperties { | |
135 NetworkProperties(); | |
136 ~NetworkProperties(); | |
137 | |
138 std::string connection_state; | |
139 std::string guid; | |
140 std::string name; | |
141 std::string ssid; | |
142 std::string bssid; | |
143 std::string type; | |
144 std::string security; | |
145 // |password| field is used to pass wifi password for network creation via | |
146 // |CreateNetwork| or connection via |StartConnect|. It does not persist | |
147 // once operation is completed. | |
148 std::string password; | |
149 // WiFi Signal Strength. 0..100 | |
150 uint32 signal_strength; | |
151 bool auto_connect; | |
152 Frequency frequency; | |
153 FrequencySet frequency_set; | |
154 | |
155 std::string json_extra; // Extra JSON properties for unit tests | |
156 | |
157 scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const; | |
158 // Updates only properties set in |value|. | |
159 bool UpdateFromValue(const base::DictionaryValue& value); | |
160 static std::string MacAddressAsString(const uint8 mac_as_int[6]); | |
161 static bool OrderByType(const NetworkProperties& l, | |
162 const NetworkProperties& r); | |
163 }; | |
164 | |
165 typedef std::list<NetworkProperties> NetworkList; | |
166 | |
167 // Error constants. | 123 // Error constants. |
168 static const char kErrorAssociateToNetwork[]; | 124 static const char kErrorAssociateToNetwork[]; |
169 static const char kErrorInvalidData[]; | 125 static const char kErrorInvalidData[]; |
170 static const char kErrorNotConfigured[]; | 126 static const char kErrorNotConfigured[]; |
171 static const char kErrorNotConnected[]; | 127 static const char kErrorNotConnected[]; |
172 static const char kErrorNotFound[]; | 128 static const char kErrorNotFound[]; |
173 static const char kErrorNotImplemented[]; | 129 static const char kErrorNotImplemented[]; |
174 static const char kErrorScanForNetworksWithName[]; | 130 static const char kErrorScanForNetworksWithName[]; |
175 static const char kErrorWiFiService[]; | 131 static const char kErrorWiFiService[]; |
176 | 132 |
177 private: | 133 private: |
178 DISALLOW_COPY_AND_ASSIGN(WiFiService); | 134 DISALLOW_COPY_AND_ASSIGN(WiFiService); |
179 }; | 135 }; |
180 | 136 |
181 } // namespace wifi | 137 } // namespace wifi |
182 | 138 |
183 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 139 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
OLD | NEW |