Page 1 of 1

Get BLE adress of a device that is already connected

Posted: Wed Dec 19, 2018 8:54 am
by bibianool
Hi world.

My question is how I get the adress of my device if this is connected to my ESP 32 , my ESP 32 is working like a server and my phone is a client, when you do a sacan you get the adress of the BLE devices around of the ESP 32, I want to get this adress and then when my device was disconnected try to find it to activate a led.

Re: Get BLE adress of a device that is already connected

Posted: Wed Dec 19, 2018 1:30 pm
by chegewara

Re: Get BLE adress of a device that is already connected

Posted: Wed Dec 19, 2018 8:00 pm
by bibianool
Thank you, another question, if I want to do this but I’m programming with Arduino IDE using the ESP32 libraries, how I can do it using this?

Re: Get BLE adress of a device that is already connected

Posted: Fri Dec 21, 2018 1:23 am
by chegewara
Sorry, i missed that you are asking about arduino.
If you are using BLE library from arduino-esp32 latest version then you can make it very easy:

Code: Select all

class MyCallbacks : public BLEServerCallbacks{
	void onConnect(BLEServer *pServer, esp_ble_gatts_cb_param_t *param)
	{
		param->connect.remote_bda; // <-- its your address
	}
};