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

Advertisment whitelist without device manager

Dear Support,

I am working with the new SDK 15, and got some question about using whitelist without device manager, and without pairing or bonding. As stated here: https://devzone.nordicsemi.com/b/blog/posts/bluetooth-smart-and-the-nordics-softdevices-part-1 you could use the whitelist without device manager. I've been looking at the HID example, but I cannot find any place where the code sets the whitelist in the stack. In the ble_advertising.c there is just saved a flag, which says do the whitelisting, but the whitelst itself is not used itself, I've tried to use the sd_ble_gap_whitelist_set() function in my project, but I always get the 0x3202 Error back. Does the HID example works at this time? How get the advertisment module inside the stack the whitelist, did they pull the addresses dirctly from device manager?

I just wanted just to make the device visible through discovery just a limited time after a button press, otherwise  the device will be connectable to the one device previous connected, no bonding or pairing. I have found, that the whitlelist could be the solution for my problem. Is there another way to do this?

Thanks in advance.

  • Hello rolliG,

    If you look at the API documentation for sd_ble_gap_whitelist_set() you can see that the error code you are getting is BLE_ERROR_GAP_INVALID_BLE_ADDR (defined in in ble_gap.h), meaning that the address type you supplied was invalid.

     

    If what you want is to temporarily disable the whitelist, and you are using the advertising module, you could try calling ble_advertising_restart_without_whitelist()

    Some examples, such as ble_app_hrs have this mapped to a button.

    /**@brief Function for handling events from the BSP module.
     *
     * @param[in]   event   Event generated by button press.
     */
    void bsp_event_handler(bsp_event_t event)
    {
        ret_code_t err_code;
    
        switch (event)
        {
            case BSP_EVENT_SLEEP:
                sleep_mode_enter();
                break;
    
            case BSP_EVENT_DISCONNECT:
                err_code = sd_ble_gap_disconnect(m_conn_handle,
                                                 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
                if (err_code != NRF_ERROR_INVALID_STATE)
                {
                    APP_ERROR_CHECK(err_code);
                }
                break;
    
            case BSP_EVENT_WHITELIST_OFF:
                if (m_conn_handle == BLE_CONN_HANDLE_INVALID)
                {
                    err_code = ble_advertising_restart_without_whitelist(&m_advertising);
                    if (err_code != NRF_ERROR_INVALID_STATE)
                    {
                        APP_ERROR_CHECK(err_code);
                    }
                }
                break;
    
            default:
                break;
        }
    }

Related