Notify issue in ble_app_peripheral example code

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
Rajapurerohit
Offline
Last seen:8 months 5 days ago
加入:2017-04-20 09:17
Notify issue in ble_app_peripheral example code

Hi Dialog_Support,

I am using ble_app_peripheral reference example in my project. I have added "Notify" characteristic, i wanted to update data whenever i enable the "Notify" characteristic in BLE_Scanner app . And this is happening perfectly but the issue is if i disable the "Notify" then also i am getting data updated in BLE_Scanner app. Not understanding where i am going wrong.
can any one suggest me what is the issue ?

Device:
MT_dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Rajapurerohit,

Hi Rajapurerohit,

Well, when you enable and disable the notifications the gattc_write_cmd_ind_handler() is triggered and writes the Client Configuration Characteristic with the corresponding value, the functions that actually updates the value is:

if (status == PRF_ERR_OK)
{
// Set Client Characteristic Configuration value
status = attmdb_att_set_value(param->handle, param->length, (uint8_t*)&(param->value[0]));
}

So you can check this value when you disable the notification if it is set to zero. If that value is zero when you send the message to update the value and send the notification, the code should check if the CCC is enabled or not via this function attmdb_att_get_value(cfg_hdl, &length, &cfg_val); if the value in the cfg_hdl has the PRF_CLI_START_NTF value then the device will keep on sending the notifications. So i suppose that the error is somewhere there. The ble_app_peripheral also uses notifications in order to update the ADC value, so you can have a look at that example.

Thanks MT_dialog