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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "device/bluetooth/bluetooth_adapter.h" | 11 #include "device/bluetooth/bluetooth_adapter.h" |
12 | 12 |
13 namespace device { | 13 namespace device { |
14 | 14 |
15 class BluetoothAdapterFactory; | 15 class BluetoothAdapterFactory; |
16 class BluetoothAdapterWinTest; | |
16 class BluetoothDevice; | 17 class BluetoothDevice; |
17 | 18 |
18 class BluetoothAdapterWin : public BluetoothAdapter { | 19 class BluetoothAdapterWin : public BluetoothAdapter { |
20 public: | |
19 // BluetoothAdapter override | 21 // BluetoothAdapter override |
20 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 22 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
21 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 23 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
22 virtual bool IsPresent() const OVERRIDE; | 24 virtual bool IsPresent() const OVERRIDE; |
23 virtual bool IsPowered() const OVERRIDE; | 25 virtual bool IsPowered() const OVERRIDE; |
24 virtual void SetPowered( | 26 virtual void SetPowered( |
25 bool powered, | 27 bool powered, |
26 const base::Closure& callback, | 28 const base::Closure& callback, |
27 const ErrorCallback& error_callback) OVERRIDE; | 29 const ErrorCallback& error_callback) OVERRIDE; |
28 virtual bool IsDiscovering() const OVERRIDE; | 30 virtual bool IsDiscovering() const OVERRIDE; |
29 virtual void SetDiscovering( | 31 virtual void SetDiscovering( |
30 bool discovering, | 32 bool discovering, |
31 const base::Closure& callback, | 33 const base::Closure& callback, |
32 const ErrorCallback& error_callback) OVERRIDE; | 34 const ErrorCallback& error_callback) OVERRIDE; |
33 virtual ConstDeviceList GetDevices() const OVERRIDE; | 35 virtual ConstDeviceList GetDevices() const OVERRIDE; |
34 virtual BluetoothDevice* GetDevice(const std::string& address) OVERRIDE; | 36 virtual BluetoothDevice* GetDevice(const std::string& address) OVERRIDE; |
35 virtual const BluetoothDevice* GetDevice( | 37 virtual const BluetoothDevice* GetDevice( |
36 const std::string& address) const OVERRIDE; | 38 const std::string& address) const OVERRIDE; |
37 virtual void ReadLocalOutOfBandPairingData( | 39 virtual void ReadLocalOutOfBandPairingData( |
38 const BluetoothOutOfBandPairingDataCallback& callback, | 40 const BluetoothOutOfBandPairingDataCallback& callback, |
39 const ErrorCallback& error_callback) OVERRIDE; | 41 const ErrorCallback& error_callback) OVERRIDE; |
40 | 42 |
43 static const int kPollIntervalMs; | |
bryeung
2012/11/09 17:59:09
why is this public?
youngki
2012/11/09 19:14:04
moved it to private.
| |
44 | |
45 protected: | |
46 BluetoothAdapterWin(); | |
47 virtual ~BluetoothAdapterWin(); | |
48 | |
49 virtual void UpdateAdapterState(); | |
50 | |
41 private: | 51 private: |
42 friend class device::BluetoothAdapterFactory; | 52 friend class device::BluetoothAdapterFactory; |
53 friend class device::BluetoothAdapterWinTest; | |
43 | 54 |
44 BluetoothAdapterWin(); | 55 // Obtains the default adapter info (the first bluetooth radio info) and |
45 virtual ~BluetoothAdapterWin(); | 56 // tracks future changes to it. |
57 void TrackDefaultAdapter(); | |
58 | |
59 void PollAdapterState(); | |
46 | 60 |
47 // NOTE: This should remain the last member so it'll be destroyed and | 61 // NOTE: This should remain the last member so it'll be destroyed and |
48 // invalidate its weak pointers before any other members are destroyed. | 62 // invalidate its weak pointers before any other members are destroyed. |
49 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; | 63 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
50 | 64 |
51 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); | 65 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
52 }; | 66 }; |
53 | 67 |
54 } // namespace device | 68 } // namespace device |
55 | 69 |
56 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 70 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
OLD | NEW |