Search code examples
iosbluetooth-lowenergycore-bluetooth

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 ?


Solution

  • 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.