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

Parents
  • 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 ?

Reply
  • 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 ?

Children
  • As it seems you have found out, the hard fault occurs since you basically say "I want memory for a pointer to a whitelist struct", but use it as a full whitelist struct. Since it is a static global, it will be initialized to 0, and wen you then try to access fields within this struct, it will dereference 0, and then try to access that address. That may very well cause a hard fault, since you may easily end up outside of the memory of the chip.

Related