Chromium Code Reviews| Index: components/arc/bluetooth/arc_bluetooth_bridge.h |
| diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.h b/components/arc/bluetooth/arc_bluetooth_bridge.h |
| index 815f02780c38762f17106c4392e5a5b1750a7213..c545b21a47fbca5cbcbc9ac95012edf227da30d8 100644 |
| --- a/components/arc/bluetooth/arc_bluetooth_bridge.h |
| +++ b/components/arc/bluetooth/arc_bluetooth_bridge.h |
| @@ -7,9 +7,9 @@ |
| #include <stdint.h> |
| -#include <map> |
| #include <memory> |
| #include <string> |
| +#include <unordered_map> |
| #include <vector> |
| #include "base/callback.h" |
| @@ -191,11 +191,6 @@ class ArcBluetoothBridge |
| void StopLEListen(const StopLEListenCallback& callback) override; |
| void SearchService(mojom::BluetoothAddressPtr remote_addr) override; |
| - int ConvertGattIdentifierToId(const std::string identifier) const; |
| - template <class T> |
| - mojom::BluetoothGattDBElementPtr CreateGattDBElement( |
| - const mojom::BluetoothGattDBAttributeType type, |
| - const T* GattObject) const; |
| void GetGattDB(mojom::BluetoothAddressPtr remote_addr) override; |
| void ReadGattCharacteristic( |
| mojom::BluetoothAddressPtr remote_addr, |
| @@ -311,28 +306,10 @@ class ArcBluetoothBridge |
| const StopLEListenCallback& callback, |
| device::BluetoothAdvertisement::ErrorCode error_code); |
| - using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>; |
| - void OnGattReadDone(const GattReadCallback& callback, |
| - const std::vector<uint8_t>& result) const; |
| - void OnGattReadError( |
| - const GattReadCallback& callback, |
| - device::BluetoothGattService::GattErrorCode error_code) const; |
| - |
| - using GattWriteCallback = base::Callback<void(mojom::BluetoothGattStatus)>; |
| - void OnGattWriteDone(const GattWriteCallback& callback) const; |
| - void OnGattWriteError( |
| - const GattWriteCallback& callback, |
| - device::BluetoothGattService::GattErrorCode error_code) const; |
| - |
| void OnGattNotifyStartDone( |
| const RegisterForGattNotificationCallback& callback, |
| const std::string char_string_id, |
| std::unique_ptr<device::BluetoothGattNotifySession> notify_session); |
| - void OnGattNotifyStartError( |
| - const RegisterForGattNotificationCallback& callback, |
| - device::BluetoothGattService::GattErrorCode error_code) const; |
| - void OnGattNotifyStopDone( |
| - const DeregisterForGattNotificationCallback& callback) const; |
| private: |
| mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( |
| @@ -347,9 +324,6 @@ class ArcBluetoothBridge |
| bool HasBluetoothInstance() const; |
| bool CheckBluetoothInstanceVersion(uint32_t version_need) const; |
| - template <class T> |
| - T* FindGattObjectFromUuid(const std::vector<T*> objs, |
| - const device::BluetoothUUID uuid) const; |
| device::BluetoothRemoteGattCharacteristic* FindGattCharacteristic( |
| mojom::BluetoothAddressPtr remote_addr, |
| mojom::BluetoothGattServiceIDPtr service_id, |
| @@ -364,13 +338,31 @@ class ArcBluetoothBridge |
| // Propagates the list of paired device to Android. |
| void SendCachedPairedDevices() const; |
| + template <class LocalGattAttribute> |
| + int32_t CreateGattAttributeHandle(LocalGattAttribute* gatt_attr); |
|
palmer
2016/07/22 02:56:11
Nit: I might name it |attribute| instead of |gatt_
|
| + |
| + bool CalledOnValidThread(); |
| + |
| + int32_t next_gatt_server_attribute_handle() { |
| + return ++gatt_server_attribute_next_handle; |
| + } |
| + |
| mojo::Binding<mojom::BluetoothHost> binding_; |
| scoped_refptr<bluez::BluetoothAdapterBlueZ> bluetooth_adapter_; |
| scoped_refptr<device::BluetoothAdvertisement> advertisment_; |
| std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; |
| - std::map<std::string, std::unique_ptr<device::BluetoothGattNotifySession>> |
| + std::unordered_map<std::string, |
|
palmer
2016/07/22 02:56:10
Just out of curiosity: What's the reason for chang
puthik_chromium
2016/07/22 21:48:16
lhchavez@ remind me this.
We don't need the order
|
| + std::unique_ptr<device::BluetoothGattNotifySession>> |
| notification_session_; |
| + // Map from android int handle to Chrome (BlueZ) string identifier. |
|
palmer
2016/07/22 02:56:10
Nit: Capitalize Android.
puthik_chromium
2016/07/22 21:48:16
Done.
|
| + std::unordered_map<int32_t, std::string> gatt_identifier_; |
| + // Store last GattCharacteristic added to each GattService for GattServer. |
| + std::unordered_map<int32_t, int32_t> last_characteristic_; |
| + // Monotonically increasing value to use as handle to give to Android side. |
| + int32_t gatt_server_attribute_next_handle = 0; |
|
palmer
2016/07/22 02:56:11
Nit: Should this identifier end with an _ ?
Poten
puthik_chromium
2016/07/22 21:48:16
Done.
|
| + |
| + base::ThreadChecker thread_checker_; |
| // WeakPtrFactory to use for callbacks. |
| base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |