2024-06-17 02:05 AM - edited 2024-06-17 02:06 AM
This is regarding these two posts:
https://community.st.com/t5/stm32-mcus-wireless/ble-how-can-i-know-upon-getting-connection-event-if-device-was/m-p/681086#M19378 Answered by @Alan PORTE
https://community.st.com/t5/stm32-mcus-wireless/different-event-upon-connection/m-p/223224 ( not answered)
Big confusion here regarding the term 'random' used in all documentation.
Upon connection , it gives either random(?) or public.
Not clear here, Is it random-static? or random-private?
A client connecting to me, that is : private resolvable, and uses public address : will get me a type (1) random(?) ., on connection.
Later, on bonding , the type will change to 0 ( public), for the resolved address.
The issue with types comes to mind when using the _BOND_ commands that require a type.
When supplying the command with a resolved address, I have no way to know what type it has.
It seems from this small example , that the random during connection is random-private-resolvable
and the random type in the bonding list, is random-static. but again, I am not sure!
What gets me to these questions:
How can I know if the resolved address type will be random(?) or public?
I am looking for an easier way, than resolving the address by myself, reading the entire bond list, looking for that address and getting its type.. few I got tired just writing it...
Thanks!
2024-06-17 06:17 AM - edited 2024-06-17 07:41 AM
Looking a bit deeper into it:
Some scenarios :
Peripheral connection event address type 1(random), after bonding changes to 0 ( public) , as it is resolved.
Peripheral connection event address type 0, after bonding type changes to 1 (random)
It would be great to have a function that "translates" the connection received address and type to the address and type in the bonding list.
But that is probably not in ble specification ...so need to be done in the long tedious way..nevertheless hope it does help someone!
2024-06-28 12:46 AM
Hello @DS.4
Thank you for this proposition. I've escalated to the concerned team to study the possibility to implement it (in an internal ticket number 185271).
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-12 07:58 AM
Hello @DS.4
The peer address type return in connection complete event can be public or random. The random type includes the static random and the resolvable private address type.
To check if the device is already bonded, you can use the aci_gap_is_device_bonded command with the address type returned in the connection complete event. If the address is a resolvable private address, the BLE Host stack will resolve the address and check if it's in the bonded list or not.
There is a mistake in the documentation, the first parameter is the address type and not the identity address type, it will be corrected.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.