简体   繁体   English

iOS 上的应用程序能否在 BLE 的设备信息服务中实现固件版本字符串特性

[英]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.我想在 iOS 上创建一个 BLE 外围设备作为应用程序,并在设备信息服务中实现固件版本字符串特性。

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: func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: 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当我使用蓝牙资源管理器从 Mac 连接到 iPhone 并读取设备信息时,它显示

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

which is NOT what I'm setting in the CBMutableCharacteristic.这不是我在 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.您的应用与所有其他应用和操作系统共享 BLE 堆栈,因此您不能像这样覆盖系统范围的特征。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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