This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to implement Whitelist in SDK12.2.0

Hi, I test Whitelist function in the example ble_app_hids_keyboard_pca10040_s132 using SDK12.2.0. I donnot understand the code in "case BLE_ADV_EVT_WHITELIST_REQUEST:" located in function on_adv_evt(). Following is my question:

1.I guess I should add my ble address in "whitelist_addrs[]". Maybe this contains all the ble whitelist that can connect with nrf52832. Am I right?

2.What is the meaning of "whitelist_irks[]" ? what is the function and how to use?

3."pm_whitelist_get()" ? Why we get the whitelist here? Why is not pm_whitelist_set()? I am confused about it.

I know when I disconnect, this case will be excuted for broadcasting whitelist address. I just need to add address in "whitelist_addrs[]" and add information in "whitelist_irks[]" in this case,then I can use whitelist.Right?

Looking forward to your reply. Thanks a lot!

    1. If you have static address you can manually make your whitelist, yes.

    2. If a device has a Private Resolvable address type it will not be static, it will change every x minutes, but it can be resolved with an IRK.

    3. You can get a whitelist with all bonded devices from the Peer Manager.

  • I have static address. Following is my code:

    1.on the top of

    "switch (ble_adv_evt)" in the function on_adv_evt().
    ble_gap_addr_t whitelist_addr = {1, BLE_GAP_ADDR_TYPE_RANDOM_STATIC,{0xBD,0x5f,0x14,0x80,0x07,0x00}};
    ble_gap_addr_t const     *p_whitelist_addr[] = {&whitelist_addr};
    

    2.set whitelist in

    "case BLE_ADV_EVT_WHITELIST_REQUEST:"
    err_code = sd_ble_gap_whitelist_set(p_whitelist_addr, 1);
    APP_ERROR_CHECK(err_code);
    err_code = ble_advertising_whitelist_reply(&whitelist_addr, 1, NULL, 0);
    APP_ERROR_CHECK(err_code);
    

    But it failed. Because when excuting "sd_ble_gap_whitelist_set()", it returns error and "ble_advertising_whitelist_reply()" has never been excuted. Is there anything wrong with it? I hope to use whitelist without using bonding. Thanks a lot! Looking forward to you.

  • Hi Petter, the example use peer_id to add BLE address into whitelist. How can I directly add my BLE MAC address into whitelist without using peer_id? Above is findings in this forum but cannot pass. Now I am evaluating nrf52832, hope you can help me to solve problems. Thank you very much!

  • What error does sd_ble_gap_whitelist_set() return? What if you do:

    ble_gap_addr_t whitelist_addr = {0, BLE_GAP_ADDR_TYPE_RANDOM_STATIC,{0xBD,0x5f,0x14,0x80,0x07,0x00}};
    
Related