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

BLE Scan with filtering - how to get the content of filtered advertisement messages

Hello guys,

We are performing BLE Scan with filtering by using the device name as a filter.

We are aware of the following facts:

  1. All the advertising packets will be forwarded to the application from the SoftDevice. Not only advertising packets from filtered devices (link).
  2. When advertising packet is received, BLE_GAP_EVT_ADV_REPORT BLE event is triggered (link). Advertising data can be extracted from  p_ble_evt->evt.gap_evt.params.adv_report.data structure.
  3. When scan filter matches, NRF_BLE_SCAN_EVT_FILTER_MATCH scan event is triggered inside scan_evt_handler() function (link).

Now, in our application code, we would like to extract the content only of the advertising packets that match the scan filter (i.e. advertisement packets from BLE devices with particular name).

How can we actually do it? We can successfully detect both BLE_GAP_EVT_ADV_REPORT and NRF_BLE_SCAN_EVT_FILTER_MATCH events but what is the connection between those? Should I set some flag when NRF_BLE_SCAN_EVT_FILTER_MATCH event occurs and extract advertisement data when next BLE_GAP_EVT_ADV_REPORT event happens?

Thanks in advance for your time and efforst.

Cheers,

Bojan.

Related