BLE server and client coexistance

fbeaulier
Posts: 10
Joined: Wed Oct 31, 2018 10:08 am

BLE server and client coexistance

Postby fbeaulier » Sun Sep 08, 2019 2:42 pm

Hello,

We would like to setup a BLE server and client, both working together at the same time.
There is no example of that in esp-idv v3.3.
Can anyone enlight me and tell me if it is possible ?
Thanks for any help !

Francois

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

Re: BLE server and client coexistance

Postby chegewara » Tue Sep 10, 2019 11:38 am

Yes, it is possible.

fbeaulier
Posts: 10
Joined: Wed Oct 31, 2018 10:08 am

Re: BLE server and client coexistance

Postby fbeaulier » Wed Sep 11, 2019 10:25 am

Thanks chegewara for the answer,

When i compared the code of the two examples gatt_server and gatt_client i found that it looks easy to mix the two of them.
So i did it, the server started ok, then i started the client with a scan, found my device but strangely when i connect to the device with a call to esp_ble_gattc_open() i get a ESP_GATTS_CONNECT_EVT in the function gatts_profile_event_handler(), meaning my own server got a connection ???
But after that the client and server seems to both work ok, only the server has a kind of "ghost" connexion.

Any idea why is that ? may be i can just filter this self connexion and everything is just fine ?

Kind regards
François

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

Re: BLE server and client coexistance

Postby chegewara » Wed Sep 11, 2019 10:42 am

Yes, you have to filter every event by gatt_if and conn_id.

fbeaulier
Posts: 10
Joined: Wed Oct 31, 2018 10:08 am

Re: BLE server and client coexistance

Postby fbeaulier » Wed Sep 11, 2019 2:09 pm

ok thank you i will do that.

Who is online

Users browsing this forum: Baidu [Spider], dracoins and 138 guests