refactor(cpn): Support JSON radio hardware definitions (#4406)

This commit is contained in:
Neil Horne
2024-02-04 15:59:04 +10:00
committed by GitHub
parent c6ae44f523
commit 83294613f6
63 changed files with 4166 additions and 2295 deletions
@@ -116,7 +116,7 @@ Node convert<LogicalSwitchData>::encode(const LogicalSwitchData& rhs)
node["delay"] = rhs.delay;
node["duration"] = rhs.duration;
node["andsw"] = YamlRawSwitchEncode(RawSwitch(rhs.andsw));
return node;
}
@@ -161,6 +161,11 @@ bool convert<LogicalSwitchData>::decode(const Node& node,
case LS_FAMILY_VCOMP: {
std::string src_str;
getline(def, src_str, ',');
if (def_str.size() >= 4 && def_str.substr(0, 4) == "lua(") {
std::string tmp_str;
getline(def, tmp_str, ',');
src_str += ("," + tmp_str);
}
rhs.val1 = YamlRawSourceDecode(src_str).toValue();
getline(def, src_str);
rhs.val2 = YamlRawSourceDecode(src_str).toValue();
@@ -178,6 +183,11 @@ bool convert<LogicalSwitchData>::decode(const Node& node,
default: {
std::string src_str;
getline(def, src_str, ',');
if (def_str.size() >= 4 && def_str.substr(0, 4) == "lua(") {
std::string tmp_str;
getline(def, tmp_str, ',');
src_str += ("," + tmp_str);
}
rhs.val1 = YamlRawSourceDecode(src_str).toValue();
def >> rhs.val2;
} break;