Skip to content

Commit 0172cb4

Browse files
committed
Only ignore scan discovery events when scan is stopped.
1 parent 856adeb commit 0172cb4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/NimBLEScan.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ int NimBLEScan::handleGapEvent(ble_gap_event* event, void* arg) {
5454
(void)arg;
5555
NimBLEScan* pScan = NimBLEDevice::getScan();
5656

57-
if (!pScan->isScanning()) {
58-
NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event");
59-
return 0;
60-
}
61-
6257
switch (event->type) {
6358
case BLE_GAP_EVENT_EXT_DISC:
6459
case BLE_GAP_EVENT_DISC: {
60+
if (!pScan->isScanning()) {
61+
NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event");
62+
return 0;
63+
}
64+
6565
# if CONFIG_BT_NIMBLE_EXT_ADV
6666
const auto& disc = event->ext_disc;
6767
const bool isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK;
@@ -488,11 +488,11 @@ void NimBLEScan::clearResults() {
488488
* @brief Dump the scan results to the log.
489489
*/
490490
void NimBLEScanResults::dump() const {
491-
#if CONFIG_NIMBLE_CPP_LOG_LEVEL >=3
491+
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3
492492
for (const auto& dev : m_deviceVec) {
493493
NIMBLE_LOGI(LOG_TAG, "- %s", dev->toString().c_str());
494494
}
495-
#endif
495+
# endif
496496
} // dump
497497

498498
/**

0 commit comments

Comments
 (0)