BLE 通信协议 T1S (Smart Band) 获取数据
Posted
技术标签:
【中文标题】BLE 通信协议 T1S (Smart Band) 获取数据【英文标题】:BLE Communication Protocol T1S (Smart Band) Get Data 【发布时间】:2020-06-05 19:55:21 【问题描述】:我想将我的安卓应用程序与这个智能手环 (T1S) 通信,我已经配对了它,但我不知道如何从中提取数据,例如温度等。 我从中得到了特性和服务:
"name":"T1S","id":"F4:C3:33:99:21:5D","advertising":,"rssi":-78,"services":[" 1801","1800","6e400001-b5a3-f393-e0a9-e50e24dcca9e","1812","fee7"],"特征":["服务":"1801","特征":"2a05", "properties":["Broadcast","Read","Write","Notify","Indicate","AuthenticateSignedWrites"],"descriptors":["uuid":"2902"],"service ":"1800","characteristic":"2a00","properties":["Read"],"service":"1800","characteristic":"2a01","properties":["Read" ],"service":"1800","characteristic":"2a02","properties":["Read"],"service":"1800","characteristic":"2a04","properties ":["Read"],"service":"1800","characteristic":"2aa6","properties":["Read"],"service":"6e400001-b5a3-f393-e0a9 -e50e24dcca9e","characteristic":"6e400003-b5a3-f393-e0a9-e50e24dcca9e","properties":["Notify"],"descriptors":["uuid":"2902"],"service ":"6e400001-b5a3-f393-e0a9-e50e24dcca9e","特征":"6e400002-b5a3-f393-e0a9-e50e24dcca9e","属性":["WriteWithoutResponse","Write"],"服务": “1812”,“性格” eristic":"2a4e","properties":["Read","WriteWithoutResponse"],"service":"1812","characteristic":"2a4d","properties":["Read","Write ","Notify"],"descriptors":["uuid":"2902","uuid":"2908"],"service":"1812","characteristic":"2a4d" ,"属性":["读取","写入","通知"],"描述符":["uuid":"2902","uuid":"2908"],"服务" :"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" ,"特征":"fea1","属性":["读取","指示"],"描述符":["uuid":"2902"],"服务":"fee7","characteristic":"fea2","properties":["Read","Write","Indicate"],"descriptors":["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 美元。
但我不知道如何将此响应转换为以摄氏度为单位的实际温度,有人知道如何从这个智能手环中提取真实数据吗?
提前致谢。
智能手环链接: https://www.alibaba.com/product-detail/Cheap-High-Quantity-Bluetooth-Smart-Bracelet_1600057978967.html?spm=a2700.icbuShop.111720.6.54226ef9FPTgvq
【问题讨论】:
【参考方案1】: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:-Passing-And-Retrieving-Of-Characteristic-Value
【讨论】:
以上是关于BLE 通信协议 T1S (Smart Band) 获取数据的主要内容,如果未能解决你的问题,请参考以下文章
原创技术分享200SMART通过TCP协议创建到另一设备的链接