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

Misunderstanding about adertising mode "Whitelist"

Dear Nordic Developer Zone,

I am using nRF51822 with softdevice.

I don't understand very well the advertising mode "whitelist". My target is to be able to connect with only one paired iPhone.

So, the first time I power on the nRF51822, I advertise without restriction and all centrals can be pairing with the device. But when a central has been paired, the nRF51822 advertises using the whitelist mode.

I thought that only the paired iPhone will see the device advertisement due to the whitelist, but I read somewhere on that the whitelist is only used in the LL (link layer) of the nRF51822 to accept or not the connection of the central.

Here is the behaviour I don't understand : When my first iPhone is paired to the nRF51822 and it advertises with whitelist mode, I am able to connect and pair another iPhone to my nRF51822.

I am sure that I don't understand something pretty obvious because I didn't find anything about that on that forum.

Is there someone to help me?

Should I modify MAX_NUM_MASTER_WHITE_LIST and MAX_BONDS_IN_FLASH constants to allow only one central in the whitelist?

Here is the code I am using to choose the advertising mode:


/**@brief Start advertising.
 */
void ble_kernel_advertising_start(void)
{
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;
    ble_gap_whitelist_t  whitelist;
    ble_gap_addr_t       peer_address;
    
    // Initialise advertising parameters (used when starting advertising)
    memset(&adv_params, 0, sizeof(adv_params));
    
    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;// Undirected advertisement
    adv_params.p_whitelist = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = APP_ADV_INTERVAL;
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_bondmngr_whitelist_get(&whitelist);
    APP_ERROR_CHECK(err_code);
                
    if (whitelist.irk_count != 0)                
    {
        adv_params.fp          = BLE_GAP_ADV_FP_FILTER_BOTH;
        adv_params.p_whitelist = &whitelist;
        advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    }
    else
    {
        advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
    }

    err_code = sd_ble_gap_adv_start(&adv_params);
    APP_ERROR_CHECK(err_code);    
}

Parents
  • for same issue, I set #define BLE_BONDMNGR_MAX_BONDED_CENTRALS 1 and follow same

    
    APP_ERROR_CHECK(ble_bondmngr_whitelist_get(&whitelist));
                if ((whitelist.addr_count != 0) || (whitelist.irk_count != 0)) {
                    adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
                    adv_params.p_whitelist = &whitelist;                
                    advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    
    

    but two of my android phone are able to connect to the nrf51822, and I am using sdk 5.2 and SD 6.0 release.

    anything I am missing here?

  • If you have bonded with one of your Android devices, and the device is added to the whitelist, there shouldn't be any such problems. However, if you have problems with this, can you please either post a question or a support case separately, making sure to include your complete code?

Reply
  • If you have bonded with one of your Android devices, and the device is added to the whitelist, there shouldn't be any such problems. However, if you have problems with this, can you please either post a question or a support case separately, making sure to include your complete code?

Children
No Data
Related