Skip to content

Commit

Permalink
Updated to read node info from release 3.18.9 +
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed Sep 23, 2018
1 parent 914b974 commit 45ae57f
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,48 @@ void Node::readDataFromJSON(const std::string &json)
ssid = it->second.get_value<std::string>();
}
}

else if (key == "node_details")
{
for (boost::property_tree::ptree::const_iterator ndit = subtree.begin(); ndit != subtree.end(); ++ndit)
{
const std::string key(ndit->first);

if (key == "model") {
model = ndit->second.get_value<std::string>();
}
else if (key == "firmware_mfg") {
firmware_mfg = ndit->second.get_value<std::string>();
}
else if (key == "firmware_version") {
firmware_version = ndit->second.get_value<std::string>();
}
}
}
else if (key == "meshrf")
{
for (boost::property_tree::ptree::const_iterator mdit = subtree.begin(); mdit != subtree.end(); ++mdit)
{
const std::string key(mdit->first);
if (key == "channel") {
channel = mdit->second.get_value<int>();
}
else if (key == "chanbw") {
chanbw = mdit->second.get_value<double>();
}
else if (key == "ssid") {
ssid = mdit->second.get_value<std::string>();
}
}
}
else if (key == "sysinfo")
{
// Skip
}
else if (key == "tunnels")
{
// Skip
}
else if (key == "interfaces")
{
// Process the interfaces
Expand Down Expand Up @@ -271,6 +313,7 @@ void Node::readDataFromJSON(const std::string &json)
else
{
std::cerr << "Error parsing sysinfo.json output for " << name << std::endl;
std::cerr << " Key = " << key << std::endl;
}
}
}
Expand Down

0 comments on commit 45ae57f

Please sign in to comment.