Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java |
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java |
index 9287f85865b8c6e16c2d07a4959a7a8fa2568cb1..b40ff63ca2de4d6a8e262cba522c98e4cffa08ee 100644 |
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java |
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java |
@@ -354,6 +354,10 @@ class Wrappers { |
return mGatt.writeCharacteristic(characteristic.mCharacteristic); |
} |
+ boolean readDescriptor(BluetoothGattDescriptorWrapper descriptor) { |
+ return mGatt.readDescriptor(descriptor.mDescriptor); |
+ } |
+ |
boolean writeDescriptor(BluetoothGattDescriptorWrapper descriptor) { |
return mGatt.writeDescriptor(descriptor.mDescriptor); |
} |
@@ -400,6 +404,20 @@ class Wrappers { |
} |
@Override |
+ public void onDescriptorRead( |
+ BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { |
+ mWrapperCallback.onDescriptorRead( |
+ mDeviceWrapper.mDescriptorsToWrappers.get(descriptor), status); |
+ } |
+ |
+ @Override |
+ public void onDescriptorWrite( |
+ BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { |
+ mWrapperCallback.onDescriptorWrite( |
+ mDeviceWrapper.mDescriptorsToWrappers.get(descriptor), status); |
+ } |
+ |
+ @Override |
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { |
mWrapperCallback.onConnectionStateChange(status, newState); |
} |
@@ -427,6 +445,10 @@ class Wrappers { |
BluetoothGattCharacteristicWrapper characteristic, int status); |
public abstract void onCharacteristicWrite( |
BluetoothGattCharacteristicWrapper characteristic, int status); |
+ public abstract void onDescriptorRead( |
+ BluetoothGattDescriptorWrapper descriptor, int status); |
+ public abstract void onDescriptorWrite( |
+ BluetoothGattDescriptorWrapper descriptor, int status); |
public abstract void onConnectionStateChange(int status, int newState); |
public abstract void onServicesDiscovered(int status); |
} |
@@ -494,7 +516,7 @@ class Wrappers { |
mDeviceWrapper.mDescriptorsToWrappers.get(descriptor); |
if (descriptorWrapper == null) { |
- descriptorWrapper = new BluetoothGattDescriptorWrapper(descriptor); |
+ descriptorWrapper = new BluetoothGattDescriptorWrapper(descriptor, mDeviceWrapper); |
mDeviceWrapper.mDescriptorsToWrappers.put(descriptor, descriptorWrapper); |
} |
return descriptorWrapper; |
@@ -510,7 +532,8 @@ class Wrappers { |
BluetoothGattDescriptorWrapper descriptorWrapper = |
mDeviceWrapper.mDescriptorsToWrappers.get(descriptor); |
if (descriptorWrapper == null) { |
- descriptorWrapper = new BluetoothGattDescriptorWrapper(descriptor); |
+ descriptorWrapper = |
+ new BluetoothGattDescriptorWrapper(descriptor, mDeviceWrapper); |
mDeviceWrapper.mDescriptorsToWrappers.put(descriptor, descriptorWrapper); |
} |
descriptorsWrapped.add(descriptorWrapper); |
@@ -544,9 +567,16 @@ class Wrappers { |
*/ |
static class BluetoothGattDescriptorWrapper { |
private final BluetoothGattDescriptor mDescriptor; |
+ final BluetoothDeviceWrapper mDeviceWrapper; |
- public BluetoothGattDescriptorWrapper(BluetoothGattDescriptor descriptor) { |
+ public BluetoothGattDescriptorWrapper( |
+ BluetoothGattDescriptor descriptor, BluetoothDeviceWrapper deviceWrapper) { |
mDescriptor = descriptor; |
+ mDeviceWrapper = deviceWrapper; |
+ } |
+ |
+ public BluetoothGattCharacteristicWrapper getCharacteristic() { |
+ return mDeviceWrapper.mCharacteristicsToWrappers.get(mDescriptor.getCharacteristic()); |
} |
public UUID getUuid() { |