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); |