Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: components/wifi/wifi_service.h

Issue 226883002: WiFi client for GCD bootstrapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // network already exists, this will fail and populate |error|. On success 76 // network already exists, this will fail and populate |error|. On success
77 // populates the |network_guid| of the new network. 77 // populates the |network_guid| of the new network.
78 virtual void CreateNetwork(bool shared, 78 virtual void CreateNetwork(bool shared,
79 scoped_ptr<base::DictionaryValue> properties, 79 scoped_ptr<base::DictionaryValue> properties,
80 std::string* network_guid, 80 std::string* network_guid,
81 std::string* error) = 0; 81 std::string* error) = 0;
82 82
83 // Get list of visible networks of |network_type| (one of onc::network_type). 83 // Get list of visible networks of |network_type| (one of onc::network_type).
84 // Populates |network_list| on success. 84 // Populates |network_list| on success.
85 virtual void GetVisibleNetworks(const std::string& network_type, 85 virtual void GetVisibleNetworks(const std::string& network_type,
86 base::ListValue* network_list) = 0; 86 base::ListValue* network_list,
87 bool include_details) = 0;
87 88
88 // Request network scan. Send |NetworkListChanged| event on completion. 89 // Request network scan. Send |NetworkListChanged| event on completion.
89 virtual void RequestNetworkScan() = 0; 90 virtual void RequestNetworkScan() = 0;
90 91
91 // Start connect to network identified by |network_guid|. Populates |error| 92 // Start connect to network identified by |network_guid|. Populates |error|
92 // on failure. 93 // on failure.
93 virtual void StartConnect(const std::string& network_guid, 94 virtual void StartConnect(const std::string& network_guid,
94 std::string* error) = 0; 95 std::string* error) = 0;
95 96
96 // Start disconnect from network identified by |network_guid|. Populates 97 // Start disconnect from network identified by |network_guid|. Populates
(...skipping 16 matching lines...) Expand all
113 const NetworkGuidListCallback& networks_changed_observer, 114 const NetworkGuidListCallback& networks_changed_observer,
114 const NetworkGuidListCallback& network_list_changed_observer) = 0; 115 const NetworkGuidListCallback& network_list_changed_observer) = 0;
115 116
116 // Request update of Connected Network information. Send |NetworksChanged| 117 // Request update of Connected Network information. Send |NetworksChanged|
117 // event on completion. 118 // event on completion.
118 virtual void RequestConnectedNetworkUpdate() = 0; 119 virtual void RequestConnectedNetworkUpdate() = 0;
119 120
120 protected: 121 protected:
121 WiFiService() {} 122 WiFiService() {}
122 123
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. 124 // Error constants.
168 static const char kErrorAssociateToNetwork[]; 125 static const char kErrorAssociateToNetwork[];
169 static const char kErrorInvalidData[]; 126 static const char kErrorInvalidData[];
170 static const char kErrorNotConfigured[]; 127 static const char kErrorNotConfigured[];
171 static const char kErrorNotConnected[]; 128 static const char kErrorNotConnected[];
172 static const char kErrorNotFound[]; 129 static const char kErrorNotFound[];
173 static const char kErrorNotImplemented[]; 130 static const char kErrorNotImplemented[];
174 static const char kErrorScanForNetworksWithName[]; 131 static const char kErrorScanForNetworksWithName[];
175 static const char kErrorWiFiService[]; 132 static const char kErrorWiFiService[];
176 133
177 private: 134 private:
178 DISALLOW_COPY_AND_ASSIGN(WiFiService); 135 DISALLOW_COPY_AND_ASSIGN(WiFiService);
179 }; 136 };
180 137
181 } // namespace wifi 138 } // namespace wifi
182 139
183 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ 140 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698