Add clearAll parameter to deinit() (#22)

* Add clearAll parameter to deinit()

Adds the ability to clear all resources consumed during BLE operation when deinitializing and shutting down BLE.
Useful when BLE is used intermittently or in a task that initializes, performs operations then deinitializes.

By setting the clearAll parameter to true all created BLE objects will be deleted, freeing the memory for other tasks.

Warning: This will invalidate any pointers that may be referencing the deleted objects.

* Add bool deleteCallbacks parameter to NimBLEServer::setCallbacks, if true (default) will delete the callback class when server is destructed.

* Delete scan results when scan is destructed.
This commit is contained in:
h2zero
2020-07-28 20:57:33 -06:00
committed by GitHub
parent b2df8384b3
commit abdf6cda35
6 changed files with 61 additions and 5 deletions
+7
View File
@@ -44,6 +44,13 @@ NimBLEScan::NimBLEScan() {
}
/**
* @brief Scan destructor, release any allocated resources.
*/
NimBLEScan::~NimBLEScan() {
clearResults();
}
/**
* @brief Handle GAP events related to scans.
* @param [in] event The event type for this event.