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

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

Issue 1502833002: bluetooth: android: Enable characteristic change notification events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-check-null-
Patch Set: fix imports Created 4 years, 11 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 d53e233a287494ab8e05cb6583106e8b51f2bd6e..8f14d298e1065d973325c7870de22253f3660b20 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
@@ -355,6 +355,14 @@ class Wrappers {
}
@Override
+ public void onCharacteristicChanged(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
+ Log.i(TAG, "wrapper onCharacteristicChanged.");
+ mWrapperCallback.onCharacteristicChanged(
+ mDeviceWrapper.mCharacteristicsToWrappers.get(characteristic));
+ }
+
+ @Override
public void onCharacteristicRead(
BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
mWrapperCallback.onCharacteristicRead(
@@ -390,6 +398,8 @@ class Wrappers {
* call.
*/
abstract static class BluetoothGattCallbackWrapper {
+ public abstract void onCharacteristicChanged(
+ BluetoothGattCharacteristicWrapper characteristic);
public abstract void onCharacteristicRead(
BluetoothGattCharacteristicWrapper characteristic, int status);
public abstract void onCharacteristicWrite(
@@ -451,6 +461,22 @@ class Wrappers {
mDeviceWrapper = deviceWrapper;
}
+ public BluetoothGattDescriptorWrapper getDescriptor(UUID uuid) {
+ BluetoothGattDescriptor descriptor = mCharacteristic.getDescriptor(uuid);
+ if (descriptor == null) {
+ return null;
+ }
+
+ BluetoothGattDescriptorWrapper descriptorWrapper =
+ mDeviceWrapper.mDescriptorsToWrappers.get(descriptor);
+
+ if (descriptorWrapper == null) {
+ descriptorWrapper = new BluetoothGattDescriptorWrapper(descriptor);
+ mDeviceWrapper.mDescriptorsToWrappers.put(descriptor, descriptorWrapper);
+ }
+ return descriptorWrapper;
+ }
+
public List<BluetoothGattDescriptorWrapper> getDescriptors() {
List<BluetoothGattDescriptor> descriptors = mCharacteristic.getDescriptors();

Powered by Google App Engine
This is Rietveld 408576698