简体   繁体   English

如何从蓝牙设备检索数据?

[英]How can I retrieve the data from a bluetooth device?

I have a bluetooth device, in particular a Heart Rate Measurement. 我有一个蓝牙设备,尤其是心率测量仪。

The bluetooth standard for these kind of device is the 180D 2A37. 这种设备的蓝牙标准是180D 2A37。

This is the link: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml 这是链接: https : //developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml

I would like to get the measurements. 我想得到尺寸。 How can I do? 我能怎么做?

At the moment, I am able to connect and pair with my device using the Bluetooth API ( BluetoothSocket ) 目前,我可以使用Bluetooth API( BluetoothSocket )连接并与设备BluetoothSocket

First, follow the official documentation to setup blutooth API and get an instance of BluetoothSocket . 首先,按照官方文档设置blutooth API并获取BluetoothSocket的实例。 This socket can be used to read and write bit data. 该套接字可用于读取和写入位数据。

The chart you have mentioned explain the structure of 1 byte packets that the sensor uses. 您提到的图表说明了传感器使用的1字节数据包的结构。 So, you can start reading bytes off the socket and de-code each byte using reference chart to get data. 因此,您可以开始从套接字读取字节,并使用参考图对每个字节进行解码以获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM