BLE multi-connection procedure
-
- Posts: 9
- Joined: Tue Dec 20, 2016 7:24 am
BLE multi-connection procedure
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,
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,
Re: BLE multi-connection procedure
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*
Re: BLE multi-connection procedure
I'm also interested in getting details on this. Something which hasn't been yet answered.
Re: BLE multi-connection procedure
Hi, multi-connection is not supported yet. some SW work need to be done before releasing this feature. plz kindly wait.
Re: BLE multi-connection procedure
When will it be available?
if multiple peripheral is already available then how to that? do you have any sample code?
if multiple peripheral is already available then how to that? do you have any sample code?
Re: BLE multi-connection procedure
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.
-
- Posts: 79
- Joined: Tue Apr 26, 2016 5:10 am
Re: BLE multi-connection procedure
A client connecting to multiple peripherals is available in the IDF at the moment.
Currently I use multiple profiles registered using the function.
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.
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.
Re: BLE multi-connection procedure
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.
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.
-
- Posts: 29
- Joined: Wed Aug 09, 2017 6:16 am
Re: BLE multi-connection procedure
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 2446 times
-
- gatts_demo.c.zip
- (5.79 KiB) Downloaded 1834 times
-
- Posts: 79
- Joined: Tue Apr 26, 2016 5:10 am
Re: BLE multi-connection procedure
Hi Weijian,
Thanks for the example. This confirms that what I have implemented is very close to what you have in the example!
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: Baidu [Spider] and 127 guests