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_TASK_MANAGER_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool powered, | 119 bool powered, |
120 const base::Closure& callback, | 120 const base::Closure& callback, |
121 const BluetoothAdapter::ErrorCallback& error_callback); | 121 const BluetoothAdapter::ErrorCallback& error_callback); |
122 void PostStartDiscoveryTask(); | 122 void PostStartDiscoveryTask(); |
123 void PostStopDiscoveryTask(); | 123 void PostStopDiscoveryTask(); |
124 | 124 |
125 // Callbacks of asynchronous operations of GATT service. | 125 // Callbacks of asynchronous operations of GATT service. |
126 typedef base::Callback< | 126 typedef base::Callback< |
127 void(scoped_ptr<BTH_LE_GATT_CHARACTERISTIC>, uint16_t, HRESULT)> | 127 void(scoped_ptr<BTH_LE_GATT_CHARACTERISTIC>, uint16_t, HRESULT)> |
128 GetGattIncludedCharacteristicsCallback; | 128 GetGattIncludedCharacteristicsCallback; |
| 129 typedef base::Callback< |
| 130 void(scoped_ptr<BTH_LE_GATT_DESCRIPTOR>, uint16_t, HRESULT)> |
| 131 GetGattIncludedDescriptorsCallback; |
129 | 132 |
130 // Get all included characteristics of a given service. The service is | 133 // Get all included characteristics of a given service. The service is |
131 // uniquely identified by its |uuid| and |attribute_handle| with service | 134 // uniquely identified by its |uuid| and |attribute_handle| with service |
132 // device |service_path|. The result is returned asynchronously through | 135 // device |service_path|. The result is returned asynchronously through |
133 // |callback|. | 136 // |callback|. |
134 void PostGetGattIncludedCharacteristics( | 137 void PostGetGattIncludedCharacteristics( |
135 const base::FilePath& service_path, | 138 const base::FilePath& service_path, |
136 const BluetoothUUID& uuid, | 139 const BluetoothUUID& uuid, |
137 uint16_t attribute_handle, | 140 uint16_t attribute_handle, |
138 const GetGattIncludedCharacteristicsCallback& callback); | 141 const GetGattIncludedCharacteristicsCallback& callback); |
139 | 142 |
| 143 // Get all included descriptors of a given |characterisitc| in service |
| 144 // with |service_path|. The result is returned asynchronously through |
| 145 // |callback|. |
| 146 void PostGetGattIncludedDescriptors( |
| 147 const base::FilePath& service_path, |
| 148 const PBTH_LE_GATT_CHARACTERISTIC characteristic, |
| 149 const GetGattIncludedDescriptorsCallback& callback); |
| 150 |
140 private: | 151 private: |
141 friend class base::RefCountedThreadSafe<BluetoothTaskManagerWin>; | 152 friend class base::RefCountedThreadSafe<BluetoothTaskManagerWin>; |
142 friend class BluetoothTaskManagerWinTest; | 153 friend class BluetoothTaskManagerWinTest; |
143 | 154 |
144 static const int kPollIntervalMs; | 155 static const int kPollIntervalMs; |
145 | 156 |
146 virtual ~BluetoothTaskManagerWin(); | 157 virtual ~BluetoothTaskManagerWin(); |
147 | 158 |
148 // Logs Win32 errors occurring during polling on the worker thread. The method | 159 // Logs Win32 errors occurring during polling on the worker thread. The method |
149 // may discard messages to avoid logging being too verbose. | 160 // may discard messages to avoid logging being too verbose. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 bool SearchForGattServiceDevicePaths( | 237 bool SearchForGattServiceDevicePaths( |
227 const std::string device_address, | 238 const std::string device_address, |
228 ScopedVector<ServiceRecordState>* service_record_states); | 239 ScopedVector<ServiceRecordState>* service_record_states); |
229 | 240 |
230 // GATT service related functions. | 241 // GATT service related functions. |
231 void GetGattIncludedCharacteristics( | 242 void GetGattIncludedCharacteristics( |
232 base::FilePath device_path, | 243 base::FilePath device_path, |
233 BluetoothUUID uuid, | 244 BluetoothUUID uuid, |
234 uint16_t attribute_handle, | 245 uint16_t attribute_handle, |
235 const GetGattIncludedCharacteristicsCallback& callback); | 246 const GetGattIncludedCharacteristicsCallback& callback); |
| 247 void GetGattIncludedDescriptors( |
| 248 base::FilePath service_path, |
| 249 BTH_LE_GATT_CHARACTERISTIC characteristic, |
| 250 const GetGattIncludedDescriptorsCallback& callback); |
236 | 251 |
237 // UI task runner reference. | 252 // UI task runner reference. |
238 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 253 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
239 | 254 |
240 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 255 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
241 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner_; | 256 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner_; |
242 | 257 |
243 // List of observers interested in event notifications. | 258 // List of observers interested in event notifications. |
244 base::ObserverList<Observer> observers_; | 259 base::ObserverList<Observer> observers_; |
245 | 260 |
246 // Weak reference of the adapter handle, let BluetoothClassicWrapper handle | 261 // Weak reference of the adapter handle, let BluetoothClassicWrapper handle |
247 // the close of |adapter_handle_|. | 262 // the close of |adapter_handle_|. |
248 HANDLE adapter_handle_; | 263 HANDLE adapter_handle_; |
249 | 264 |
250 // indicates whether the adapter is in discovery mode or not. | 265 // indicates whether the adapter is in discovery mode or not. |
251 bool discovering_; | 266 bool discovering_; |
252 | 267 |
253 // Use for discarding too many log messages. | 268 // Use for discarding too many log messages. |
254 base::TimeTicks current_logging_batch_ticks_; | 269 base::TimeTicks current_logging_batch_ticks_; |
255 int current_logging_batch_count_; | 270 int current_logging_batch_count_; |
256 | 271 |
257 DISALLOW_COPY_AND_ASSIGN(BluetoothTaskManagerWin); | 272 DISALLOW_COPY_AND_ASSIGN(BluetoothTaskManagerWin); |
258 }; | 273 }; |
259 | 274 |
260 } // namespace device | 275 } // namespace device |
261 | 276 |
262 #endif // DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ | 277 #endif // DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
OLD | NEW |