Search code examples
androidflutterbluetoothbluetooth-lowenergy

Convert bytes into readable data ble wahoo cadence sensor


I'm trying to convert the speed sensor value into a readable format.

...

Below is the data bytes obtained from the wahoo speed sensor

Output obtained using ble programmatically: Raw output Bytes : [2,196,0,94,7]

Channelsble channels The above data byte1 seems like a wheel rev and I'm trying to decode the last wheel event time.

.....

The output obtained using nrfconnect app Imaenter image description herege:

Crank rev:3 Last crank event time:37932ms

Set of observed values:readings

I found that byte1 represents the crank rev count value, it's difficult for me to find the Last crank event time from bytes output


Solution

  • If you look at GATT Specification Supplement 5 it describes how to intepret the bytes:

    enter image description here

    enter image description here

    Looking at the data: [2, 4, 0, 94, 23] the 2 is in the flag position and represents Crank Revolution Data Present.

    The 4, 0 are Cumulative Crank Revolutions. As the data is in little endian the value is 4. The 94, 23 are Last Crank Event Time which is this case is a timestamp at 5982 (5.84 seconds)