Skip to content

Commit 2f5a54b

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 2f5a54b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/BleManager.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,15 @@ 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+
// $FlowFixMe
573+
const device = {
574+
...nativeDevice,
575+
serviceUUIDs
576+
}
577+
return new Device(device, this)
570578
}
571579

572580
// 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)