bluetooth-lowenergycore-bluetoothbtle

BTLE characteristic value has too many bytes


I'm trying to read data from the BTLE fitness machine service, specifically the Indoor Bike Data characteristic.

A typical reading I'm getting has the bytes 44-02-9c-09-5c-00-4f-00-50. The first two are flags which indicate that the rest of the bytes represent, in order:

The trouble is, that only accounts for 5 more bytes, but there are 7 more bytes in the value. It looks like 5c-00 is cadence, 00-4f is power, and 50 is heart rate, but

What do I need to do to parse these bytes correctly? In this specific case I could maybe skip those two bytes, but that won't be reliable over different device manufacturers.

Update: FWIW I don't think it was correct to mark this as a duplicate. I was able to parse the bytes, the problem was that the result appeared to contradict the fitness machine spec. The accepted answer clarified that.


Solution

  • The 9c-09 value is instantaneous speed, which is present (counterintuitively) if the first flag bit is 0. See Fitness Machine Service spec, section 4.9.1.1.