提交 962b89d1 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 73c9b26a
...@@ -204,13 +204,14 @@ class EvDaemon{ ...@@ -204,13 +204,14 @@ class EvDaemon{
return 2; return 2;
} }
json *cfg = cfgutils::findModuleConfig(peerId, jret["data"]); json *cfg = cfgutils::findModuleConfig(peerId, jret["data"]);
json diff = json::diff(this->config, jret["data"]);
// TODO:
spdlog::info("evdaemon {} config diff: {}", devSn, diff.dump(4));
if(cfg == NULL) { if(cfg == NULL) {
spdlog::error("evdaemon failed to find module {} in config {}", peerId, jret["data"].dump()); spdlog::error("evdaemon failed to find module {} in config {}", peerId, jret["data"].dump());
return 1; return 1;
} }
json diff = json::diff(this->config, jret["data"]);
// TODO:
spdlog::info("evdaemon {} config diff: {}", devSn, diff.dump(4));
peerData["config"][peerId] = *cfg; peerData["config"][peerId] = *cfg;
peerData["status"][peerId] = 0; peerData["status"][peerId] = 0;
......
...@@ -177,22 +177,29 @@ namespace cfgutils { ...@@ -177,22 +177,29 @@ namespace cfgutils {
for(auto &ipc: ipcs) { for(auto &ipc: ipcs) {
json &modules = ipc["modules"]; json &modules = ipc["modules"];
for(auto &[mn, ml]: modules.items()) { // not evml
for(auto &m: ml) { if(subMn.empty()) {
if(mn == "evml" && !subMn.empty()){ if(modules.count(modName) != 0) {
if(subMn == m["type"] && m[iid] == iid && m["sn"] == sn && m["enabled"] != 0) { json &ml = modules[modName];
for(auto &m : ml) {
if(m["sn"] == sn && m["iid"] == iid && m["enabled"] != 0) {
ret = &v; ret = &v;
break; break;
} }
}else if(subMn.empty()){ }
if(mn == modName && m["sn"] == sn && m["iid"] == iid && m["enabled"] != 0) { }
}else{
if(modules.count("evml") != 0) {
json &ml = modules["evml"];
for(auto &m: ml) {
if(subMn == m["type"] && m[iid] == iid && m["sn"] == sn && m["enabled"] != 0) {
ret = &v; ret = &v;
break; break;
} }
} }
} }
if(ret != NULL) break;
} }
if(ret != NULL) break; if(ret != NULL) break;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论