OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "device/bluetooth/bluetooth_task_manager_win.h" | 5 #include "device/bluetooth/bluetooth_task_manager_win.h" |
6 | 6 |
7 #include <winsock2.h> | 7 #include <winsock2.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 void BluetoothTaskManagerWin::PollAdapter() { | 205 void BluetoothTaskManagerWin::PollAdapter() { |
206 DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); | 206 DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); |
207 | 207 |
208 // Skips updating the adapter info if the adapter is in discovery mode. | 208 // Skips updating the adapter info if the adapter is in discovery mode. |
209 if (!discovering_) { | 209 if (!discovering_) { |
210 const BLUETOOTH_FIND_RADIO_PARAMS adapter_param = | 210 const BLUETOOTH_FIND_RADIO_PARAMS adapter_param = |
211 { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; | 211 { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; |
212 if (adapter_handle_) | 212 if (adapter_handle_) |
213 adapter_handle_.Close(); | 213 adapter_handle_.Close(); |
| 214 HANDLE temp_adapter_handle; |
214 HBLUETOOTH_RADIO_FIND handle = BluetoothFindFirstRadio( | 215 HBLUETOOTH_RADIO_FIND handle = BluetoothFindFirstRadio( |
215 &adapter_param, adapter_handle_.Receive()); | 216 &adapter_param, &temp_adapter_handle); |
216 | 217 |
217 if (handle) { | 218 if (handle) { |
| 219 adapter_handle_.Set(temp_adapter_handle); |
218 GetKnownDevices(); | 220 GetKnownDevices(); |
219 BluetoothFindRadioClose(handle); | 221 BluetoothFindRadioClose(handle); |
220 } | 222 } |
221 PostAdapterStateToUi(); | 223 PostAdapterStateToUi(); |
222 } | 224 } |
223 | 225 |
224 // Re-poll. | 226 // Re-poll. |
225 bluetooth_task_runner_->PostDelayedTask( | 227 bluetooth_task_runner_->PostDelayedTask( |
226 FROM_HERE, | 228 FROM_HERE, |
227 base::Bind(&BluetoothTaskManagerWin::PollAdapter, | 229 base::Bind(&BluetoothTaskManagerWin::PollAdapter, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 service_record_state->sdp_bytes.push_back( | 407 service_record_state->sdp_bytes.push_back( |
406 sdp_result_data->lpBlob->pBlobData[i]); | 408 sdp_result_data->lpBlob->pBlobData[i]); |
407 } | 409 } |
408 service_record_states->push_back(service_record_state); | 410 service_record_states->push_back(service_record_state); |
409 } | 411 } |
410 WSALookupServiceEnd(sdp_handle); | 412 WSALookupServiceEnd(sdp_handle); |
411 } | 413 } |
412 } | 414 } |
413 | 415 |
414 } // namespace device | 416 } // namespace device |
OLD | NEW |