Comments (4)
This is the snippet of my code
if (remove_config) {
Serial.println(F("[Configuration] Removing Configuration"));
container->removeConfiguration(configuration);
configuration->setToBeRemoved();
configuration = NULL;
}
I added this snippet at the end of declareConfiguration
function and made remove_config = true
so that it will delete the configuration which I am defining.
But it's not getting removed. What is wrong here or is there any other simple way to remove the configuration?
from microocpp.
bool removeConfiguration(const char *key,const char *filename) {
std::shared_ptr<ConfigurationContainer> container = getContainer(filename);
if (!container) {
Serial.print(F("[Configuration] removeConfiguration: init new configurations container on flash filesystem: "));
Serial.println(filename);
if (!container->load()) {
Serial.print(F("[Configuration] Cannot load file contents.\n"));
}
}
std::shared_ptr<AbstractConfiguration> configuration = container->getConfiguration(key);
if (configuration ) {
if(DEBUG_OUT)
{
Serial.println(F("[Configuration] Removing configuration"));
Serial.println(key);
Serial.println("\n");
}
container->removeConfiguration(configuration);
configuration->setToBeRemoved();
configuration = NULL;
return true;
}
return false;
}
I added a new function to remove configuration and it's working perfectly fine.
from microocpp.
Why are we removing this configuration file?
from microocpp.
Once a configuration is declared, it is valid for the lifetime of the library. You can only control if to write the configuration back to the persistent memory with setToBeRemoved()
. If set, after the next reboot the information about the configuration will be gone and the configuration is finally deleted.
Thank you for your input @ChaitanyaYeole02 and @akashdk191. Flagging the object as removed did not invalidate the persistent memory. You probably observed that the remove operation was comitted too late.
And I introduced that the operation Change Configuration
removes (writeable) configurations if "value": ""
. Both changes are in 004b60b.
from microocpp.
Related Issues (20)
- Change WiFi interface for Ethernet HOT 1
- undefined reference to `setup()'
- How to implement/Use Authorization Cache HOT 1
- Support for binary data over websockets HOT 4
- BeginTransaction process with 2 connectors HOT 5
- addMeterValueInput Doesn't Work HOT 1
- Bug in void mocpp_initialize(const char *backendUrl,... HOT 4
- Issue with Inconsistent Responses for StopTransaction Requests HOT 3
- Meter values in ESP-IDF HOT 1
- Use of AuthorizeRemoteTxRequests Configuration Key HOT 2
- Error on Make - Invalid Initialization of Reference HOT 1
- Always Disconnected Problem
- Offline Behavior: Session Data Persistence HOT 4
- Saving the charging summary HOT 9
- Function to define the current limit of a EVSE HOT 4
- Commercially Available Options HOT 4
- FreeVending Mode for Two conectors Simultaneously HOT 3
- cppcheck fail (cppcheck --force src/MicroOcpp) HOT 4
- Charge profile limiting not working if current is set (tested with the simulator) HOT 1
- First StatusNotification 1970-01-01 timestamp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microocpp.