我想将我的Android应用程序与这个智能手环(T1S)进行通信,我已经将其配对,但我不知道如何从中提取数据,例如温度等。 我从中得到了它的特点和服务:
{"name":"T1S","id":"F4:C3:33:99:21:5D","广告":{},"rssi":-78,"服务":["1801" ,"1800","6e400001-b5a3-f393-e0a9-e50e24dcca9e","1812","fee7"],"特性":[{"服务":"1801","特性":"2a05","属性":["广播","读","写","通知","指示","AuthenticateSignedWrites"],"描述符":[{"uuid":"2902"}]},{"service": "1800","特性":"2a00","属性":["已读"]},{"服务":"1800","特性":"2a01","属性":["已读"]} ,{"service":"1800","characteristic":"2a02","properties":["已读"]},{"service":"1800","characteristic":"2a04","properties": [“读取”]},{“服务”:“1800”,“特性”:“2aa6”,“属性”:[“读取”]},{“服务”:“6e400001-b5a3-f393-e0a9-e50e24dcca9e ","特性":"6e400003-b5a3-f393-e0a9-e50e24dcca9e","属性":["通知"],"描述符":[{"uuid":"2902"}]},{"服务": "6e400001-b5a3-f393-e0a9-e50e24dcca9e","特性":"6e400002-b5a3-f393-e0a9-e50e24dcca9e","属性":["WriteWithoutResponse","写入"]},{"服务":"1812 ","特性":"2a4e","属性":["读取","WriteWithoutResponse"]},{"服务":"1812","特性":"2a4d","属性":["读取" ,"写入","通知"],"描述符":[{"uuid":"2902"},{"uuid":"2908"}]},{"service":"1812","特性": "2a4d","属性":["读取","写入","通知"],"描述符":[{"uuid":"2902"},{"uuid":"2908"}]},{ “服务”:“1812”,“特征”:“2a4d”,“属性”:[“读取”,“写入”,“通知”],“描述符”:[{“uuid”:“2902”},{ "uuid":"2908"}]},{"service":"1812","characteristic":"2a4b","properties":["Read"]},{"service":"1812","characteristic ":"2a33","属性":["读取","写入","通知"],"描述符":[{"uuid":"2902"}]},{"服务":"1812", "characteristic":"2a4a","properties":["Read"]},{"service":"1812","characteristic":"2a4c","properties":["WriteWithoutResponse"]},{"service ":"fee7","characteristic":"fec9","properties":["读取","通知"],"descriptors":[{"uuid":"2902"}]},{"service": "fee7","characteristic":"fea1","properties":["读取","指示"],"descriptors":[{"uuid":"2902"}]},{"service":"fee7 ","characteristic":"fea2","properties":["读取","写入","指示"],"描述符":[{"uuid":"2902"}]}]}
我分析了另一个Android应用程序,我用这个智能手环和我的手机用Wireshark和蓝牙日志捕获了接收和发送的蓝牙数据,以了解传输哪些数据或协议来获取温度,我确信温度为:
0000 02 02 20 14 00 10 00 04 00 1b 12 00 ab 00 0a ff .. ...... 0010 51 13 14 06 05 06 37 24 05
问.....7$.
但我不知道如何将此响应转换为实际温度(以 C° 为单位),有人知道如何从这个智能手环中提取真实数据吗?
提前致谢。
const readCharacteristic = await device.readCharacteristicForService(userDataServiceUUID, heightCharacteristicUUID); // assuming the device is already connected
const heightInCentimeters = Buffer.from(readCharacteristic.value, 'base64').readUInt16LE(0);
https://github.com/Polidea/react-native-ble-plx/wiki/=--FAQ:-传递和检索特征值
您能解决这个问题吗?我目前在使用该手柄时遇到了类似的问题,希望得到一些指导。