Hi, trying to set up an app to read heart rate data from my heart rate strap.
I have tried numerous examples like the ones found in HRM heart rate monitor and others, but in all of them bluetooth fails to find my device.
So, I built my own from scratch following parts of different examples and am able to find my device and (crudely) list the services and characteristics.
However, my problem is retrieving data from the device. I have tried registering to receive bytes, floats, integers, strings and shorts. Strings work but i get weird characters, and only using shorts I get what seems to be 16 bit integer values as expected from that.
The data I get is as follows, each line corresponds to a "shorts received" event, you can see sometimes the list is one item long, sometimes two:
13842, 1144,
13842, 1171,
13842, 1119,
13826,
13842, 1136,
13586, 1144,
13842, 1086,
13842, 1113,
13842, 1135,
13842, 1091,
13842, 1133,
13842, 1153,
13842, 1111,
13842, 1143,
13826,
13842, 1149,
13842, 1087,
13842, 1133,
13842, 1137,
13842, 1079
My problem now is to extract HR data from there, I have looked in the Bluetooth heart rate services PDF (attached) but it doesn't seem to correspond, only the first number, "1" indicating it is in 16 bit format, the rest doesn't, ie: the second bit should be 1 or 0, and in "13842" it's a 3.
Plus, according to the PDF it can change from 16 to 8 bit during transmission or from one device to another.
Also looked into some of the examples, but they use the "bytesreceived" or "integersreceived" which do nothing for me. I attach my .aia in case someone wants to have a look (it needs some improvement here and there, but it works )
So my questions are: how to differentiate if I'm receiving 8 or 16 bit integers, etc, and how to translate the data above to heartrate data?, if someone has experience with this or can interpret from what the PDF says according to the data I pasted above.
HRS_SPEC_V10.pdf (348.9 KB)
BLE_HR.aia (196.3 KB)