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

scan_req_notification sdk16 not working 52833 SD 113

I have looked at and used the following references:

https://devzone.nordicsemi.com/f/nordic-q-a/47484/ble_gap_evt_scan_req_report-not-working

https://devzone.nordicsemi.com/f/nordic-q-a/13038/block-peripheral-connection-after-ble_gap_evt_scan_req_report

etc from the bottom of the list.

It seems that the scan_req_notification  = 1 is getting cleared from all the app level code when trying to use it.  I looked into ble_advertising.c

in function ble_advertising_start line 590    memset(&p_advertising->adv_params, 0, sizeof(p_advertising->adv_params));

It seems that no matter where in the app you put the notification = 1 @ line 590 it is getting cleared.  So I added

    p_advertising->adv_params.scan_req_notification    = 1;

@ line 591 and everything starts working.

If this is ok then fine.  But if I am doing things wrong can you please lead my to how to get past the clearing of my structure.

Thank you

  • Not sure if I understand the question, but to clarify a bit:

    For a central device you can on the BLE_GAP_EVT_ADV_REPORT event check the p_ble_evt->evt.gap_evt.params.adv_report.type.scan_response field if the received packet is a scan response or not. When starting scanning you need to set the scan_params.active=1 to request scan response packets before calling sd_ble_gap_scan_start().

    For a peripheral device that is advertising, you can configure both advertising and scan request packet when calling sd_ble_gap_adv_set_configure(). If you set the .scan_req_notification, then this will trigger an BLE_GAP_EVT_SCAN_REQ_REPORT event each time a central device request a scan request (from the description in ble_gap.h):

      uint8_t                  scan_req_notification:1; /**< Enable scan request notifications for this advertising set. When a
                                                             scan request is received and the scanner address is allowed
                                                             by the filter policy, @ref BLE_GAP_EVT_SCAN_REQ_REPORT is raised.
                                                             @note This parameter will be ignored when
                                                                   @ref ble_gap_adv_properties_t::type is a non-scannable
                                                                   advertising type. */

    Update: After re-reading your question I think the question is that it seems the advertising module (by error) clear the .scan_req_notification flag in the ble_advertising_start() even if set in the application. I agree with your suggestion to manually add .scan_req_notification=1 after line 590 if you need this event. You can also add a define, comment or warning around this line of code, so you can easily track this change for future.

    Best regards,
    Kenneth

Related