Loading android/app/src/com/android/bluetooth/gatt/GattService.java +8 −3 Original line number Diff line number Diff line Loading @@ -2418,9 +2418,14 @@ public class GattService extends ProfileService { } for (BluetoothGattService includedService : service.getIncludedServices()) { int inclSrvc = mHandleMap.getServiceHandle(includedService.getUuid(), includedService.getType(), includedService.getInstanceId()); db.add(GattDbElement.createIncludedService(inclSrvc)); int inclSrvcHandle = includedService.getInstanceId(); if (mHandleMap.checkServiceExists(includedService.getUuid(), inclSrvcHandle)) { db.add(GattDbElement.createIncludedService(inclSrvcHandle)); } else { Log.e(TAG, "included service with UUID " + includedService.getUuid() + " not found!"); } } gattServerAddServiceNative(serverIf, db); Loading android/app/src/com/android/bluetooth/gatt/HandleMap.java +4 −22 Original line number Diff line number Diff line Loading @@ -131,31 +131,13 @@ class HandleMap { return null; } int getServiceHandle(UUID uuid, int serviceType, int instance) { boolean checkServiceExists(UUID uuid, int handle) { for(Entry entry : mEntries) { if (entry.type == TYPE_SERVICE && entry.serviceType == serviceType && entry.instance == instance && entry.uuid.equals(uuid)) { return entry.handle; if (entry.type == TYPE_SERVICE && entry.handle == handle && entry.uuid.equals(uuid)) { return true; } } Log.e(TAG, "getServiceHandle() - UUID " + uuid + " not found!"); return 0; } int getCharacteristicHandle(int serviceHandle, UUID uuid, int instance) { for(Entry entry : mEntries) { if (entry.type == TYPE_CHARACTERISTIC && entry.serviceHandle == serviceHandle && entry.instance == instance && entry.uuid.equals(uuid)) { return entry.handle; } } Log.e(TAG, "getCharacteristicHandle() - Service " + serviceHandle + ", UUID " + uuid + " not found!"); return 0; return false; } void deleteService(int serverIf, int serviceHandle) { Loading Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +8 −3 Original line number Diff line number Diff line Loading @@ -2418,9 +2418,14 @@ public class GattService extends ProfileService { } for (BluetoothGattService includedService : service.getIncludedServices()) { int inclSrvc = mHandleMap.getServiceHandle(includedService.getUuid(), includedService.getType(), includedService.getInstanceId()); db.add(GattDbElement.createIncludedService(inclSrvc)); int inclSrvcHandle = includedService.getInstanceId(); if (mHandleMap.checkServiceExists(includedService.getUuid(), inclSrvcHandle)) { db.add(GattDbElement.createIncludedService(inclSrvcHandle)); } else { Log.e(TAG, "included service with UUID " + includedService.getUuid() + " not found!"); } } gattServerAddServiceNative(serverIf, db); Loading
android/app/src/com/android/bluetooth/gatt/HandleMap.java +4 −22 Original line number Diff line number Diff line Loading @@ -131,31 +131,13 @@ class HandleMap { return null; } int getServiceHandle(UUID uuid, int serviceType, int instance) { boolean checkServiceExists(UUID uuid, int handle) { for(Entry entry : mEntries) { if (entry.type == TYPE_SERVICE && entry.serviceType == serviceType && entry.instance == instance && entry.uuid.equals(uuid)) { return entry.handle; if (entry.type == TYPE_SERVICE && entry.handle == handle && entry.uuid.equals(uuid)) { return true; } } Log.e(TAG, "getServiceHandle() - UUID " + uuid + " not found!"); return 0; } int getCharacteristicHandle(int serviceHandle, UUID uuid, int instance) { for(Entry entry : mEntries) { if (entry.type == TYPE_CHARACTERISTIC && entry.serviceHandle == serviceHandle && entry.instance == instance && entry.uuid.equals(uuid)) { return entry.handle; } } Log.e(TAG, "getCharacteristicHandle() - Service " + serviceHandle + ", UUID " + uuid + " not found!"); return 0; return false; } void deleteService(int serverIf, int serviceHandle) { Loading