GATT Client - Multiple connection issue without scan

nisarg_sls
Posts: 10
Joined: Wed Jan 02, 2019 8:40 am

GATT Client - Multiple connection issue without scan

Postby nisarg_sls » Wed May 15, 2019 9:58 am

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.
Attachments
debug_multi_conn_log.txt
Debug Log
(13.75 KiB) Downloaded 128 times
Regards,
Nisarg Shah

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

Re: GATT Client - Multiple connection issue without scan

Postby chegewara » Wed May 15, 2019 3:01 pm

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

nisarg_sls
Posts: 10
Joined: Wed Jan 02, 2019 8:40 am

Re: GATT Client - Multiple connection issue without scan

Postby nisarg_sls » Sat May 18, 2019 7:35 am

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
Attachments
spp_client_demo.c
(10.7 KiB) Downloaded 119 times
Multiconnect_Issue_Without_Scan.txt
(3.69 KiB) Downloaded 105 times
Regards,
Nisarg Shah

Who is online

Users browsing this forum: Google [Bot] and 23 guests