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

Help switching from notification to indication

Guys

I am a newbie using nordic modulesI am just starting to program here with a nRF52 and SDK 12.2

I was trying to edit the experimental_ble_app_blinky and experimental_ble_app_blink_central to use Indication instead of Notifications. may I am missing something because the two devices cant connect between them I am using a sniffer and I am getting only the peripheral advertising packets.

the changes I did to the peripheral code:

ble_lbs_on_button_change()

    ble_gatts_hvx_params_t params;
uint16_t len = 1; 

Data[0] = count++;			

memset(&params, 0, sizeof(params));
params.type = BLE_GATT_HVX_INDICATION; //BLE_GATT_HVX_NOTIFICATION;
params.handle = p_lbs->button_char_handles.value_handle;
params.p_data = Data[0]
params.p_len = &len;

return sd_ble_gatts_hvx(p_lbs->conn_handle, &params);

(2)

on the button_char_add():

  char_md.char_props.read   = 1;
char_md.char_props.indicate= 1;  // char_md.char_props.notify
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         = &cccd_md;
char_md.p_sccd_md         = NULL;

and the central blinky changes on cccd_configure()

tx_message_t * p_msg;
uint16_t       cccd_val = enable ? BLE_GATT_HVX_INDICATION: 0; // BLE_GATT_HVX_NOTIFICATION 

Can some one give a hand? I cant be sure If I am doing it good or if there are extra changes

Thanks :)

Related