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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "device/bluetooth/bluetooth_task_manager_win.h" | 25 #include "device/bluetooth/bluetooth_task_manager_win.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 class SequencedTaskRunner; | 28 class SequencedTaskRunner; |
29 class Thread; | 29 class Thread; |
30 } // namespace base | 30 } // namespace base |
31 | 31 |
32 namespace device { | 32 namespace device { |
33 | 33 |
34 class BluetoothAdapterWinTest; | 34 class BluetoothAdapterWinTest; |
35 class BluetoothDevice; | 35 class BluetoothDeviceWin; |
36 class BluetoothSocketThread; | 36 class BluetoothSocketThread; |
| 37 class BluetoothRemoteGattCharacteristicWin; |
| 38 class BluetoothRemoteGattDescriptorWin; |
| 39 class BluetoothRemoteGattServiceWin; |
37 | 40 |
38 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterWin | 41 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterWin |
39 : public BluetoothAdapter, | 42 : public BluetoothAdapter, |
40 public BluetoothTaskManagerWin::Observer { | 43 public BluetoothTaskManagerWin::Observer { |
41 public: | 44 public: |
42 static base::WeakPtr<BluetoothAdapter> CreateAdapter( | 45 static base::WeakPtr<BluetoothAdapter> CreateAdapter( |
43 const InitCallback& init_callback); | 46 const InitCallback& init_callback); |
44 | 47 |
45 // BluetoothAdapter: | 48 // BluetoothAdapter: |
46 std::string GetAddress() const override; | 49 std::string GetAddress() const override; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void DevicesPolled(const ScopedVector<BluetoothTaskManagerWin::DeviceState>& | 89 void DevicesPolled(const ScopedVector<BluetoothTaskManagerWin::DeviceState>& |
87 devices) override; | 90 devices) override; |
88 | 91 |
89 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner() const { | 92 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner() const { |
90 return ui_task_runner_; | 93 return ui_task_runner_; |
91 } | 94 } |
92 const scoped_refptr<BluetoothSocketThread>& socket_thread() const { | 95 const scoped_refptr<BluetoothSocketThread>& socket_thread() const { |
93 return socket_thread_; | 96 return socket_thread_; |
94 } | 97 } |
95 | 98 |
| 99 // The follwing methods are used to send various GATT observer events to |
| 100 // observers. |
| 101 void NotifyGattServiceAdded(BluetoothDeviceWin* device, |
| 102 BluetoothRemoteGattServiceWin* service); |
| 103 void NotifyGattServiceRemoved(BluetoothDeviceWin* device, |
| 104 BluetoothRemoteGattServiceWin* service); |
| 105 void NotifyGattServicesDiscovered(BluetoothDeviceWin* device); |
| 106 void NotifyGattDiscoveryCompleteForService( |
| 107 BluetoothRemoteGattServiceWin* service); |
| 108 void NotifyGattServiceChanged(BluetoothRemoteGattServiceWin* service); |
| 109 void NotifyGattCharacteristicAdded( |
| 110 BluetoothRemoteGattCharacteristicWin* characteristic); |
| 111 void NotifyGattCharacteristicRemoved( |
| 112 BluetoothRemoteGattCharacteristicWin* characteristic); |
| 113 void NotifyGattCharacteristicValueChanged( |
| 114 BluetoothRemoteGattCharacteristicWin* characteristic, |
| 115 const std::vector<uint8_t>& value); |
| 116 void NotifyGattDescriptorAdded(BluetoothRemoteGattDescriptorWin* descriptor); |
| 117 void NotifyGattDescriptorRemoved( |
| 118 BluetoothRemoteGattDescriptorWin* descriptor); |
| 119 void NotifyGattDescriptorValueChanged( |
| 120 BluetoothRemoteGattDescriptorWin* descriptor, |
| 121 const std::vector<uint8_t>& value); |
| 122 |
| 123 BluetoothTaskManagerWin* GetWinBluetoothTaskManager() { |
| 124 return task_manager_.get(); |
| 125 } |
| 126 |
96 protected: | 127 protected: |
97 // BluetoothAdapter: | 128 // BluetoothAdapter: |
98 void RemovePairingDelegateInternal( | 129 void RemovePairingDelegateInternal( |
99 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; | 130 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
100 | 131 |
101 private: | 132 private: |
102 friend class BluetoothAdapterWinTest; | 133 friend class BluetoothAdapterWinTest; |
| 134 friend class BluetoothDeviceWinTest; |
| 135 friend class BluetoothRemoteGattServiceWinTest; |
| 136 friend class BluetoothRemoteGattCharacteristicWinTest; |
103 | 137 |
104 enum DiscoveryStatus { | 138 enum DiscoveryStatus { |
105 NOT_DISCOVERING, | 139 NOT_DISCOVERING, |
106 DISCOVERY_STARTING, | 140 DISCOVERY_STARTING, |
107 DISCOVERING, | 141 DISCOVERING, |
108 DISCOVERY_STOPPING | 142 DISCOVERY_STOPPING |
109 }; | 143 }; |
110 | 144 |
111 explicit BluetoothAdapterWin(const InitCallback& init_callback); | 145 explicit BluetoothAdapterWin(const InitCallback& init_callback); |
112 ~BluetoothAdapterWin() override; | 146 ~BluetoothAdapterWin() override; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // NOTE: This should remain the last member so it'll be destroyed and | 189 // NOTE: This should remain the last member so it'll be destroyed and |
156 // invalidate its weak pointers before any other members are destroyed. | 190 // invalidate its weak pointers before any other members are destroyed. |
157 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; | 191 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
158 | 192 |
159 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); | 193 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
160 }; | 194 }; |
161 | 195 |
162 } // namespace device | 196 } // namespace device |
163 | 197 |
164 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 198 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
OLD | NEW |