Skip to content

Commit b29ea82

Browse files
committed
fix: return serviceUUIDs from discoverAllServicesAndCharacteristicsForDevice
Closes 1150. The method now includes serviceUUIDs in the returned data for better consistency.
1 parent d6196f0 commit b29ea82

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/BleManager.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,14 @@ export class BleManager {
566566
const nativeDevice = await this._callPromise(
567567
BleModule.discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier, transactionId)
568568
)
569-
return new Device(nativeDevice, this)
569+
const services = await this._callPromise(BleModule.servicesForDevice(deviceIdentifier))
570+
const serviceUUIDs = services.map(service => service.uuid)
571+
572+
const device = {
573+
...nativeDevice,
574+
serviceUUIDs
575+
}
576+
return new Device(device, this)
570577
}
571578

572579
// Mark: Service and characteristic getters --------------------------------------------------------------------------

src/BleModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface NativeDevice {
5656
rawScanRecord: Base64;
5757

5858
/**
59-
* Map od service UUIDs with associated data.
59+
* Map of service UUIDs with associated data.
6060
* @private
6161
*/
6262
serviceData: ?{ [uuid: UUID]: Base64 };

0 commit comments

Comments
 (0)