BLE Central: Can't connect to peripheral while scanning.

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

BLE Central: Can't connect to peripheral while scanning.

Postby Lucas.Hutchinson » Sun Jul 09, 2017 11:43 pm

Hi All,

In my application I am developing the ESP32 so that as a ble central it can connect to multiple peripherals.
Ideally the app would be able to scan for devices and connect to them as the app discovers them, without stopping the scan.

However I have come across an issue where the app wont connect while scanning.
The app is performing a BLE scan.
The app then tries to connect to a discovered peripheral, while still scanning. The ESP_GATTC_OPEN_EVT returns either "ESP_GATT_ERROR" or "ESP_GATT_BUSY".

If the app stops scanning, then tries to connect, the ESP_GATTC_OPEN_EVT returns with "ESP_GATT_OK"

Please let me know if any more information is needed.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: BLE Central: Can't connect to peripheral while scanning.

Postby kolban » Mon Jul 10, 2017 3:09 am

Note, I am NOT saying what you are trying to do is wrong ... I don't know.

A question however, if you execute a scan, find a target peer device you want to connect against, stop scanning, connect and then start scanning for the next one ... does that work?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: BLE Central: Can't connect to peripheral while scanning.

Postby Lucas.Hutchinson » Mon Jul 10, 2017 4:04 am

Hi @Kolban,

Thanks for your response, this is what i am doing currently.
It does work, however it forces delays with interaction with the ESP32, which is not ideal.

However sometimes it can take a while for the Bluetooth connection to connect successfully.
In these cases the application has to wait around until this connection is successful before the scanning can be re-started.

It's not a deal breaker, but would be good if there was some way for this to happen to make interacting with Bluetooth on the ESP32 feel a bit snappier.

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

Re: BLE Central: Can't connect to peripheral while scanning.

Postby Lucas.Hutchinson » Sun Jul 16, 2017 9:40 pm

Just checking if anyone has any more idea about why this doesnt work properly?

@WiFive @ESP_Angus or anyone else from espressif, Is this a known issue?

aidan.cyr
Posts: 2
Joined: Wed Jun 26, 2019 7:23 am

Re: BLE Central: Can't connect to peripheral while scanning.

Postby aidan.cyr » Wed Jun 26, 2019 7:25 am

Hi,

I too am wondering if this is possible or in the works for esp-idf?
It’s not a deal-breaker, would just be good to know if this will ever be possible ?
Is anyone from Espressif able to let us know ?

Thanks.

Who is online

Users browsing this forum: No registered users and 12 guests