forked from h2zero/esp-nimble-cpp
Fix endless loop when calling scan start from scan end callback.
When attempting to connect and the scanner is running `NimBLEScan::stop` is called to stop it which then calls the `onScanEnded` callback. If the app then starts the scan again in this callback an endless loop will be created. This change prevents the endless loop by setting a flag in `NimBLEDevice` that is checked before starting a scan while a client is trying to connect. * Adds `NimBLEDevice::setConnectionInProgress` and `NimBLEDevice::isConnectionInProgress` functions.
This commit is contained in:
1 parent
7d0636bc91
commit
724e1a7083
4 files changed
+37
-2
No files matched your search
@@ -183,6 +183,8 @@ class NimBLEDevice {
|
||||
static bool isBonded(const NimBLEAddress& address);
|
||||
static bool deleteAllBonds();
|
||||
static NimBLEAddress getBondedAddress(int index);
|
||||
static void setConnectionInProgress(bool inProgress);
|
||||
static bool isConnectionInProgress();
|
||||
# endif
|
||||
|
||||
private:
|
||||
@@ -194,6 +196,10 @@ class NimBLEDevice {
|
||||
static uint8_t m_ownAddrType;
|
||||
static std::vector<NimBLEAddress> m_whiteList;
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
static bool m_connectionInProgress;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
static NimBLEScan* m_pScan;
|
||||
# endif
|
||||
|
||||
Reference in new issue
Block a user