Closed h2zero closed 6 days ago
NimBLEScan::stop will no longer call the onScanEnd callback as the caller should know its been stopped when this is called.
There are some spots where NimBLEScan::stop
is called internally, I think it would be good to still call the onScanEnd
callback in such cases. What about adding a parameter which defaults to false, else will call onScanEnd
?
I don't stop the scan explicitly before connecting as I liked how the NimBLE Async Client
handles it.
The reason for the change is so the application can make use of the callback to attempt to restart it. When connecting it will always be stopped first and that's about the only time that it is internally called other than when the app specifies to reset.
Hmm, now that I think about it, a reason code parameter should be added to the callback so the application can decide what to do from there.
I don't understand how can the application use the callback if it's never called? Do you mean the proper usage would be to always have the application stop the scan explicitly, and not use the convenience of the connect function?
The purpose of the callback is to let the application know when the scan stopped due to a timeout or error. The stack itself doesn't generate an event when the scan is stopped manually, likely for the same reason.
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 theonScanEnd
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 parameterrestart
, defaulttrue
, that will restart an already in progress scan and clear the duplicate filter so all devices will be discovered again.NimBLEAdvertisedDevice::isScannable()
that returns true if the device is scannable.NimBLEScanCallbacks
NimBLEScanCallbacks
function signatures updated:onDiscovered
now takes aconst NimBLEAdvertisedDevice*
onResult
now takes aconst NimBLEAdvertisedDevice*
onScanEnd
now takes aconst NimBLEScanResults&
andint reason
NimBLEScan::erase(const NimBLEAdvertisedDevice* device)
NimBLEScanResults::getDevice
methods now returnconst NimBLEAdvertisedDevice*
NimBLEScanResults
iterators are nowconst_iterator
Fixes #73