Chromium Code Reviews| Index: device/bluetooth/bluetooth_remote_gatt_characteristic_android.h |
| diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h |
| index 8b94cb4bb3794290db768950808991def59da8c2..07522c2112d182cce60d613052dfa9d40e408009 100644 |
| --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h |
| +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h |
| @@ -8,11 +8,15 @@ |
| #include <stdint.h> |
| #include "base/android/jni_android.h" |
| +#include "base/containers/scoped_ptr_hash_map.h" |
| #include "base/macros.h" |
| #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
| namespace device { |
| +class BluetoothAdapterAndroid; |
| +class BluetoothRemoteGattDescriptorAndroid; |
| + |
| // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
| // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
| // implement BluetootGattCharacteristic. |
| @@ -31,6 +35,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
| // reference |
| // to |bluetooth_gatt_characteristic_wrapper|. |
| static scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> Create( |
| + BluetoothAdapterAndroid* adapter, |
| const std::string& instance_id, |
| jobject /* BluetoothGattCharacteristicWrapper */ |
| bluetooth_gatt_characteristic_wrapper, |
| @@ -77,8 +82,29 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
| const base::android::JavaParamRef<jobject>& jcaller, |
| int32_t status); |
| + // Creates a Bluetooth GATT descriptor object and adds it to |descriptors_| |
|
Jeffrey Yasskin
2016/01/12 21:53:54
Add a comma before 'DCHECKing'.
scheib
2016/01/12 23:16:56
Done.
|
| + // DCHECKing that it has not already been created. |
| + void CreateGattRemoteDescriptor( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& caller, |
| + const base::android::JavaParamRef<jstring>& instanceId, |
| + const base::android::JavaParamRef< |
| + jobject>& /* BluetoothGattDescriptorWrapper */ |
| + bluetooth_gatt_descriptor_wrapper, |
| + const base::android::JavaParamRef< |
| + jobject>& /* ChromeBluetoothCharacteristic */ |
| + chrome_bluetooth_characteristic); |
| + |
| private: |
| - BluetoothRemoteGattCharacteristicAndroid(const std::string& instance_id); |
| + BluetoothRemoteGattCharacteristicAndroid(BluetoothAdapterAndroid* adapter, |
| + const std::string& instance_id); |
| + |
| + // Populates |descriptors_| from Java objects if necessary. |
| + void EnsureDescriptorsCreated() const; |
| + |
| + // The adapter associated with this service. It's ok to store a raw pointer |
| + // here since |adapter_| indirectly owns this instance. |
| + BluetoothAdapterAndroid* adapter_; |
| // Java object |
| // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic. |
| @@ -99,6 +125,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
| std::vector<uint8_t> value_; |
| + // Map of descriptors, keyed by descriptor identifier. |
| + base::ScopedPtrHashMap<std::string, |
| + scoped_ptr<BluetoothRemoteGattDescriptorAndroid>> |
| + descriptors_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
| }; |