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

how to add devices to whitelist??

hi, im trying to add devices to whitelist.is there any easy way to do it??

thankyou, Sougandh A.K

Parents
  • If it for peripheral you can use this (from ble_app_proximity)

         whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
         whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
         whitelist.pp_addrs   = p_whitelist_addr;
         whitelist.pp_irks    = p_whitelist_irk;
    
        err_code = dm_whitelist_create(&m_app_handle, &whitelist);
        APP_ERROR_CHECK(err_code);
    
        if ((whitelist.addr_count != 0) || (whitelist.irk_count != 0))
        {
            adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
            adv_params.p_whitelist = &whitelist;
    

    for central you can do this

    whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
    whitelist.irk_count  = 0;
    whitelist.pp_addrs   = p_whitelist_addr;
    whitelist.pp_irks    = p_whitelist_irk;
    
    // Request creating of whitelist.
    err_code = dm_whitelist_create(&m_dm_app_id,&whitelist);
    APP_ERROR_CHECK(err_code);
    
    m_scan_param.active       = 0;            // Active scanning set.
    m_scan_param.selective    = 1;            // Selective scanning not set.
    m_scan_param.interval     = SCAN_INTERVAL;// Scan interval.
    m_scan_param.window       = SCAN_WINDOW;  // Scan window.
    m_scan_param.p_whitelist  = &whitelist;   // Provide whitelist.
    m_scan_param.timeout      = 0x001E;       // 30 seconds timeout.
    
  • I assumed that the non-selecting scanning is done previously, sorry for not being clear on that.

Reply Children
No Data
Related