提交 d7b14c51 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 89213da3
{
"data":{
"PGMKJQSN":{
"8OK2ZDXP":{
"addr":"127.0.0.1",
"api-cloud":"http://127.0.0.1:8089",
"ipcs":[
......@@ -14,7 +14,7 @@
"iid":1,
"post":30,
"pre":3,
"sn":"PGMKJQSN",
"sn":"8OK2ZDXP",
"status":0,
"thresh":80,
"type":"motion"
......@@ -25,7 +25,7 @@
"addr":"127.0.0.1",
"iid":1,
"port-pub":5556,
"sn":"PGMKJQSN",
"sn":"8OK2ZDXP",
"status":0
}
],
......@@ -34,7 +34,7 @@
"enabled":1,
"iid":1,
"password":"",
"sn":"PGMKJQSN",
"sn":"8OK2ZDXP",
"status":0,
"token":"",
"urlDest":"rtsp://40.73.41.176:554/test1",
......@@ -46,7 +46,7 @@
"enabled":1,
"iid":1,
"path":"slices",
"sn":"PGMKJQSN",
"sn":"8OK2ZDXP",
"status":0
}
]
......@@ -62,7 +62,7 @@
"port-cloud":5556,
"port-router":5550,
"proto":"zmq",
"sn":"PGMKJQSN",
"sn":"8OK2ZDXP",
"status":1
}
},
......
......@@ -404,10 +404,7 @@ togo_end:
// config
int _validateConfig(const json &config) {
if(config.count("data") == 0|| config["data"].size() == 0) {
spdlog::error("invliad config: {}", config.dump(4));
return -1;
}
//TODO:
return 0;
}
......@@ -421,19 +418,11 @@ togo_end:
};
int setLocalConfig(json &config, string key, string fileName){
if(config.count("data") == 0) {
spdlog::error("setLocalConfig no data field");
return -1;
}
json j;
j["lastupdated"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
j["data"] = config["data"];
if(key.empty()) {
return setValue(j, LVDB_KEY_CONFIG, fileName, _validateConfig);
return setValue(config, LVDB_KEY_CONFIG, fileName, _validateConfig);
}else{
return setValue(j, key, fileName, _validateConfig);
return setValue(config, key, fileName, _validateConfig);
}
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论