cancel
Showing results for 
Search instead for 
Did you mean: 

How can I know if resolved address type will be random static or public?

DS.4
Senior II

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!

3 REPLIES 3
DS.4
Senior II

Looking a bit deeper into it: 

  • You can't assume the peer address type from connection complete event data! 
  • E.g, peer can be something different than what you get on connection!
  • Bonding will disclose the true peer address type, bonding list will resolve a private address and etc..
  • (That is why) And most important ! DO NOT USE the address type you got on connection for the bonding list commands.

 

Some scenarios :

 

  • Case 1  - Peer connection parameters own address : random , and being random private.

Peripheral connection event address type 1(random),  after bonding changes to 0 ( public) , as it is resolved.

 

  • Case 2 - Peer connection parameters - own address : public , and being random static.

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!

 

 

 

 

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.

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.