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

How to map a gap event to a physical device?

What unique information can I use to know which physical device disconnected for example? Say I have a MAC address or a name encoded into the advertising packet. Correct me if I'm wrong, but connection handles are created after a connection is established. So how can I map a mac address or name to a connection handle?

Parents
  • Yes, in theory information like the peer address will be returned along with the connection handle in the connection event. Therefore, in theory I should know the peer address the connection handle is associated with. However, I have looked at the peer address, and the bytes of the address array are all zero which are non-random numbers.... The caveat is that I have only looked at the peer address in the disconnection event. It's possible that the peer address is non-zero in the connection event, but I can't confirm this because I am not in the office. I still find it odd that the peer address is all zero bytes in the disconnection event. I use the same function to print the peer address in the advertisement packet that I use to print the peer address in the disconnect event, so I am confident that my code for printing the peer address is correct.

Reply
  • Yes, in theory information like the peer address will be returned along with the connection handle in the connection event. Therefore, in theory I should know the peer address the connection handle is associated with. However, I have looked at the peer address, and the bytes of the address array are all zero which are non-random numbers.... The caveat is that I have only looked at the peer address in the disconnection event. It's possible that the peer address is non-zero in the connection event, but I can't confirm this because I am not in the office. I still find it odd that the peer address is all zero bytes in the disconnection event. I use the same function to print the peer address in the advertisement packet that I use to print the peer address in the disconnect event, so I am confident that my code for printing the peer address is correct.

Children
No Data
Related