corrected uniqueness of json keys, added write as option to json get

This commit is contained in:
john30
2017-05-25 12:54:09 +02:00
parent dbe70f0126
commit d36315ae35
3 changed files with 34 additions and 9 deletions
+12 -2
View File
@@ -927,11 +927,21 @@ void Message::dumpField(const string& fieldName, bool withConditions, ostream* o
dumpAttribute(false, fieldName, output);
}
void Message::decode(bool leadingSeparator, OutputFormat outputFormat, ostringstream* output) const {
void Message::decode(bool leadingSeparator, bool appendDirection, OutputFormat outputFormat, ostringstream* output)
const {
if (leadingSeparator) {
*output << ",";
}
*output << "\n \"" << getName() << "\": {" // TODO include read/write/passive for overlapping names
*output << "\n \"" << getName();
if (appendDirection) {
if (isPassive()) {
*output << "-u";
} else if (isWrite()) {
*output << "-w";
}
}
*output << "\": {"
<< "\n \"name\": \"" << getName() << "\""
<< "\n \"lastup\": " << setw(0) << dec << static_cast<unsigned>(getLastUpdateTime());
if (getLastUpdateTime() != 0) {
*output << ",\n \"zz\": \"" << setfill('0') << setw(2) << hex << static_cast<unsigned>(getDstAddress()) << "\"";