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

Custom whitelist while Scanning

Hi!

I'm trying to use a custom made whitelist with my scanning device, but no data is arriving. Is there something I need to do at the advertising devices? Here is the function that starts the scanning process:

static void scan_start(void) {
    ret_code_t err_code; 	 	

    /* WHITELIST SCANNING */ 	
    ble_gap_whitelist_t  whitelist; 	
    ble_gap_addr_t* 	 p_whitelist_addr[3]; 	
    ble_gap_addr_t       whitelist_sensor_1 	= {BLE_GAP_ADDR_TYPE_RANDOM_STATIC,{0xCE,0x1B,0x66,0x29,0xAE,0xEE}}; 	
    ble_gap_addr_t       whitelist_sensor_2 	= {BLE_GAP_ADDR_TYPE_RANDOM_STATIC,{0xDB,0xAC,0x83,0xC9,0x50,0x16}}; 	
    ble_gap_addr_t       whitelist_sync_beacon 	= {BLE_GAP_ADDR_TYPE_RANDOM_STATIC,{0xF9,0x3C,0xDC,0x2D,0xA9,0xA3}};    

    p_whitelist_addr[0] 	= &whitelist_sensor_1; 	
    p_whitelist_addr[1] 	= &whitelist_sensor_2; 	
    p_whitelist_addr[2] 	= &whitelist_sync_beacon;
    whitelist.addr_count 	= 3;
    whitelist.pp_addrs   	=  p_whitelist_addr;
    whitelist.pp_irks 		= NULL;
    whitelist.irk_count 	= 0;
	
    APP_ERROR_CHECK(err_code); 	 	
    ble_gap_scan_params_t m_scan_param_whitelist = 	{ 		
          SCAN_REQUEST, // 1 		
          SCAN_WHITELIST_ONLY, // 1 		
          &whitelist,
          (uint16_t)SCAN_INTERVAL, 		
          (uint16_t)SCAN_WINDOW,
          (uint16_t)SCAN_TIMEOUT
};


    err_code = sd_ble_gap_scan_stop();
    // It is okay to ignore this error since we are stopping the scan anyway.
    if (err_code != NRF_ERROR_INVALID_STATE)
    {
        APP_ERROR_CHECK(err_code);
    }

    err_code = sd_ble_gap_scan_start(&m_scan_param_whitelist);
    APP_ERROR_CHECK(err_code);

    LEDS_OFF(LEDS_MASK);
    LEDS_ON(BSP_LED_0_MASK); 
}

If I change the &whitelist param to NULL and SCAN_WHITELIST_ONLY to 0 it works fine! I have consulted this blogpost and looked at the ble_app_hrs_c example without luck.

Thanks!

Parents Reply Children
No Data
Related