首先是官方文档,但是感觉说的不是特别清晰:
https://www.bluetooth.com/specifications/specs/heart-rate-profile-1-0/
https://www.bluetooth.com/specifications/specs/heart-rate-service-1-0/
然后是一个网友的总结:
Determine the format
The Bluetooth site has been reorganized recently (~2020), and in particular they got rid of some of the document viewers, which makes things much harder to find and read IMO. All the documentation is in the Heart Rate Service (HRS) document, linked from the main GATT page, but for just parsing the format, the best source I know of is the XML for org.bluetooth.characteristic.heart_rate_measurement. (Since the reorganization, I don't know how you can find this page without searching for it. It doesn't seem to be linked anymore.)
Byte 0 - Flags: 22 (0001 0110)
Bits are numbered from LSB (0) to MSB (7).
- Bit 0 - Heart Rate Value Format: 0 => UINT8 beats per minute
- Bit 1-2 - Sensor Contact Status: 11 => Supported and detected
- Bit 3 - Energy Expended Status: 0 => Not present
- Bit 4 - RR-Interval: 1 => One or more values are present
The meaning of RR-intervals is explained in the HRS document, linked above. It sounds like you just want the heart rate value, so I won't go into them here.
Byte 1 - UINT8 BPM: 56
Since Bit 0 of flags was 0, this is the beats per minute. 56.
Bytes 2-5 - UINT16 RR Intervals: 55, 4, 7, 3
You probably don't care about these, but there are two UINT16 values here (there can be an arbitrary number of RR-Interval values). BLE is always little-endian, so [55, 4] is 1,079 (55 + 4<<8), and [7, 3] is 775 (7 + 3<<8).
I believe the docs are a little confusing on this one. The XML suggests that these values are in seconds, but the comments say "Resolution of 1/1024 second." The normal way to express this would be <BinaryExponent>-10</BinaryExponent>
, and I'm certain that's what they meant. So these would be:
- RR0: 1.05s (1079/1024)
- RR1: 0.76s (775/1024)
来自:https://stackoverflow.com/a/65458794
补充信息:https://blog.csdn.net/weixin_44336913/article/details/138419344
标签:heart,RR,蓝牙,心率,rate,values,https,BLE,Bit From: https://www.cnblogs.com/xwgli/p/18640870