I have beacon that broadcast its name with type 09. I cannot get it while scanning of nrf_uart_c (adv_report).
I assume I need to activate scan_req and then parse the response data - how can I do it?
I have beacon that broadcast its name with type 09. I cannot get it while scanning of nrf_uart_c (adv_report).
I assume I need to activate scan_req and then parse the response data - how can I do it?
Hi Avi,
Yes correct. If you use the nrf_ble_scan module, you need to set active=true in your scan param ble_gap_scan_params_t you feed into nrf_ble_scan_init().
The scan response packet will be reported the same as a normal advertising packet. It's reported to the application either by NRF_BLE_SCAN_EVT_FILTER_MATCH or NRF_BLE_SCAN_EVT_WHITELIST_ADV_REPORT if you use filter or by NRF_BLE_SCAN_EVT_NOT_FOUND event if you don't use any filter.
It is already set to active in the original code:
static void nrf_ble_scan_default_param_set(nrf_ble_scan_t * const p_scan_ctx)
{
// Set the default parameters.
p_scan_ctx->scan_params.active = 1;
I add SCAN NAME filter and also the releavnt part in the sdk_config and cannot get the scan_req data
If I use the blinky example it works (both in the peripheral and in the central).
My beacon data is as follows:
Hi Avi,
I would suggest to remove any filter and printout any advertising packet, scan response packet that you receive. Just to check if you actually receive the scan response (and if the scan response is actually sent).
After that you can check why the name scan filter doesn't work.
Hi,
I am able to read this data using the following way:
uint8_t *device_name;
device_name = ble_advdata_parse(p_adv_report->data.p_data, p_adv_report->data.len, BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
NRF_LOG_INFO("%s",device_name);
It means that I it trasnmitted and recieved.
But how can it be filtered?
Thanks
Avi
Hi Avi,
Then it should parsed correctly in the filter. You may want to add a breakpoint inside nrf_ble_scan_on_adv_report() where adv_name_compare() is called.