ionic-framework - BLE 通信协议 T1S (Smart Band) 获取数据
问题描述
我想将我的android应用程序与这个智能手环(T1S)通信,我已经配对了,但我不知道如何从中提取数据,例如温度等。我从中获得了特征和服务:
{"name":"T1S","id":"F4:C3:33:99:21:5D","advertising":{},"rssi":-78,"services":["1801", "1800","6e400001-b5a3-f393-e0a9-e50e24dcca9e","1812","fee7"],"characteristics":[{"service":"1801","characteristic":"2a05","properties" :["Broadcast","Read","Write","Notify","Indicate","AuthenticateSignedWrites"],"descriptors":[{"uuid":"2902"}]},{"service":" 1800","characteristic":"2a00","properties":["Read"]},{"service":"1800","characteristic":"2a01","properties":["Read"]}, {"服务":"1800","characteristic":"2a02","properties":["Read"]},{"service":"1800","characteristic":"2a04","properties":["Read "]},{"service":"1800","characteristic":"2aa6","properties":["Read"]},{"service":"6e400001-b5a3-f393-e0a9-e50e24dcca9e","特征":"6e400003-b5a3-f393-e0a9-e50e24dcca9e","属性":["通知"],"描述符":[{"uuid":"2902"}]},{"服务":"6e400001- b5a3-f393-e0a9-e50e24dcca9e","特征":"6e400002-b5a3-f393-e0a9-e50e24dcca9e","属性":["WriteWithoutResponse","Write"]},{"服务":"1812","特征":"2a4e","属性":["Read","WriteWithoutResponse"]},{"服务":"1812","特征":"2a4d","属性" :["Read","Write","Notify"],"descriptors":[{"uuid":"2902"},{"uuid":"2908"}]},{"service":"1812" ,"特征":"2a4d","属性":["读取","写入","通知"],"描述符":[{"uuid":"2902"},{"uuid":"2908" }]},{"service":"1812","characteristic":"2a4d","properties":["Read","Write","Notify"],"descriptors":[{"uuid":"2902"},{"uuid":"2908"}]},{"service":"1812","characteristic":"2a4b","properties":["Read"]} ,{"service":"1812","characteristic":"2a33","properties":["Read","Write","Notify"],"descriptors":[{"uuid":"2902"} ]},{"service":"1812","characteristic":"2a4a","properties":["Read"]},{"service":"1812","characteristic":"2a4c","properties ":["WriteWithoutResponse"]},{"service":"fee7","characteristic":"fec9","properties":["Read","Notify"],"descriptors":[{"uuid":"2902"}]},{"service":"fee7","characteristic":"fea1","properties":["Read","Indicate"],"descriptors":[{ "uuid":"2902"}]},{"service":"fee7","characteristic":"fea2","properties":["Read","Write","Indicate"],"descriptors": [{"uuid":"2902"}]}]}"指示"],"描述符":[{"uuid":"2902"}]}]}"指示"],"描述符":[{"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
Q.....7 美元.
但我不知道如何将此响应转换为以 C° 为单位的实际温度,有人知道如何从这个智能手环中提取真实数据吗?
提前致谢。
解决方案
const readCharacteristic = await device.readCharacteristicForService(userDataServiceUUID, heightCharacteristicUUID); // assuming the device is already connected
const heightInCentimeters = Buffer.from(readCharacteristic.value, 'base64').readUInt16LE(0);
推荐阅读
- r - 如何合并随时间变化的变量 [R]
- mongodb - mongo db 错误 - SyntaxError: missing ; 声明之前
- r - Rstudio 拥有 Excelfile 权限 - XLconnect
- apache-spark - Spark SQL 中的 ORDER BY 与 SORT BY
- javascript - 如何在ts中将值动态设置为数组中的对象
- java - Spring Boot 发送邮件 API REST
- c# - 已解决 ITextSharp:当行不适合第一页时,如何处理表格不进入下一页
- tfs - TFSBuild.exe 发送参数
- spring - Spring setLocale
- api - 如何使用 HTTP 请求参数属性将整数值传递给 json 请求正文?