This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why do we need to encode data in Heart Rate Measurement profile?

Hello,

Looking into the characateristic of Heart Rate BLE profile, I've come accross to the function hrm_encode(ble_hrs_t * p_hrs, uint16_t heart_rate, uint8_t * p_encoded_buffer), and I start to wonder, why do we need to encode the data with this function? What is the benefit?

Furthermore, if I would do my own characteristic based on the hrm profile where I send a float instead of an uint16_t for instance, should I change this function?

Thanks in advance

Parents
  • Heart Rate Monitor has standard HTP Profile and HTS Service defined by BT SIG, you can download the spec free of charge. As such they define not only GAP and GATT roles and GATT Service/Characteristic count/UUIDs/privileges etc. but also protocol on top of Characteristics' Values. So if you want to use it and be interoperable you need to encode information according to the specification. If you ask why is it so then I'm afraid you need to call to BT SIG and challenge them;)

    If you do your proprietary GAP Profile and GATT Service specification/app then you azre free to define your protocol on top of GATT. If you then use some SDK example as "template" then indeed you need to change such encoding functions unless you keep the protocol exactly as defined for HRS by BT SIG.

Reply
  • Heart Rate Monitor has standard HTP Profile and HTS Service defined by BT SIG, you can download the spec free of charge. As such they define not only GAP and GATT roles and GATT Service/Characteristic count/UUIDs/privileges etc. but also protocol on top of Characteristics' Values. So if you want to use it and be interoperable you need to encode information according to the specification. If you ask why is it so then I'm afraid you need to call to BT SIG and challenge them;)

    If you do your proprietary GAP Profile and GATT Service specification/app then you azre free to define your protocol on top of GATT. If you then use some SDK example as "template" then indeed you need to change such encoding functions unless you keep the protocol exactly as defined for HRS by BT SIG.

Children
Related