Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get a callback each time a peripheral refuse a connection with a not whitelisted device

Hi, we're developing a peripheral (SD 132) which uses whitelist to prevent connection from unwanted devices.

All works fine and when an unlisted device try to connect, it receive back a connection error with BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED.

Is there a way on peripheral device which refuse unlisted connections, to rise a callback each time a connection is refused for unlisted devices?

Thanks

Luca

Parents
  • Hi, not really, but if you setup advertisment with whitelist using p_adv_params->fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; then you can still configure to get a BLE_GAP_OPT_SCAN_REQ_REPORT every time someone is requesting a scan request, with for instance the RSSI value (so maybe you can take an action if someone is scanning you very close, for instance by adding them to the whitelist). You need to use sd_ble_opt_set() to enable scan request events.

  • Thanks for the reply, I saw that ble_advertising_start() calls, in my case, set_adv_mode_slow() and set_adv_mode_fast() and these functions call ble_advdata_set() using p_adv_params->fp = BLE_GAP_ADV_FP_FILTER_CONNREQ;

    So, where I have to put BLE_GAP_OPT_SCAN_REQ_REPORT case? How can I register the callback called on BLE_GAP_OPT_SCAN_REQ_REPORT event?

    I don't know if this could be a solution for my problem, what I wanna do is almost this:

    • Count the refused connection 'cause tries from unlisted devices
    • After n refused connection, do something, like stop advertising for a specific amount of time.

    Is there a way to do this?

    Thanks again

    Luca

Reply
  • Thanks for the reply, I saw that ble_advertising_start() calls, in my case, set_adv_mode_slow() and set_adv_mode_fast() and these functions call ble_advdata_set() using p_adv_params->fp = BLE_GAP_ADV_FP_FILTER_CONNREQ;

    So, where I have to put BLE_GAP_OPT_SCAN_REQ_REPORT case? How can I register the callback called on BLE_GAP_OPT_SCAN_REQ_REPORT event?

    I don't know if this could be a solution for my problem, what I wanna do is almost this:

    • Count the refused connection 'cause tries from unlisted devices
    • After n refused connection, do something, like stop advertising for a specific amount of time.

    Is there a way to do this?

    Thanks again

    Luca

Children
Related