简体   繁体   中英

Can an app on iOS implement the Firmware Version String characteristic in Device Information Service in BLE

I want to create a BLE peripheral as an app on iOS, and implement the Firmware Version String characteristic in Device Information Service.

When I do:

deviceInformationService = CBMutableService(type: CBUUID(string: "0x180A"), primary: false)
deviceInformationService.characteristics = [
    manufacturerNameString,
    modelNumberString,
    firmwareRevisionString
]
peripheral.add(deviceInformationService)

The func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) callback is called with an error:

Error Domain=CBErrorDomain Code=8 "The specified UUID is not allowed for this operation." UserInfo={NSLocalizedDescription=The specified UUID is not allowed for this operation.}

When I connect to the iPhone from Mac using Bluetooth Explorer and read Device Information, it shows

Manufacturer Name String = Apple Inc.
Model Number String = iPhone10,3

which is NOT what I'm setting in the CBMutableCharacteristic. And also the Firmware Revision String is not there.

Is there a way to implement Firmware Revision String?

The Device Information Service belongs to the device, not your app. Your app shares the BLE stack with all other apps and the OS, so you can't override system-wide characteristics like this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM