Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2592)

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java

Issue 1712593002: bluetooth: android: Confirm the notify session after the descriptor has been written. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Vincent's comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698