What does BLEServer connect() do, exactly?

akolodner25
Posts: 27
Joined: Tue Nov 22, 2022 5:15 am

What does BLEServer connect() do, exactly?

Postby akolodner25 » Tue Apr 18, 2023 9:11 pm

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

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

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

Postby lbernstone » Tue Apr 18, 2023 10:24 pm

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"

akolodner25
Posts: 27
Joined: Tue Nov 22, 2022 5:15 am

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

Postby akolodner25 » Wed Apr 19, 2023 12:44 am

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.

Who is online

Users browsing this forum: No registered users and 59 guests