Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 scoped_refptr<device::BluetoothAdvertisement> adv); | 296 scoped_refptr<device::BluetoothAdvertisement> adv); |
| 297 void OnStartLEListenError( | 297 void OnStartLEListenError( |
| 298 const StartLEListenCallback& callback, | 298 const StartLEListenCallback& callback, |
| 299 device::BluetoothAdvertisement::ErrorCode error_code); | 299 device::BluetoothAdvertisement::ErrorCode error_code); |
| 300 | 300 |
| 301 void OnStopLEListenDone(const StopLEListenCallback& callback); | 301 void OnStopLEListenDone(const StopLEListenCallback& callback); |
| 302 void OnStopLEListenError( | 302 void OnStopLEListenError( |
| 303 const StopLEListenCallback& callback, | 303 const StopLEListenCallback& callback, |
| 304 device::BluetoothAdvertisement::ErrorCode error_code); | 304 device::BluetoothAdvertisement::ErrorCode error_code); |
| 305 | 305 |
| 306 using GattStatusCallback = base::Callback<void(mojom::BluetoothGattStatus)>; | |
|
rkc
2016/07/01 22:21:46
Move alias definition to the top of the class.
htt
puthik_chromium
2016/07/14 19:01:47
Done.
| |
| 307 void OnGattOperationDone(const GattStatusCallback& callback) const; | |
| 308 void OnGattOperationError( | |
| 309 const GattStatusCallback& callback, | |
| 310 device::BluetoothGattService::GattErrorCode error_code) const; | |
| 311 | |
| 306 using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>; | 312 using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>; |
| 307 void OnGattReadDone(const GattReadCallback& callback, | 313 void OnGattReadDone(const GattReadCallback& callback, |
| 308 const std::vector<uint8_t>& result) const; | 314 const std::vector<uint8_t>& result) const; |
| 309 void OnGattReadError( | 315 void OnGattReadError( |
| 310 const GattReadCallback& callback, | 316 const GattReadCallback& callback, |
| 311 device::BluetoothGattService::GattErrorCode error_code) const; | 317 device::BluetoothGattService::GattErrorCode error_code) const; |
| 312 | 318 |
| 313 using GattWriteCallback = base::Callback<void(mojom::BluetoothGattStatus)>; | |
| 314 void OnGattWriteDone(const GattWriteCallback& callback) const; | |
| 315 void OnGattWriteError( | |
| 316 const GattWriteCallback& callback, | |
| 317 device::BluetoothGattService::GattErrorCode error_code) const; | |
| 318 | |
| 319 void OnGattNotifyStartDone( | 319 void OnGattNotifyStartDone( |
| 320 const RegisterForGattNotificationCallback& callback, | 320 const RegisterForGattNotificationCallback& callback, |
| 321 const std::string char_string_id, | 321 const std::string char_string_id, |
| 322 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); | 322 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); |
| 323 void OnGattNotifyStartError( | |
| 324 const RegisterForGattNotificationCallback& callback, | |
| 325 device::BluetoothGattService::GattErrorCode error_code) const; | |
| 326 void OnGattNotifyStopDone( | |
| 327 const DeregisterForGattNotificationCallback& callback) const; | |
| 328 | 323 |
| 329 private: | 324 private: |
| 330 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( | 325 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( |
| 331 mojom::BluetoothPropertyType type, | 326 mojom::BluetoothPropertyType type, |
| 332 device::BluetoothDevice* device) const; | 327 device::BluetoothDevice* device) const; |
| 333 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( | 328 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( |
| 334 mojom::BluetoothPropertyType type) const; | 329 mojom::BluetoothPropertyType type) const; |
| 335 mojo::Array<mojom::BluetoothAdvertisingDataPtr> GetAdvertisingData( | 330 mojo::Array<mojom::BluetoothAdvertisingDataPtr> GetAdvertisingData( |
| 336 device::BluetoothDevice* device) const; | 331 device::BluetoothDevice* device) const; |
| 337 | 332 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 349 | 344 |
| 350 device::BluetoothRemoteGattDescriptor* FindGattDescriptor( | 345 device::BluetoothRemoteGattDescriptor* FindGattDescriptor( |
| 351 mojom::BluetoothAddressPtr remote_addr, | 346 mojom::BluetoothAddressPtr remote_addr, |
| 352 mojom::BluetoothGattServiceIDPtr service_id, | 347 mojom::BluetoothGattServiceIDPtr service_id, |
| 353 mojom::BluetoothGattIDPtr char_id, | 348 mojom::BluetoothGattIDPtr char_id, |
| 354 mojom::BluetoothGattIDPtr desc_id) const; | 349 mojom::BluetoothGattIDPtr desc_id) const; |
| 355 | 350 |
| 356 // Propagates the list of paired device to Android. | 351 // Propagates the list of paired device to Android. |
| 357 void SendCachedPairedDevices() const; | 352 void SendCachedPairedDevices() const; |
| 358 | 353 |
| 354 template <class T> | |
| 355 int32_t CreateGattAttributeHandle(T* gatt_obj); | |
| 356 | |
| 359 mojo::Binding<mojom::BluetoothHost> binding_; | 357 mojo::Binding<mojom::BluetoothHost> binding_; |
| 360 | 358 |
| 361 scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_; | 359 scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_; |
| 362 scoped_refptr<device::BluetoothAdvertisement> advertisment_; | 360 scoped_refptr<device::BluetoothAdvertisement> advertisment_; |
| 363 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; | 361 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; |
| 364 std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>> | 362 std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>> |
| 365 notification_session_; | 363 notification_session_; |
| 364 // Map from android int handle to Chrome (BlueZ) string identifier. | |
| 365 std::map<int32_t, std::string> gatt_identifier_; | |
| 366 | 366 |
| 367 // WeakPtrFactory to use for callbacks. | 367 // WeakPtrFactory to use for callbacks. |
| 368 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 368 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
| 369 | 369 |
| 370 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 370 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 } // namespace arc | 373 } // namespace arc |
| 374 | 374 |
| 375 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 375 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| OLD | NEW |