From 2f5a54be9f1b01d26e03e2a8b81286eec2d78d03 Mon Sep 17 00:00:00 2001 From: Albert Date: Mon, 20 Jan 2025 17:05:04 +0100 Subject: [PATCH] fix: return serviceUUIDs from discoverAllServicesAndCharacteristicsForDevice Closes 1150. The method now includes serviceUUIDs in the returned data for better consistency. --- src/BleManager.js | 10 +++++++++- src/BleModule.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/BleManager.js b/src/BleManager.js index 0100203c7..0d01571f8 100644 --- a/src/BleManager.js +++ b/src/BleManager.js @@ -566,7 +566,15 @@ export class BleManager { const nativeDevice = await this._callPromise( BleModule.discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier, transactionId) ) - return new Device(nativeDevice, this) + const services = await this._callPromise(BleModule.servicesForDevice(deviceIdentifier)) + const serviceUUIDs = services.map(service => service.uuid) + + // $FlowFixMe + const device = { + ...nativeDevice, + serviceUUIDs + } + return new Device(device, this) } // Mark: Service and characteristic getters -------------------------------------------------------------------------- diff --git a/src/BleModule.js b/src/BleModule.js index 802a268eb..b783885ad 100644 --- a/src/BleModule.js +++ b/src/BleModule.js @@ -56,7 +56,7 @@ export interface NativeDevice { rawScanRecord: Base64; /** - * Map od service UUIDs with associated data. + * Map of service UUIDs with associated data. * @private */ serviceData: ?{ [uuid: UUID]: Base64 };