Unable to set characteristic to use Indicate rather than Notify

Hi, I'm trying to set up a Bluetooth service on an custom board that sends indications to a central. Currently, I am able to subscribe to notifications but can't seem to turn on indications. I think I made the appropriate changes to the definition of the characteristic, as shown below. However, with this code, the service still seems to only allow for notifications. 

As seen in the Bluetooth sniffer report below, this characteristic seems to only allow notifications.

However, I've set the "notify" properties to FALSE and "indicate" properties to TRUE in the characteristic definition.

In characteristic_add():

// Properties displayed to the central during service discovery
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1;
char_md.char_props.write = 0;
char_md.char_props.notify = 0;
char_md.char_props.indicate = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = NULL;
char_md.p_sccd_md = NULL;

In ble_service_init():

ble_add_char_params_t   add_char_params;

...

add_char_params.is_value_user = 1;
add_char_params.is_var_len = 1;
add_char_params.char_props.notify = 0;
add_char_params.char_props.indicate = 1;
add_char_params.cccd_write_access = p_sws_init->sw_meas_cccd_wr_sec;
add_char_params.p_init_value = init_value_encoded;

Thanks in advance.

Noelle

  • Hi Noelle,

    I don't see any errors in the code you posted. Maybe the phone has cached the notifiy property from a previous connection? This can happen if you don't use the service changed characteristic in your application (NRF_SDH_BLE_SERVICE_CHANGED).  Please go to iOS Settings > Bluetooth, forget your device if it is paired, and then toggle Bluetooth off and on. This should clear the attribute cache and cause the phone to perform a new service discovery on the next connection.

    Best regards,

    Vidar

Related