【发布时间】:2017-07-01 04:21:55
【问题描述】:
我目前有一个 Honeywell 的 DEX BLE-1 适配器,用于从自动售货机检索 dex 数据。我有一个 swift 3 iOS 应用程序,它使用 CoreBluetooth 进行扫描并与外围设备配对。该适配器具有三种服务:串口、电池和dex服务。 dex 服务具有三个特征:固件版本、会话和设置。我想会话特征用于检索 dex;但是,我不知道该怎么做。
我使用didUpdateValueFor外围方法获取与会话特征的uuid相关的值,但该值为nil。
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
if characterstic.uuid.uuidString == uuidSession {
if(characteristic.value != nil) {
print(characterstic.value)
}
}
}
是否应该从会话特征值中检索 DEX?它似乎是几个字节,也许我必须连接字节?但无论如何,价值为零。我是新手,但这应该通过串口完成吗?我在某处读到你可以通过它建立连接,还是完全关闭?
【问题讨论】:
-
以上你回答了吗?我们需要使用任何 SDK 吗?
标签: ios swift bluetooth-lowenergy core-bluetooth gatt