This is probably really simple, but I have sure struggled.
esp32 BT things.
scenario:
a lot of BT devices with same name, different locations.
since I know the name, I connect via name - this works fine, just takes awhile. (if I hand enter the mac, connection is immediate).
sometimes, Im connecting to the same device consecutively and would like to mitigate the 20-30 seconds associated with connecting.
connection method:
delay(1);
BTconnected = SerialBT.connect(slaveName);
what I would like to be able to do:
once connected, it would be nice to capture the remote mac address in a variable post connection.
(i will simply save to EEPROM and then call this address on boot up - if it fails to connect via mac(because im now at a different location), then program will call connect via name again - you get the idea. simple - makes sense.
I cant seem to figure out how to capture the remote address - there has to be a way post connection.
from the BluetoothSerial.h library:
bool connect(String remoteName);
bool connect(uint8_t remoteAddress[], int channel=0, esp_spp_sec_t sec_mask=(ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE), esp_spp_role_t role=ESP_SPP_ROLE_MASTER);
bool connect(const BTAddress &remoteAddress, int channel=0, esp_spp_sec_t sec_mask=(ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE), esp_spp_role_t role=ESP_SPP_ROLE_MASTER) {
return connect(*remoteAddress.getNative(), channel, sec_mask); };
stands to reason I could capture the remote address? - nothing I have done thus far works.
there are a few examples out there, BUT they are for grabbing the mac of the device instigating the connection on the BT advertising side's code.
in this case, I need to capture the advertising BT's address post connection.
(yes I could scan and connect, but that has its own pitfalls that I wont get into - for the sake of this project, thats bad methodology I have found. again I'll save you all the lengthy reasons as to why)
any help is appreciated!