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

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

Issue 1412963004: bluetooth: android: Implement Characteristic GetIdentifier, fix Service IDs too. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/ChromeBluetoothRemoteGattService.java
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattService.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattService.java
index 2d9a0e45343b7fd7d858c4aaf97c0582e9b81f0e..86a79e8ef7eaac1a18693de21dbca5a5494e8feb 100644
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattService.java
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattService.java
@@ -23,11 +23,13 @@ final class ChromeBluetoothRemoteGattService {
private long mNativeBluetoothRemoteGattServiceAndroid;
final Wrappers.BluetoothGattServiceWrapper mService;
+ final String mInstanceId;
private ChromeBluetoothRemoteGattService(long nativeBluetoothRemoteGattServiceAndroid,
- Wrappers.BluetoothGattServiceWrapper serviceWrapper) {
+ Wrappers.BluetoothGattServiceWrapper serviceWrapper, String instanceId) {
mNativeBluetoothRemoteGattServiceAndroid = nativeBluetoothRemoteGattServiceAndroid;
mService = serviceWrapper;
+ mInstanceId = instanceId;
Log.v(TAG, "ChromeBluetoothRemoteGattService created.");
}
@@ -47,9 +49,10 @@ final class ChromeBluetoothRemoteGattService {
// is not handled by jni_generator.py JavaToJni. http://crbug.com/505554
@CalledByNative
private static ChromeBluetoothRemoteGattService create(
- long nativeBluetoothRemoteGattServiceAndroid, Object serviceWrapper) {
+ long nativeBluetoothRemoteGattServiceAndroid, Object serviceWrapper,
+ String instanceId) {
return new ChromeBluetoothRemoteGattService(nativeBluetoothRemoteGattServiceAndroid,
- (Wrappers.BluetoothGattServiceWrapper) serviceWrapper);
+ (Wrappers.BluetoothGattServiceWrapper) serviceWrapper, instanceId);
}
// Implements BluetoothRemoteGattServiceAndroid::GetUUID.
@@ -64,11 +67,10 @@ final class ChromeBluetoothRemoteGattService {
List<Wrappers.BluetoothGattCharacteristicWrapper> characteristics =
mService.getCharacteristics();
for (Wrappers.BluetoothGattCharacteristicWrapper characteristic : characteristics) {
- // Create a unique characteristic ID. getInstanceId only differs between characteristic
- // instances with the same UUID.
- // TODO(scheib): Make instance IDs unique to the whole adapter. http://crbug.com/546747
- String characteristicInstanceId =
- characteristic.getUuid().toString() + characteristic.getInstanceId();
+ // Create an adapter unique characteristic ID. getInstanceId only differs between
+ // characteristic instances with the same UUID on this service.
+ String characteristicInstanceId = mInstanceId + "/"
+ + characteristic.getUuid().toString() + "," + characteristic.getInstanceId();
nativeCreateGattRemoteCharacteristic(mNativeBluetoothRemoteGattServiceAndroid,
characteristicInstanceId, characteristic);
}

Powered by Google App Engine
This is Rietveld 408576698