Skip to content
Snippets Groups Projects
Commit 950f52db authored by fxk8y's avatar fxk8y :spider:
Browse files

Adding copy and move API

parent af04fa8b
No related branches found
No related tags found
No related merge requests found
...@@ -1183,6 +1183,53 @@ namespace SiliconTorch { ...@@ -1183,6 +1183,53 @@ namespace SiliconTorch {
} }
bool NVSExplorer::copyKey(const str& nameSpace, const str& keyFrom, const str& keyTo) {
return false; // TODO: implementation!
}
bool NVSExplorer::copyKey(const str& nsFrom, const str& keyFrom, const str& nsTo, const str& keyTo) {
nvs_type_t entryType = getType(nsFrom, keyFrom);
if (entryType == NVS_TYPE_ANY) // key not found
return false;
if (entryType == NVS_TYPE_BLOB) // BLOBs are currently unsupported
return false;
u64 intStorage = 0;
str strStorage = "";
return false;
}
bool NVSExplorer::moveKey(const str& nameSpace, const str& keyFrom, const str& keyTo) {
if ( ! copyKey(nameSpace, keyFrom, keyTo) )
return false;
return removeKey(nameSpace, keyFrom);
}
bool NVSExplorer::moveKey(const str& nsFrom, const str& keyFrom, const str& nsTo, const str& keyTo) {
if ( ! copyKey(nsFrom, keyFrom, nsTo, keyTo) )
return false;
return removeKey(nsFrom, keyFrom);
}
str NVSExplorer::deviceTopic(const str& suffix) { str NVSExplorer::deviceTopic(const str& suffix) {
return str(DEVICE_NAMESPACE + "NVS/") + suffix; return str(DEVICE_NAMESPACE + "NVS/") + suffix;
} }
......
...@@ -87,6 +87,13 @@ namespace SiliconTorch { ...@@ -87,6 +87,13 @@ namespace SiliconTorch {
bool setString(const str& nameSpace, const str& key, const str& value); bool setString(const str& nameSpace, const str& key, const str& value);
/* TODO: implement! */ bool copyKey(const str& nameSpace, const str& keyFrom, const str& keyTo); // copies key inside namespace
/* TODO: implement! */ bool copyKey(const str& nsFrom, const str& keyFrom, const str& nsTo, const str& keyTo); // copies key to another namespace
/* TODO: test thoroughly! */ bool moveKey(const str& nameSpace, const str& keyFrom, const str& keyTo); // moves key inside namespace
/* TODO: test thoroughly! */ bool moveKey(const str& nsFrom, const str& keyFrom, const str& nsTo, const str& keyTo); // moves key to another namespace
str type2str(nvs_type_t typ); str type2str(nvs_type_t typ);
nvs_type_t getType(const str& nameSpace, const str& key); nvs_type_t getType(const str& nameSpace, const str& key);
str getTypeStr(const str& nameSpace, const str& key); str getTypeStr(const str& nameSpace, const str& key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment