Skip to content

Commit

Permalink
[BREAKING] - Refactor NimBLEScan
Browse files Browse the repository at this point in the history
* General code cleanup
* `NimBLEScan::start` will no longer clear cache or results if scanning is already in progress.
* `NimBLEScan::clearResults` will now reset the vector capacity to 0.
* `NimBLEScan::stop` will no longer call the `onScanEnd` callback as the caller should know its been stopped when this is called.
* `NimBLEScan::clearDuplicateCache` has been removed as it was problematic and only for the esp32. Stop and start the scanner for the same effect.
* `NimBLEScan::start` takes a new bool parameter `restart`, default `true`, that will restart an already in progress scan and clear the duplicate filter so all devices will be discovered again.
* Scan response data that is received without advertisement first will now create the device and send a callback.
  • Loading branch information
h2zero committed Nov 21, 2024
1 parent b719a39 commit 9780d83
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 233 deletions.
10 changes: 1 addition & 9 deletions src/NimBLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,15 +723,7 @@ void NimBLEDevice::onReset(int reason) {

m_synced = false;

NIMBLE_LOGE(LOG_TAG, "Resetting state; reason=%d, %s", reason, NimBLEUtils::returnCodeToString(reason));

# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
if (m_initialized) {
if (m_pScan != nullptr) {
m_pScan->onHostReset();
}
}
# endif
NIMBLE_LOGE(LOG_TAG, "Host reset; reason=%d, %s", reason, NimBLEUtils::returnCodeToString(reason));
} // onReset

/**
Expand Down
Loading

0 comments on commit 9780d83

Please sign in to comment.