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!

Parents
  • Hi,

    I'm not sure if I understand your question, but to use notification you can change this line in the function hts_measurement_char_add() ble_hts.c

    char_md.char_props.indicate = 1;
    

    to

    char_md.char_props.notify = 1;
    

    and to enable reading change this:

    attr_md.read_perm  = p_hts_init->hts_meas_attr_md.read_perm;
    

    to e.g. this

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
    

    If you make these changes though, your device will no longer comply with the HTS profile.

  • 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.

Reply
  • 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.

Children
No Data
Related