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

Scan request callback

Hi,

I'm wondering if there's any way to check if a peripheral device was actively scanned? I can easily set my own scan response data but is there any message generated when this data is requested by or sent to the host? I'm using SoftDevice S110 in version 5.2.1.

Best regards,

  • FormerMember
    0 FormerMember

    In the latest version of S110, S110 v8.0.0, you can set the application to receive an event upon scan requests, this is stated in the release notes:" The main features of this release are the ability to set the size of the GATT Server Attribute Table when initializing the BLE stack, the possibilityfor the application to be notified when the SoftDevice receives scan requests, and the ability to disable RF channels for advertising."

    Setting the firmware to receive scan requests should be done in the ble_opt_t argument in sd_ble_enable(..): ble_opt_t -> ble_gap_opt_t ->ble_gap_opt_scan_req_report_t.

    After setting the scan request option, the scan request are notified with the event BLE_GAP_EVT_SCAN_REQ_REPORT.

  • The ble_opt_t argument appears to be passed to SD through sd_ble_opt_set. The sd_ble_enable fn only accepts ble_enable_params_t which only has gatts_enable_params.

  • Here is sample code that I confirmed works today.

    err_code = sd_ble_enable(&ble_enable_params);
    APP_ERROR_CHECK(err_code);  
    

    #ifdef SCAN_REQUEST_NOTIFICATION const ble_opt_t scan_req_opt={ .gap_opt = { .scan_req_report = { .enable=1} } }; sd_ble_opt_set(BLE_GAP_OPT_SCAN_REQ_REPORT, &scan_req_opt); #endif

Related