Closed
Description
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.
}
Metadata
Metadata
Assignees
Labels
No labels