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

refactor communitation archtecture to use evdamon only

上级 bce9f55b
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"files.associations": { "files.associations": {
"chrono": "cpp", "chrono": "cpp",
"optional": "cpp", "optional": "cpp",
"string": "cpp" "string": "cpp",
"set": "cpp"
}, },
"C_Cpp.errorSquiggles": "Disabled" "C_Cpp.errorSquiggles": "Disabled"
} }
\ No newline at end of file
...@@ -391,22 +391,22 @@ togo_end: ...@@ -391,22 +391,22 @@ togo_end:
spdlog::error("failed to save new generated sn"); spdlog::error("failed to save new generated sn");
exit(1); exit(1);
}else{ }else{
// replace sn // // replace sn
size_t idx = 0; // size_t idx = 0;
for(auto &j:_sn_tmpl) { // for(auto &j:_sn_tmpl) {
idx = 0; // idx = 0;
while(true) { // while(true) {
idx = _config_default_tmpl.find(j, idx); // idx = _config_default_tmpl.find(j, idx);
if(idx == string::npos) break; // if(idx == string::npos) break;
_config_default_tmpl.replace(idx, j.size(), sn); // _config_default_tmpl.replace(idx, j.size(), sn);
idx+=sn.size(); // idx+=sn.size();
} // }
} // }
// replace camera addr, user, password, cloud-addr // // replace camera addr, user, password, cloud-addr
spdlog::debug("new config: {}", _config_default_tmpl); // spdlog::debug("new config: {}", _config_default_tmpl);
json j = json::parse(_config_default_tmpl); // json j = json::parse(_config_default_tmpl);
return setLocalConfig(j); // return setLocalConfig(j);
} }
} }
...@@ -418,26 +418,6 @@ togo_end: ...@@ -418,26 +418,6 @@ togo_end:
return setValue(info, LVDB_KEY_SN, fileName, _validateSn); return setValue(info, LVDB_KEY_SN, fileName, _validateSn);
}; };
// int setSn(json &info) {
// std::ifstream i("file.json");
// json j;
// i >> j;
// // write prettified JSON to another file
// std::ofstream o("pretty.json");
// o << std::setw(4) << j << std::endl;
// return -1;
// }
// int getSn(json &info) {
// fstream file;
// file.open(LVDB_KEY_SN, ios::out|ios);
// if(snfile.e)
// json j;
// i >> j;
// // write prettified JSON to another file
// std::ofstream o("pretty.json");
// o << std::setw(4) << j << std::endl;
// }
// config // config
int _validateConfig(const json &config) { int _validateConfig(const json &config) {
if(config.count("data") == 0|| config["data"].size() == 0) { if(config.count("data") == 0|| config["data"].size() == 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论