mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-07-30 18:37:13 +02:00
Only ignore scan discovery events when scan is stopped.
This commit is contained in:
@ -54,14 +54,14 @@ int NimBLEScan::handleGapEvent(ble_gap_event* event, void* arg) {
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
NimBLEScan* pScan = NimBLEDevice::getScan();
|
NimBLEScan* pScan = NimBLEDevice::getScan();
|
||||||
|
|
||||||
|
switch (event->type) {
|
||||||
|
case BLE_GAP_EVENT_EXT_DISC:
|
||||||
|
case BLE_GAP_EVENT_DISC: {
|
||||||
if (!pScan->isScanning()) {
|
if (!pScan->isScanning()) {
|
||||||
NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event");
|
NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event->type) {
|
|
||||||
case BLE_GAP_EVENT_EXT_DISC:
|
|
||||||
case BLE_GAP_EVENT_DISC: {
|
|
||||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||||
const auto& disc = event->ext_disc;
|
const auto& disc = event->ext_disc;
|
||||||
const bool isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK;
|
const bool isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK;
|
||||||
@ -488,11 +488,11 @@ void NimBLEScan::clearResults() {
|
|||||||
* @brief Dump the scan results to the log.
|
* @brief Dump the scan results to the log.
|
||||||
*/
|
*/
|
||||||
void NimBLEScanResults::dump() const {
|
void NimBLEScanResults::dump() const {
|
||||||
#if CONFIG_NIMBLE_CPP_LOG_LEVEL >=3
|
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3
|
||||||
for (const auto& dev : m_deviceVec) {
|
for (const auto& dev : m_deviceVec) {
|
||||||
NIMBLE_LOGI(LOG_TAG, "- %s", dev->toString().c_str());
|
NIMBLE_LOGI(LOG_TAG, "- %s", dev->toString().c_str());
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
} // dump
|
} // dump
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user