Ble Heart Rate Senser Value Interpretation
I have an Android App where I get Heart Rate Measurements from a Polar H10 Device. I'm totally lost on how to interpret the heart rate. Various links to the bluetooth.com site are
Solution 1:
See Heart Rate Value in BLE for the links to the documents. As in that answer, here's the decode:
Byte 0 - Flags: 16 (0001 0000)
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: 00 => Not supported or detected
- Bit 3 - Energy Expended Status: 0 => No Present
- Bit 4 - RR-Interval: 1 => One or more values are present
So the first byte is a heart rate in UInt8 format, and the next two bytes are an RR interval.
To read this in Kotlin:
characteristic.getIntValue(FORMAT_UINT8, 1)
This return a heart rate of 56 bpm.
And ignore the other two bytes unless you want the RR.
Solution 2:
It seems I found a way by retrieving the value as follows
valhearRateDecimal= characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 1)
2 things are important first - the format of UINT8 (although I don't know when to use UINT8 and when UINT16. Actually I thought I need to use UINT16 as the first byte is actually 16 (see the question above) second - the offset parameter 1
What I now get is an Integer even beyond 127 -> 127, 128, 129, 130, ...
Post a Comment for "Ble Heart Rate Senser Value Interpretation"