Page 1 of 1

What does BLEServer connect() do, exactly?

Posted: Tue Apr 18, 2023 9:11 pm
by akolodner25
In the course of trying to figure out why terminating BLEClient connections also disconnects BLEServer connections, I found that BLEServer has a connect() method just like BLEClient. I managed to call it on a BLEAdvertisedDevice, but nothing really happened. What is it supposed to do? It seems like it forcibly connects the client to the server? But why would that be desirable?

Source: https://github.com/espressif/arduino-es ... LEServer.h

Re: What does BLEServer connect() do, exactly?

Posted: Tue Apr 18, 2023 10:24 pm
by lbernstone
If the peer (the client in the case of BLEServer) is advertising a service, connect to it. The note in the code (https://github.com/espressif/arduino-es ... #L334-L335) says "Allow to connect GATT server to peer device. Probably can be used in ANCS for iPhone"

Re: What does BLEServer connect() do, exactly?

Posted: Wed Apr 19, 2023 12:44 am
by akolodner25
Forgive my inexperience, but I thought services only existed on the server side? Does this mean that the client device has to be dual-mode BLE (like the ESP32 is)? There's no way in BLEClient.h to create a service AFAIK.