The spec says (for example UUID 0x0037),
Which means what? There are 18 bytes, and 18 fields. So each of these fields (above only the first 6 shown) has 1 byte to convey a data value. So, I assume I have a value of 0-255 to map to a real quantity. But how? I wrote this code, but to be honest I'm not sure how to interpret these bytes.Data bytes packed as follows:
Elapsed Time Lo (0.01 sec lsb),
Elapsed Time Mid,
Elapsed Time High,
Distance Lo (0.1 m lsb),
Distance Mid,
Distance High,
... etc.
Code: Select all
const uint8_t *payload = [data bytes]; // data is the characteristic.value
NSTimeInterval secondsFraction = 0.01 * (uint8_t)payload[0]; // so the byte, 0-255, is multiplied by 0.01 and that's how many 100ths of a second?? Shouldn't it then have a value somewhere between 0-99 ?
NSTimeInterval seconds = (NSTimeInterval)1.f * (uint8_t)payload[1]; // likewise, this value would be 0-59 ?
NSTimeInterval minutes = (NSTimeInterval)1.f * (uint8_t)payload[2]; // what if I am rowing for longer than 255 minutes? See, I think I don't understand...