You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my situation I am only using ble to do setup, so after my device is set up I would like to be able to completely clean up the memory and move on. So it would be great if there was a method to clean up the singletons, or some way for me to delete.
I have found I can do most with client code, but the singleton objects are impossible to fix up without library changes.
Here is what I was thinking
void NimBLEDevice::cleanup() {
if(NimBLEDevice::m_pServer == nullptr) {
delete NimBLEDevice::m_pServer;
NimBLEDevice::m_pServer = nullptr;
}
if(NimBLEDevice::m_bleAdvertising== nullptr) {
delete NimBLEDevice::m_bleAdvertising;
NimBLEDevice::m_bleAdvertising= nullptr;
}
if(NimBLEDevice::m_pScan== nullptr) {
delete NimBLEDevice::m_pScan;
NimBLEDevice::m_pScan= nullptr;
}
for(auto it = m_cList.cbegin(); it != m_cList.cend(); ++it)
{
deleteClient(*it);
}
// Whatever other clean up needs to be done.
}
The text was updated successfully, but these errors were encountered:
That's a good idea, perhaps that code should just be added to NimBLEDevice::deinit() then you could make one call to completely stop all BLE functions. You can reinit after that if you need to as well.
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.
In my situation I am only using ble to do setup, so after my device is set up I would like to be able to completely clean up the memory and move on. So it would be great if there was a method to clean up the singletons, or some way for me to delete.
I have found I can do most with client code, but the singleton objects are impossible to fix up without library changes.
Here is what I was thinking
The text was updated successfully, but these errors were encountered: