Hello.
Using Bluedroid, is it possible for peripheral BLE device have multiple BLE instances, so I can connect the peripheral to multiple centrals. It doesn't need to connect centrals concurrently, just switching communication from one central to another is OK.
If possible, how can I implement that?
BLE Multiple Instances
-
MicroController
- Posts: 2669
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: BLE Multiple Instances
Should be straight forward:
When one central disconnects, you just start advertising again; then the same or a different central can (re-)connect to the peripheral.
When one central disconnects, you just start advertising again; then the same or a different central can (re-)connect to the peripheral.
Re: BLE Multiple Instances
Thanks for your fast reply.
This is actually the exact thing what I want, and this is the expected case when the central performs disconnection (and it works well). However, when I disconnect using esp_ble_gap_disconnect(), after starting advertising it reconnects automatically to the previously disconnected central. (I googled and found that it seems to be normal for hid ble peripherals)
So, the solution for my question is, to disconnect a central in "proper" way using esp_ble_gap_disconnect (or other functions), or start advertising in "proper" way. How should it be?
This is actually the exact thing what I want, and this is the expected case when the central performs disconnection (and it works well). However, when I disconnect using esp_ble_gap_disconnect(), after starting advertising it reconnects automatically to the previously disconnected central. (I googled and found that it seems to be normal for hid ble peripherals)
So, the solution for my question is, to disconnect a central in "proper" way using esp_ble_gap_disconnect (or other functions), or start advertising in "proper" way. How should it be?
-
MicroController
- Posts: 2669
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: BLE Multiple Instances
Note that it's the central which connects to the peripheral. The central can decide to immediately try and reconnect when the connection is closed; not much the peripheral can do about that.
Re: BLE Multiple Instances
I found a solution that will be the worst but works. I just saved multiple MAC address in NVS memory and load the target MAC address that will be used (before BLE init). Simply restarting and set another MAC address will switch the instance.
Who is online
Users browsing this forum: Applebot, Bing [Bot] and 2 guests