Get BLE adress of a device that is already connected

bibianool
Posts: 2
Joined: Tue Dec 18, 2018 6:19 am

Get BLE adress of a device that is already connected

Postby bibianool » Wed Dec 19, 2018 8:54 am

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.


bibianool
Posts: 2
Joined: Tue Dec 18, 2018 6:19 am

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

Postby bibianool » Wed Dec 19, 2018 8:00 pm

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?

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

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

Postby chegewara » Fri Dec 21, 2018 1:23 am

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
	}
};

Who is online

Users browsing this forum: No registered users and 60 guests