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

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.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: Added the comment that Gio requested 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/ChromeBluetoothRemoteGattCharacteristic.java
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java
index ea0a4dc75e16e83aa2bac105c6d28a49cfb069e8..1507d7f29c2206cda4f84ea52d27213ea258727e 100644
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java
@@ -32,6 +32,7 @@ final class ChromeBluetoothRemoteGattCharacteristic {
final Wrappers.BluetoothGattCharacteristicWrapper mCharacteristic;
final String mInstanceId;
final ChromeBluetoothDevice mChromeDevice;
+ private boolean mPendingOnStartNotifySession = false;
private ChromeBluetoothRemoteGattCharacteristic(
long nativeBluetoothRemoteGattCharacteristicAndroid,
@@ -69,6 +70,22 @@ final class ChromeBluetoothRemoteGattCharacteristic {
}
}
+ boolean onStartNotifySession(int status) {
+ if (!mPendingOnStartNotifySession) {
+ return false;
+ }
+
+ mPendingOnStartNotifySession = false;
+
+ Log.i(TAG, "onStartNotifySession status:%d==%s", status,
+ status == android.bluetooth.BluetoothGatt.GATT_SUCCESS ? "OK" : "Error");
+ if (mNativeBluetoothRemoteGattCharacteristicAndroid != 0) {
+ nativeOnStartNotifySession(mNativeBluetoothRemoteGattCharacteristicAndroid, status);
+ }
+
+ return true;
+ }
+
void onCharacteristicRead(int status) {
Log.i(TAG, "onCharacteristicRead status:%d==%s", status,
status == android.bluetooth.BluetoothGatt.GATT_SUCCESS ? "OK" : "Error");
@@ -157,6 +174,8 @@ final class ChromeBluetoothRemoteGattCharacteristic {
return false;
}
+ mPendingOnStartNotifySession = true;
+
return true;
}
@@ -205,6 +224,10 @@ final class ChromeBluetoothRemoteGattCharacteristic {
// Binds to BluetoothRemoteGattCharacteristicAndroid::OnChanged.
native void nativeOnChanged(long nativeBluetoothRemoteGattCharacteristicAndroid, byte[] value);
+ // Binds to BluetoothRemoteGattCharacteristicAndroid::OnStartNotifySession.
+ native void nativeOnStartNotifySession(
+ long nativeBluetoothRemoteGattCharacteristicAndroid, int status);
+
// Binds to BluetoothRemoteGattCharacteristicAndroid::OnRead.
native void nativeOnRead(
long nativeBluetoothRemoteGattCharacteristicAndroid, int status, byte[] value);

Powered by Google App Engine
This is Rietveld 408576698