FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-28-2021 07:31 AM
Hello together,
how is it possible to create a non-volatile variable to the datalayer? The value of the variable shouldn't be deleted, if the ctrlX Core is rebooted.
Greetings
Yannic
Solved! Go to Solution.
06-28-2021 02:35 PM - edited 06-29-2021 10:37 AM
EDIT:
PLC:
Use a persistant variable list:
Own App:
You can create shared_retain data that will be stored in a non volatile area. These will keep their value through reboot.
std::shared_ptr<comm::datalayer::IMemoryOwner> sharedRetain;
result = datalayer.factory()->createMemorySync(sharedRetain, "example/rt/sharedRetain", provider, MEM_SIZE, comm::datalayer::MemoryType_SharedRetain);
if (comm::datalayer::STATUS_FAILED(result))
std::cout << "creation of shared retain failed with: " << result.toString() << std::endl;
result = sharedRetain->setMemoryMap(memMap);
if (comm::datalayer::STATUS_FAILED(result))
std::cout << "Set shared retain memMap failed with: " << result.toString() << std::endl;