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

How to use HTS to notify temperature instead of indicate ?

As per the example, HTS only the "indicate" property is mandatory. But, I want to use Notify and Read property. The example suggests using the intermediate temperature in order to use Notify property in the temperature measurement. Is there any alternative approach to it?

Thanks in advance!

  • I can't see what would be wrong with the measurements. I don't think there is anything wrong with what you are doing.

  • Thanks! It works fine. I have plugged in the HTS service. I have a doubt though. What temperature is actually being transmitted here? Is it the chip's temperature or other value? I see only 37.6 value. Please clarify!

  • The values are only simulated. They should change if you press Button 1.

  • Hi,

    I am using the following

    SDK 14.2

    Profile - HTS

    Device -nRF52832

    As per your above suggestion, I have done below to change property to "notify from indicate".

    static uint32_t hts_measurement_char_add(ble_hts_t * p_hts, ble_hts_init_t const * p_hts_init)
    {
        .
        .
        .
        char_md.char_props.notify = 1;
        
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);(added above to memset of attr_md function call)
       
        
        .
        .
        .
    }

    As extra ,I have done the below also on function ble_hts_measurement_send()

    hvx_params.type   = BLE_GATT_HVX_INDICATION;
           to
    hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;

    After all those modification, it is not working(crashing) in notify property hence I have the following question.

    Q1: Whether I have to change anything on services_init() function?

        Below are available inside services_init function
                      BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&hts_init.hts_meas_attr_md.cccd_write_perm);
                      BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&hts_init.hts_meas_attr_md.read_perm);
                      BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&hts_init.hts_meas_attr_md.write_perm);
        
                      BLE_GAP_CONN_SEC_MODE_SET_OPEN(&hts_init.hts_temp_type_attr_md.read_perm);
                      BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&hts_init.hts_temp_type_attr_md.write_perm);

    Q2: Function on_cccd_write() is having function/statement only regarding indication. Anything needs to be changed on this function?

    Please let me know your feedback on this.

Related