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

Filter packets by mac address

My device is central and peripheral running freertos.

In the central role it would receive advertised packets from devices with certain MAC addresses. peripheral device sends a packet every 5 seconds.

Somehow I dont receive all the packets. At the moment I tried to match MAC address in on_adv_report, but this didnt help.

then I added filtering in scan_init as follows:

err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
	APP_ERROR_CHECK(err_code);
	//char arr[6]={0x3A, 0xC0, 0x35, 0x47, 0x01, 0x01};
  char arr[6]={0x01, 0x01,0x47,0x35,0xc0,0x3A};
	err_code = nrf_ble_scan_filter_set(&m_scan,
                                          SCAN_ADDR_FILTER,
                                          arr);
  APP_ERROR_CHECK(err_code);
  err_code = nrf_ble_scan_filters_enable(&m_scan,
                                           NRF_BLE_SCAN_ADDR_FILTER,
                                           false);
    APP_ERROR_CHECK(err_code);

But when I check on_adv_report it still prints out all the messages from all MAC addresses withoyt filtering. 

What do I do wrong?

Thanks!

Related