cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the active bond list entry from stack?

DS.4
Senior II

I need to add a method to the on pairing event  that will return the active bond list entry.

 

In case of rebond -> the correct entry that is used ( not the last )

 

Thanks

4 REPLIES 4
EPASZ.1
ST Employee

You can check the bonding table using the command like this (replace the [2] with the maximum number of entries you have the memory configured for / expect to get):

uint8_t Num_of_Addresses;
Bonded_Device_Entry_t Bonded_Device_Entry[2];
tBleStatus ret = aci_gap_get_bonded_devices(&Num_of_Addresses, &Bonded_Device_Entry);

I'm not 100% sure what you mean by 'active entry' - the stack does not handle deletion of entries by itself and so all the entries are valid until you delete them. The stack only overwrites older entries when it runs out of the allocated memory.

When rebonding, the entry should still be the same as the original as the address shouldn't change. If it changes, then it is considered to be a new device.

got rebonded - no new entry was added,

now connected and paired,  which bonding entry was used for that ? the "active" one?

I got a long list of bonded devices.. can you tell me how I find the one being used?

Using the connection info might help, but is sounds like a solution that can go wrong!

I am already rebonded , and looking for active bonding key used for security.

 

Support on this one from you will help!

 

A solution(?) :

For private:  trying to resolve the connection address, than looking it in the bonding list, if it fails, move to next type.

For static random: I can search the bond list for that exact address, with type random . if failed move to next type

For public: again , try to look for that address in the bonding, but this time with type public. if failed move to next type

Is there another possibility? 

EPASZ.1
ST Employee

I think I see what you want to achieve. I'd suggest taking a look here https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32WB-WBA_BLE_Privacy#First_example-_connection_between_a_smartphone_and_a_STM32WB-WBA.

You might succeed by using the event HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT.

EPASZ1_2-1719229586495.png

If you already have the device bonded, this should provide both the resolvable address and the resolved one (if you have the bonding info stored, of course). To register this event, you can put this e.g. at the end of BLE init

hci_set_le_event_mask(0xC7FFF7F85F | 0x200);

 

EPASZ1_1-1719229534053.png