Page 1 of 1

Can't connect a BLE Client to a BLE Server when changing server name

Posted: Thu May 31, 2018 12:37 pm
by Anh-Minh
Hi,

I have some issues trying to connect a ESP32 Client to another ESP32 Server using BLE C++, with SampleClient and SampleServer :

With basic programs, when i run the application on both ESP32, it works well, and the Client can connect to the Server, and then, the server characteristic is written. For now, everything is normal.

The server is initialized with the following code :

Code: Select all

BLEDevice::init("ESP32")
BLEServer* pServer = BLEDevice::createServer();
...
Image

However, when i want to change my server name ( ESP322 in my example ) with :

Code: Select all

BLEDevice::init("New name")
When i run the application, the client can't find the server anymore. It detect the server, but the UUID is not recognize, consequently, the client cannot be initialized. Do you know where the problem is from ?

Image

Thank you.

Re: Can't connect a BLE Client to a BLE Server when changing server name

Posted: Thu May 31, 2018 4:44 pm
by chegewara
Its happening because advertising packet cant be longer than 31 bytes. When you are advertising 128 bit UUID there is not much space left for device name. With name up to 5 chars it works, but with longer it wont because UUID is no included in advertising due to packet limitations.

Re: Can't connect a BLE Client to a BLE Server when changing server name

Posted: Fri Jun 01, 2018 8:54 am
by Anh-Minh
Its happening because advertising packet cant be longer than 31 bytes. When you are advertising 128 bit UUID there is not much space left for device name. With name up to 5 chars it works, but with longer it wont because UUID is no included in advertising due to packet limitations.
Oh ok, i understand now. It is working fine now. Thank you ! Now, i have another problem which happens sometimes :
When the client has found the server and connects to it, sometimes, the program just freeze, until the ESP32 reboot.

Image

Image