Page 1 of 1

BLE server and client coexistance

Posted: Sun Sep 08, 2019 2:42 pm
by fbeaulier
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

Re: BLE server and client coexistance

Posted: Tue Sep 10, 2019 11:38 am
by chegewara
Yes, it is possible.

Re: BLE server and client coexistance

Posted: Wed Sep 11, 2019 10:25 am
by fbeaulier
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

Re: BLE server and client coexistance

Posted: Wed Sep 11, 2019 10:42 am
by chegewara
Yes, you have to filter every event by gatt_if and conn_id.

Re: BLE server and client coexistance

Posted: Wed Sep 11, 2019 2:09 pm
by fbeaulier
ok thank you i will do that.