OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "device/bluetooth/bluetooth_manager_win.h" | |
6 | |
7 #include <BluetoothAPIs.h> | |
8 #include "base/callback.h" | |
9 #include "content/public/browser/browser_thread.h" | |
10 #include "device/bluetooth/bluetooth_adapter_win.h" | |
11 | |
12 # pragma comment(lib, "Bthprops.lib") | |
13 | |
14 namespace { | |
15 | |
16 const char* kBluetoothManagerThreadName = "BluetoothManagerThread"; | |
bryeung
2012/11/22 18:13:25
no indent
youngki
2012/11/23 01:50:47
Done.
| |
17 const BLUETOOTH_FIND_RADIO_PARAMS adapter_param = | |
18 { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; | |
bryeung
2012/11/22 18:13:25
blank line
youngki
2012/11/23 01:50:47
Done.
| |
19 } // namespace | |
20 | |
21 namespace device { | |
22 | |
23 BluetoothManagerWin::BluetoothManagerWin() | |
24 : Thread(kBluetoothManagerThreadName) {} | |
25 | |
26 BluetoothManagerWin::~BluetoothManagerWin() { | |
27 Stop(); | |
28 } | |
29 | |
30 void BluetoothManagerWin::FindAdapterHandleAndReply( | |
31 base::WeakPtr<BluetoothAdapterWin> weak_ptr) { | |
32 HANDLE adapter_handle = FindAdapterHandle(); | |
33 | |
34 content::BrowserThread::PostTask( | |
35 content::BrowserThread::UI, | |
36 FROM_HERE, | |
37 base::Bind(&BluetoothAdapterWin::OnAdapterHandleAvailable, | |
38 weak_ptr, | |
39 adapter_handle)); | |
40 } | |
41 | |
42 HANDLE BluetoothManagerWin::FindAdapterHandle() { | |
43 HBLUETOOTH_RADIO_FIND adapter_handle = NULL; | |
44 HBLUETOOTH_RADIO_FIND handle = BluetoothFindFirstRadio(&adapter_param, | |
45 &adapter_handle); | |
46 if (handle) | |
47 BluetoothFindRadioClose(handle); | |
48 | |
49 return adapter_handle; | |
50 } | |
51 | |
52 } // namespace device | |
OLD | NEW |