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

White-list without bond manager

Hi

Is possible to use GAP White-list to restrict connections without the bond manager system ? Just by save the white-list with pstorage.....

for exemple, first open connection: retrieve peer caracteristics with ble_gap_evt_connected_t https://devzone.nordicsemi.com/documentation/nrf51/5.2.0/html/a00225.html

and save them in whitelist... https://devzone.nordicsemi.com/documentation/nrf51/5.2.0/html/a00247.html

  • Yes, this should be perfectly doable. You can store the address you get in the connected event somewhere in flash, for instance using the pstorage module, and then create a whitelist structure yourself when you want to start advertising again.

  • Hi,

    A part of my code to achieve this :

    i've declared a whitelist in global :

    static ble_gap_whitelist_t *whitelist;					
    static ble_gap_addr_t	*addr_array[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
    

    In my advertising initialization i want to initialize my whitelist without any pair so i do that ( when the device started the first time) :

    whitelist->addr_count = 0x00;
    whitelist->pp_addrs = NULL;
    

    second line cause an hardfault and i don't know wy ... Any idea ? It's possible to advertise with an empty whitelist ?

  • I've changed declaration ( i declared a ble_gap_whitelist_t directly, not a pointer) The Hardfault doesn't occur.

    But now, my sd_ble_gap_adv_start function return me the NRF_ERROR_INVALID_PARAM code. So i verified adv_params but i don't find anything..

    Do i forgot something ?

    static ble_gap_whitelist_t whitelist;					
    
    
    whitelist.addr_count = 0x00;
    whitelist.pp_addrs = NULL;
    
    static void advertising_start(void)
    {
        uint32_t             err_code;
        ble_gap_adv_params_t adv_params;
    
    		protection_mode = true;
    		connection_state = false;
    	
        // Start advertising
        memset(&adv_params, 0, sizeof(adv_params));
        
        dv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND; //adv
        adv_params.p_peer_addr = NULL;
        adv_params.fp          = BLE_GAP_ADV_FP_FILTER_BOTH; // both with whitelist //
        adv_params.interval    = APP_ADV_INTERVAL;
        adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
    		adv_params.p_whitelist = &whitelist;
    
        err_code = sd_ble_gap_adv_start(&adv_params);
        APP_ERROR_CHECK(err_code);
     
    }
    
  • I think i don't build my white-list structure correctly.irk keys adds problems. In all examples, whitelist come from the bond manager.

    How to correctly generate a whitelist ? Is possible to use bond manager get whitelist function without the bond operation ?

  • Unless there is other code you're not showing, this will give you a 0x07 back from sd_ble_gap_adv_start(). The reason is that starting advertising with a filter policy, but an empty whitelist doesn't really make sense. You should therefore make sure to check whether your whitelist actually have any content before you try using a filter policy.

Related