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

Side by Side Diff: chrome/utility/wifi/wifi_test.cc

Issue 32193015: WlanConnect to BSS with given frequency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync up to r231308 Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/utility/wifi/wifi_service_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <stdio.h> 5 #include <stdio.h>
6 #include <iostream> 6 #include <iostream>
7 #include <string> 7 #include <string>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 91 };
92 92
93 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) { 93 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) {
94 if (!ParseCommandLine(argc, argv)) { 94 if (!ParseCommandLine(argc, argv)) {
95 fprintf(stderr, 95 fprintf(stderr,
96 "usage: %s [--list]" 96 "usage: %s [--list]"
97 " [--get_properties]" 97 " [--get_properties]"
98 " [--connect]" 98 " [--connect]"
99 " [--disconnect]" 99 " [--disconnect]"
100 " [--network_guid=<network_guid>]" 100 " [--network_guid=<network_guid>]"
101 " [--frequency=0|2400|5000]"
101 " [<network_guid>]\n", 102 " [<network_guid>]\n",
102 argv[0]); 103 argv[0]);
103 return RESULT_WRONG_USAGE; 104 return RESULT_WRONG_USAGE;
104 } 105 }
105 106
106 base::MessageLoopForIO loop; 107 base::MessageLoopForIO loop;
107 result_ = RESULT_PENDING; 108 result_ = RESULT_PENDING;
108 Start(); 109 Start();
109 110
110 return result_; 111 return result_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 wifi_service->GetProperties( 148 wifi_service->GetProperties(
148 network_guid, 149 network_guid,
149 base::Bind(&WiFiTest::OnNetworkProperties, base::Unretained(this)), 150 base::Bind(&WiFiTest::OnNetworkProperties, base::Unretained(this)),
150 base::Bind(&WiFiTest::OnError, base::Unretained(this))); 151 base::Bind(&WiFiTest::OnError, base::Unretained(this)));
151 152
152 return true; 153 return true;
153 } 154 }
154 } 155 }
155 156
156 if (parsed_command_line.HasSwitch("connect")) { 157 if (parsed_command_line.HasSwitch("connect")) {
158 // Parse 'frequency' parameter if specified.
159 std::string frequency_value =
160 parsed_command_line.GetSwitchValueASCII("frequency");
161 int frequency = WiFiService::kFrequencyUnknown;
162 if (!frequency_value.empty() &&
163 (!base::StringToInt(frequency_value, &frequency) ||
164 (frequency != WiFiService::kFrequencyUnknown &&
165 frequency != WiFiService::kFrequency2400 &&
166 frequency != WiFiService::kFrequency5000))) {
167 std::cout << "Invalid Frequency Value: " << frequency << "\n";
168 return false;
169 }
170
157 if (network_guid.length() > 0) { 171 if (network_guid.length() > 0) {
158 wifi_service->StartConnect( 172 wifi_service->StartConnect(
159 network_guid, 173 network_guid,
174 frequency,
160 base::Bind(&WiFiTest::OnStringResult, base::Unretained(this)), 175 base::Bind(&WiFiTest::OnStringResult, base::Unretained(this)),
161 base::Bind(&WiFiTest::OnError, base::Unretained(this))); 176 base::Bind(&WiFiTest::OnError, base::Unretained(this)));
162 177
163 return true; 178 return true;
164 } 179 }
165 } 180 }
166 181
167 if (parsed_command_line.HasSwitch("disconnect")) { 182 if (parsed_command_line.HasSwitch("disconnect")) {
168 if (network_guid.length() > 0) { 183 if (network_guid.length() > 0) {
169 wifi_service->StartDisconnect( 184 wifi_service->StartDisconnect(
170 network_guid, 185 network_guid,
171 base::Bind(&WiFiTest::OnStringResult, base::Unretained(this)), 186 base::Bind(&WiFiTest::OnStringResult, base::Unretained(this)),
172 base::Bind(&WiFiTest::OnError, base::Unretained(this))); 187 base::Bind(&WiFiTest::OnError, base::Unretained(this)));
173 188
174 return true; 189 return true;
175 } 190 }
176 } 191 }
177 192
178 return false; 193 return false;
179 } 194 }
180 195
181 } // namespace wifi 196 } // namespace wifi
182 197
183 int main(int argc, const char* argv[]) { 198 int main(int argc, const char* argv[]) {
184 wifi::WiFiTest wifi_test; 199 wifi::WiFiTest wifi_test;
185 return wifi_test.Main(argc, argv); 200 return wifi_test.Main(argc, argv);
186 } 201 }
OLDNEW
« no previous file with comments | « chrome/utility/wifi/wifi_service_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698