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

Why is scan_evt.params.p_not_found used when we use the whitelist

I am looking at the example of the HRS collector (Central) of the SDK also called ble_app_hrs_c.

In the file nrf_ble_scan.c in the function nrf_ble_scan_on_adv_report we have the following code:

    // If the whitelist is used, do not check the filters and return.
    if (is_whitelist_used(p_scan_ctx))
    {
        scan_evt.scan_evt_id        = NRF_BLE_SCAN_EVT_WHITELIST_ADV_REPORT;
        scan_evt.params.p_not_found = p_adv_report;
        p_scan_ctx->evt_handler(&scan_evt);

        UNUSED_RETURN_VALUE(sd_ble_gap_scan_start(NULL, &p_scan_ctx->scan_buffer));
        nrf_ble_scan_connect_with_target(p_scan_ctx, p_adv_report); // connects with target! bad

        return;
    }

We see that the p_adv_report is saved in scan_evt.params.p_not_found and then the handler is called.

What I don't understand:

  •          Where do we even check if the address is on the whitelist? we just check if the whitelist ist used. Does this happen before calling nrf_ble_scan_on_adv_report ?
  •          Why do we not use p_whitelist_adv_report instead of p_not_found ?

Thanks for your help!

Parents Reply Children
Related