Page 1 of 1

GATT Client - Multiple connection issue without scan

Posted: Wed May 15, 2019 9:58 am
by nisarg_sls
Dear Sir/Madam,

As per our requirement, the GATT Client + GAP Central device has to do multiple connections with different peer BLE peripheral devices without scanning.
So we did an experiment using BLE client application based on the requirement.
In an experiment, we sent multiple connection requests consequently for different peer BLE peer devices (whose address have been known) without scanning.
As a result, only first device, whose connection request has been sent in first order, could be connected. Other devices could not be connected. After some time, the connected device would be disconnected.

Following is the portion of client application where multiple connection requests has been sent after registering the app:
case ESP_GATTC_REG_EVT:
esp_ble_gattc_open(gl_profile_tab[PROFILE_APP_ID].gattc_if, peer_addr1, ble_addr_type, true);
vTaskDelay(10000/portTICK_PERIOD_MS);
esp_ble_gattc_open(gl_profile_tab[PROFILE_APP_ID].gattc_if, peer_addr2, ble_addr_type, true);
vTaskDelay(10000/portTICK_PERIOD_MS);
esp_ble_gattc_open(gl_profile_tab[PROFILE_APP_ID].gattc_if, peer_addr3, ble_addr_type, true);
break;

I have also attached a debug log on L2CAP layer for this issue.

If any further information will be required to help on this issue, kindly let us know.

Re: GATT Client - Multiple connection issue without scan

Posted: Wed May 15, 2019 3:01 pm
by chegewara
First of all you need to separately register app for every peer device you want to connect to. This will give you different gattc_if values for every successful registered app. From your code snippet we can see that you are trying to open connection to all peer devices with the same gattc_if:
gl_profile_tab[PROFILE_APP_ID].gattc_if
Here you can find reference code:
https://github.com/espressif/esp-idf/bl ... #L792-L821

Re: GATT Client - Multiple connection issue without scan

Posted: Sat May 18, 2019 7:35 am
by nisarg_sls
Thanks for the reply.

As per your suggestion, i have kept one client app for each new connection. So when client app receives registration event of each client app, connection request has been sent for new connection.

As a result, device, for which connection has been sent in first order, is connected with all client profiles. After sometime, connected device is automatically disconnected.

Kindly refer the attached source code and log for this experiment