BLE multi-connection procedure

TESTTHISONE
Posts: 9
Joined: Tue Dec 20, 2016 7:24 am

BLE multi-connection procedure

Postby TESTTHISONE » Thu Jan 12, 2017 9:21 am

Hello, ESP32 team.

I am implementing BLE multi-connection : one central(client) <-> many peripherals(server)
As far as I know, I have to have gatt clients for each gatt server. But it seems like each gatt client is overwriting and interfering the other gatt client in terms of callback functions and other significant variables such as gatt_if.

What is the recommended procedure for BLE multi-connection with ESP32?
Please specify the procedure in detail. If there is a sample code for reference, please provide me.

Your help is greatly appreciated :)

Regards,

Narmor
Posts: 3
Joined: Mon Feb 20, 2017 10:07 pm

Re: BLE multi-connection procedure

Postby Narmor » Wed Mar 08, 2017 7:21 pm

I have the sample problem. Has anyone found a Solution yet? I couldnt find anything in this forum, or the esp_idf or the BLE Documentation. *pushs topic*

romba89
Posts: 7
Joined: Thu Mar 02, 2017 12:12 pm

Re: BLE multi-connection procedure

Postby romba89 » Thu Mar 16, 2017 1:31 pm

I'm also interested in getting details on this. Something which hasn't been yet answered.

heyinling
Posts: 19
Joined: Thu Mar 23, 2017 7:21 am

Re: BLE multi-connection procedure

Postby heyinling » Sun Mar 26, 2017 3:24 pm

Hi, multi-connection is not supported yet. some SW work need to be done before releasing this feature. plz kindly wait.

san27deep
Posts: 11
Joined: Mon Jun 12, 2017 9:34 am

Re: BLE multi-connection procedure

Postby san27deep » Tue Jul 11, 2017 12:01 pm

When will it be available?
if multiple peripheral is already available then how to that? do you have any sample code?

kokonuts
Posts: 15
Joined: Tue Jul 11, 2017 6:39 pm

Re: BLE multi-connection procedure

Postby kokonuts » Fri Jul 14, 2017 7:25 pm

Same here, would really like to use ESP32 as ble-wifi gateway, so I need to connect to 10 ble peripheral sensors. Pretty basic IoT stuff. I hope esp-IoT dev framework will support this soon.

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: BLE multi-connection procedure

Postby Lucas.Hutchinson » Tue Jul 18, 2017 3:08 am

A client connecting to multiple peripherals is available in the IDF at the moment.

Currently I use multiple profiles registered using the function

Code: Select all

esp_ble_gattc_app_register
.
However you should be able to use only one profile and just refer to each device using it's own conn_id.

AS far as i am aware you will not be able to connect to 10 peripheral devices simultaneously.
In the menuconfig there is an option for max ACL connections (BLE connections). this has an allowable range of 1-7.
If you assign one of those for the peripheral side of your BLE hub, this would leave the ability to connect to 6 peripheral devices as a central.

heyinling
Posts: 19
Joined: Thu Mar 23, 2017 7:21 am

Re: BLE multi-connection procedure

Postby heyinling » Fri Jul 21, 2017 6:23 am

I've tried the following scenarios with GATT service discovery/read/write/notify/indicate:
1. 4 (default max conn allowed in menuconfig) ESP32 (master + GATTC) connected to ESP32 (slave + GATTS)
2. ESP32 (master + GATTC) connect to 4 ESP32 (slave + GATTS)
3. ESP32 (master + GATTC) connect to 2 ESP32 (slave + GATTS); ESP32 (slave + GATTS) connected by 2 ESP32 (master + GATTC)
and BTW I also tried 2 ESP32 connected and each both act as GATTS + GATTC.

All the GATT behaviors succeed, except some connection have a chance to get disconnected, especially transmitting data on all connections.

And some notes for the application code:
1. multi-connection for GATTS, only need to cache the correct conn_id for each connection.
2. for GATTC, use one app for all connections, do gatt_open with different addresses (as @Lucas.Hutchinson said).
3. if you create multiple apps, connection events will be dispatch to all apps. connection will only be closed if all apps call its close API.

Weijian-Espressif
Posts: 29
Joined: Wed Aug 09, 2017 6:16 am

Re: BLE multi-connection procedure

Postby Weijian-Espressif » Wed Aug 09, 2017 6:28 am

hi all, Please update to the latest idf, the attachment is the multi-connection code. we would add the multi-connection demo in the v3.0
Attachments
gattc_multi_connect.c.zip
(4.76 KiB) Downloaded 2444 times
gatts_demo.c.zip
(5.79 KiB) Downloaded 1830 times

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: BLE multi-connection procedure

Postby Lucas.Hutchinson » Wed Aug 09, 2017 10:02 pm

Hi Weijian,

Thanks for the example. This confirms that what I have implemented is very close to what you have in the example!

Who is online

Users browsing this forum: No registered users and 74 guests