new enum type for OutputFormat, add level/pollprio/condition to HTTP GET and extend message key by circuit/direction/condition for OF_ALL_ATTRS, start message dump in JSON format
This commit is contained in:
@@ -568,7 +568,7 @@ int main() {
|
||||
if (flags.find('i') != string::npos) {
|
||||
findIndex = parseSignedInt(flags.substr(flags.find('i')+1).c_str(), 10, 0, 9, &result);
|
||||
}
|
||||
OutputFormat verbosity = 0;
|
||||
OutputFormat verbosity = OF_NONE;
|
||||
if (flags.find("v") != string::npos) {
|
||||
verbosity |= OF_NAMES;
|
||||
}
|
||||
@@ -633,7 +633,7 @@ int main() {
|
||||
continue;
|
||||
}
|
||||
cout << "\"" << check[0] << "\"=\"";
|
||||
fields->dump(false, false, &cout);
|
||||
fields->dump(false, OF_NONE, &cout);
|
||||
cout << "\": create OK" << endl;
|
||||
|
||||
ostringstream output;
|
||||
@@ -650,9 +650,9 @@ int main() {
|
||||
cout << " parse \"" << sstr.getStr().substr(0, 2) << "\" error: " << getResultCode(result) << endl;
|
||||
error = true;
|
||||
}
|
||||
result = fields->read(mstr, 0, false, findName, findIndex, verbosity|(numeric?OF_NUMERIC:0), -1, &output);
|
||||
result = fields->read(mstr, 0, false, findName, findIndex, verbosity|(numeric?OF_NUMERIC:OF_NONE), -1, &output);
|
||||
if (result >= RESULT_OK) {
|
||||
result = fields->read(sstr, 0, !output.str().empty(), findName, findIndex, verbosity|(numeric?OF_NUMERIC:0), -1, &output);
|
||||
result = fields->read(sstr, 0, !output.str().empty(), findName, findIndex, verbosity|(numeric?OF_NUMERIC:OF_NONE), -1, &output);
|
||||
}
|
||||
if (failedRead) {
|
||||
if (result >= RESULT_OK) {
|
||||
|
||||
@@ -183,8 +183,6 @@ int main() {
|
||||
{"*r,cir*cuit#level,na*me,com*ment,ff,75,b509,0d", "", "", "", ""},
|
||||
{"r,CIRCUIT,NAME,COMMENT,,,,0100,field,,UCH", "r,cirCIRCUITcuit,naNAMEme,comCOMMENTment,ff,75,b509,0d0100,field,s,UCH,,,: field=42", "ff75b509030d0100", "012a", "DN"},
|
||||
{"r,CIRCUIT,NAME,COMMENT,,,,0100,field,,UCH",
|
||||
// "\"naNAMEme\": {r,cirCIRCUITcuit,naNAMEme,comCOMMENTment,ff,75,b509,0d0100,field,s,UCH,,,: field=42"
|
||||
"\n"
|
||||
" \"naNAMEme\": {\n"
|
||||
" \"name\": \"naNAMEme\",\n"
|
||||
" \"passive\": false,\n"
|
||||
@@ -407,7 +405,7 @@ int main() {
|
||||
ostringstream output;
|
||||
if (withMessageDump) {
|
||||
if (decodeJson) {
|
||||
message->decodeJson(false, false, false, OF_JSON|OF_DEFINTION, &output);
|
||||
message->decodeJson(false, false, true, false, OF_JSON|OF_DEFINITION, &output);
|
||||
string str = output.str();
|
||||
size_t start = str.find("\"lastup\": ");
|
||||
if (start != string::npos) {
|
||||
@@ -420,12 +418,12 @@ int main() {
|
||||
output.str("");
|
||||
output << str;
|
||||
} else {
|
||||
message->dump(nullptr, true, &output);
|
||||
message->dump(nullptr, true, OF_NONE, &output);
|
||||
}
|
||||
output << ": ";
|
||||
}
|
||||
result = message->decodeLastData(false, nullptr, -1,
|
||||
(decodeVerbose?OF_NAMES|OF_UNITS|OF_COMMENTS:0)|(decodeJson?OF_NAMES|OF_JSON:0), &output);
|
||||
(decodeVerbose?OF_NAMES|OF_UNITS|OF_COMMENTS:OF_NONE)|(decodeJson?OF_NAMES|OF_JSON:OF_NONE), &output);
|
||||
if (result != RESULT_OK) {
|
||||
cout << " \"" << check[2] << "\" / \"" << check[3] << "\": decode error " << (message->isWrite() ? "write: " : "read: ")
|
||||
<< getResultCode(result) << endl;
|
||||
|
||||
Reference in New Issue
Block a user