2021-07-14 07:07 AM
My device is the slave, that is being connected (not always in the same order) by 2 masters.
I would like to create two different connection ways/points to distinguish between the masters.
MASTER1 will always connect through "way1."
MASTER 2 will always connect through "way2."
And I could map the connection handles according to the way they connected.
What could "way1" and "way2" be?
I was thinking about changing the MAC address/Name I am advertising periodically, by that creating 2 connection points.
First master will always connect through MAC1/NAME1.
Second master will always connect via MAC2/NAME2.
Is it possible? Could I know upon connection through what MAC#/NAME# they've connected?
Is there another way?
Thanks.
2021-07-21 04:40 AM
Each device you are connected with is identified by a connection handle.
This connection handle is returned in the connection_complete_event once the connection is established.
The peer device address is part of the connection_complete_event.
Its structure is the following:
typedef PACKED(struct)
{
uint8_t Status;
uint16_t Connection_Handle;
uint8_t Role;
uint8_t Peer_Address_Type;
uint8_t Peer_Address[6];
uint16_t Conn_Interval;
uint16_t Conn_Latency;
uint16_t Supervision_Timeout;
uint8_t Master_Clock_Accuracy;
} hci_le_connection_complete_event_rp0;
Then it is up to you to create your own structure associating the name of the device, its address and its connection handle.
2021-07-21 05:07 AM
Thanks.
Does hci_le_connection_complete_event_rp0 or some other packet hold the initial connection request of the master?
I want to know more on how the master is trying to connect.
e.g. Through which MAC address/NAME of device.
Or when a master reads/writes, where can I find the destination MAC address/NAME .
I looked at all the HCI events. ( https://lisha.ufsc.br/teaching/shi/ine5346-2003-1/work/bluetooth/hci_commands.html )
I saw that Connection_Request_Event might hold the data I need.
Can you tell me more on this event? I can't find it or its packet in code.