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 authored and GitHub committed 2020-07-28 20:57:33 -06:00
1 parent b2df8384b3
commit abdf6cda35
6 files changed
+61 -5

No files matched your search

+1 -1
View File
@@ -91,7 +91,7 @@ extern "C" void ble_store_config_init(void);
class NimBLEDevice {
public:
static void init(const std::string &deviceName);
static void deinit();
static void deinit(bool clearAll = false);
static bool getInitialized();
static NimBLEAddress getAddress();
static std::string toString();