Search code examples
androidbluetooth-lowenergygattandroid-ble

I want to identify the BLE wheel and crank sensor data from the 11-bytes data from a mobile application we have developed


I want to identify the wheel and crank sensor data from the 11-bytes data. I have tried to parse the 11-bytes hex data which i got in our mobile application as per the split ups in the link below.

https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.csc_measurement.xml

For instance i have tried the following,

Hex Data : 0x03 6D010000 FC7E 2C01 F87E

Flag-03 ->0000 0011 -> 8bits so both are true hence we can get the wheel and crank's respective values.

Cumulative Wheel Revolutions- 6D 01 00 00 -> 32bits so converting it in decimal we get -1828782080

Last Wheel Event Time- FC 7E -> 16bits so converting it in decimal we get - 64638

Cumulative Crank Revolutions- 2C 01 -> 16bits so converting it in decimal we get - 11265

Last Crank Event Time- F8 7E -> 16bits so converting it in decimal we get - 63614

I am unable to get the actual wheel and crank measurement values from the BLE. Is the above procedure what i have understood from the reference link which i have followed is correct ? or am i wrong elsewhere ? I have put our maximum effort to dissect and parse the data but unfortunately I am unable to reach the solution. Kindly guide me through this process. What do we have to do to get the right value ? Like am i supposed to multiply it with some number ? I have tried with different combination yet not able to get. The device i am using is the SunDing515 cycling speed and cadence sensor with Bluetooth low energy.


Solution

  • From your data and from the data sheet, we see that the values are using unsigned integer. (uint16 or uint8). None of your value should be negative.

    Usually, bluetooth values are little endian instead of big endian. Example:

    6D010000 should be read 00 00 01 6D = 365

    FC7E should be read 7E FC = 32508

    2C01 should be read 01 2C = 300

    F87E should be read 7E F8 = 32504