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

about BLE_HIDS_EVT_NOTIF_ENABLED

Hi Nordic team,

I have a simple HID BLE device which send volume+/- multimedia keys to a Android device, it works well if it is first time to pair with the Android device, but if I switch off Bluetooth in Android's setting menu and switch on again, the volume+/- keys no longer working.

I checked and debugged and found it is caused by the BLE device not getting the BLE_HIDS_EVT_NOTIF_ENABLED from the Android phone, so the HVX return code is 0x8 and failed. I also search the forum and found there's no way to enable the notify on peripheral side, I also found there're solutions is to call "sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0)", but I'm not sure where to put this function, I have tried that function in "BLE_GAP_EVT_CONNECTED", "BLE_GATTS_EVT_SYS_ATTR_MISSING" events but none of them works.

Any suggestion where am I doing wrong and how to fix this to enable the notify? Thanks very much..

added main.c here: main.c

  • Hi,

    Thanks for the reply, in addition to main.c, i also added a lbs(LED & Button service) sample code in my project, i did find device manager called the function sd_ble_sys_attr_get/set(can't remember the full function name) but the return code is failed(softdevice not ready) or err_code = 0x3002, it looks like device manager has failed to save to flash and retrieve from it.

    I will upload my main.c tomorrow, before that, any suggestion that why DM has failed to store/reload the CCCD? My other question is, if DM successfully store/reload the CCCD value, then the notification will be enabled?

    Thanks very much..

  • Error code 0x3002 is BLE_ERROR_INVALID_CONN_HANDLE. This indicates that the connection is not established yet. It could also indicate that something else has gone wrong with loading the bonding info or similar. Can you add ENABLE_DEBUG_LOG_SUPPORT to the preprocessor symbols? Then the device manager will print debug information either to uart or RTT (whichever you are using with printf)

  • Hi,

    Sure, I will add that and see what happen tomorrow and let you know.

    Thanks,

  • Hi,

    i have added my main.c to the initial post, hope this help. another thing i found today, is in the very first time of pairing between Android and my BLE, i see there's a "BLE_GAP_EVT_CONNECTED" event is received, but if i turn off Android's BLuetooth and switch on again, the BLE is re-connect automatically but i didn't see "BLE_GAP_EVT_CONNECTED" event is coming and of course, no "BLE_HIDS_EVT_NOTIF_ENABLED" event, too.

    From my observation, i need to see "BLE_HIDS_EVT_NOTIF_ENABLED" event to let the BLE works, that's why I keep looking for the way to enable notification on BLE side.

    Any suggestion? Thanks in advance.

  • never mind the BLE_HIDS_EVT_NOTIF_ENABLED event, if you aren't getting the CONNECTED event then you aren't connected and if you aren't connected then nothing is going to work. So start by working out why that's not working.

Related