0

我有一个 react-native 应用程序,我试图从 Accu-Chek Guide 设备获取葡萄糖测量值。

我对 BLE 的了解有限,这个 stackoverflow 问题对我理解蓝牙和检索葡萄糖测量有很大帮助。 从通知特征读取(离子 - 蓝牙)

所以,我在我的代码中做了什么:

1、连接BLE外设
2、监听特性Glucose Feature& Record Access Control Point
3、发送0x0101 (Report stored records | All records)Record Access Control Point
4、解​​码响应

到目前为止,我有 1-3 个工作,但我不知道如何解码来自 Glucose Feature 的响应:

通知响应Glucose Measurement

[27、4、0、195、164、7、7、14、11、6、5、90、2、119、194、176、195、184、0、0]


通知Record Access Control Point

[6, 0, 1, 1]

4

1 回答 1

1

我假设这是蓝牙 SIG 采用的连续血糖监测服务 (CGMS) 配置文件,其规范可从以下网址获得:

https://www.bluetooth.com/specifications/gatt/

查看 XML 的Glucose Measurement特征,可以更详细地了解数据的结构。

https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.glucose_measurement.xml

解包数据需要做一些工作。

例如,第一个字节存储名为 的第一个字段的信息flags。但是,您需要查看这些不同标志的前 5 位。

下一个字段是“序列号”,它uint16需要两个字节。值得注意的是,蓝牙通常使用little endian

接下来是Base Timehttps://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.date_time.xml的字段,它将占用下一个 7字节。

因为特征中的 9 个字段中的某些字段占用了超过一个字节,这就是您看到 9 个字段的 20 个字节的原因。

于 2020-08-10T13:03:39.713 回答