NCS scan request filter dosen't work

Hi:
CONFIG_BT_FILTER_ACCEPT_LIST=y;
...
static const struct bt_le_adv_param *adv_1_param =
    BT_LE_ADV_PARAM(BT_LE_ADV_OPT_NOTIFY_SCAN_REQ|BT_LE_ADV_OPT_SCANNABLE|BT_LE_ADV_OPT_FILTER_SCAN_REQ,
            Ta1/0.625,
            Ta1/0.625,  
            NULL);
...
 err = bt_addr_le_from_str("FF:EE:DD:CC:BB:AA", "random", &addr);
   err = bt_le_filter_accept_list_add(&addr);
it dosen‘t work,why?
scanner MAC has beed set("FF:EE:DD:CC:BB:AA"):
Looking forward to your reply.
  • Hello,

    Can you elaborate a bit what doesn't work?

    For test maybe try to set all address bytes to the same value, I suggest "C3", reason for trying this is that it will ensure the problem is not related to endianness of the address.

    Kenneth

  • Thank you for your reply!

    I found the problem but i don't know why;

    I printk the address of my scanner in "bt_le_ext_adv_cb.scanned" and i find scanner always changes its random address every time i reset the board.Even if i set the random address as follows:

    Do you know why?Could you help me?

    Best wishes

  • Sounds like things are working then. 

    From \zephyr\include\zephyr\bluetooth\bluetooth.h you can find:

     * If the application wants to have the stack randomly generate identities
     * and store them in flash for later recovery, the way to do it would be
     * to first initialize the stack (using bt_enable), then call settings_load(),
     * and after that check with bt_id_get() how many identities were recovered.
     * If an insufficient amount of identities were recovered the app may then
     * call bt_id_create() to create new ones.

    I expect the problem here is that you don't have settings_load().

    Kenneth

Related