updated
This commit is contained in:
@@ -46,7 +46,7 @@ int main()
|
|||||||
// message: [type],[circuit],name,[comment],[QQ[;QQ]*],[ZZ],[PBSB],[ID],fields...
|
// message: [type],[circuit],name,[comment],[QQ[;QQ]*],[ZZ],[PBSB],[ID],fields...
|
||||||
// field: name,part,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
// field: name,part,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
||||||
// template: name,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
// template: name,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
||||||
// condition: name,circuit,messagename,[fieldname],values
|
// condition: name,circuit,messagename,[comment],[fieldname],[ZZ],values
|
||||||
string checks[][5] = {
|
string checks[][5] = {
|
||||||
// "message", "decoded", "master", "slave", "flags"
|
// "message", "decoded", "master", "slave", "flags"
|
||||||
{"date,HDA:3,,,Datum", "", "", "", "template"},
|
{"date,HDA:3,,,Datum", "", "", "", "template"},
|
||||||
@@ -79,7 +79,7 @@ int main()
|
|||||||
{"r,ehp,bad,invalid pos,,50,B5ff,,,s,HEX:8;tempsensor;tempsensor;tempsensor;tempsensor;tempsensor;power;power,,,", "", "", "", "c" },
|
{"r,ehp,bad,invalid pos,,50,B5ff,,,s,HEX:8;tempsensor;tempsensor;tempsensor;tempsensor;tempsensor;power;power,,,", "", "", "", "c" },
|
||||||
{"r,ehp,ApplianceCode,,,08,b509,0d4301,,,UCH,", "9", "ff08b509030d4301", "0109", "d" },
|
{"r,ehp,ApplianceCode,,,08,b509,0d4301,,,UCH,", "9", "ff08b509030d4301", "0109", "d" },
|
||||||
{"r,ehp,,,,08,b509,0d", "", "", "", "defaults" },
|
{"r,ehp,,,,08,b509,0d", "", "", "", "defaults" },
|
||||||
{"[brinetowater],ehp,ApplianceCode,,4;6;8;9;10", "", "", "", "condition" },
|
{"[brinetowater],ehp,ApplianceCode,,,,4;6;8;9;10", "", "", "", "condition" },
|
||||||
{"[airtowater]r,ehp,notavailable,,,,,0100,,,uch", "1", "ff08b509030d0100", "0101", "c" },
|
{"[airtowater]r,ehp,notavailable,,,,,0100,,,uch", "1", "ff08b509030d0100", "0101", "c" },
|
||||||
{"[brinetowater]r,ehp,available,,,,,0100,,,uch", "1", "ff08b509030d0100", "0101", "d" },
|
{"[brinetowater]r,ehp,available,,,,,0100,,,uch", "1", "ff08b509030d0100", "0101", "d" },
|
||||||
};
|
};
|
||||||
@@ -157,7 +157,7 @@ int main()
|
|||||||
// store defaults or condition
|
// store defaults or condition
|
||||||
vector<string>::iterator it = entries.begin();
|
vector<string>::iterator it = entries.begin();
|
||||||
size_t oldSize = conditions.size();
|
size_t oldSize = conditions.size();
|
||||||
result = messages->addDefaultFromFile(defaultsRows, entries, it, "no file", 1);
|
result = messages->addDefaultFromFile(defaultsRows, entries, it, "", "", "no file", 1);
|
||||||
if (result != RESULT_OK)
|
if (result != RESULT_OK)
|
||||||
cout << "\"" << check[0] << "\": defaults read error: " << getResultCode(result) << endl;
|
cout << "\"" << check[0] << "\": defaults read error: " << getResultCode(result) << endl;
|
||||||
else if (it != entries.end())
|
else if (it != entries.end())
|
||||||
@@ -168,10 +168,9 @@ int main()
|
|||||||
if (conditions.size()==oldSize) {
|
if (conditions.size()==oldSize) {
|
||||||
cout << " create condition error" << endl;
|
cout << " create condition error" << endl;
|
||||||
} else {
|
} else {
|
||||||
string error;
|
result = messages->resolveConditions();
|
||||||
result = messages->resolveConditions(error);
|
|
||||||
if (result != RESULT_OK)
|
if (result != RESULT_OK)
|
||||||
cout << " resolve conditions error: " << getResultCode(result) << " " << error << endl;
|
cout << " resolve conditions error: " << getResultCode(result) << " " << messages->getLastError() << endl;
|
||||||
else
|
else
|
||||||
cout << " resolve conditions OK" << endl;
|
cout << " resolve conditions OK" << endl;
|
||||||
}
|
}
|
||||||
@@ -189,8 +188,13 @@ int main()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vector<string>::iterator it = entries.begin();
|
vector<string>::iterator it = entries.begin();
|
||||||
|
string types = *it;
|
||||||
result = Message::create(it, entries.end(), &defaultsRows, &conditions, "no file", templates, deleteMessages);
|
Condition* condition = NULL;
|
||||||
|
result = messages->readConditions(types, "no file", condition);
|
||||||
|
if (result==RESULT_OK) {
|
||||||
|
*it = types;
|
||||||
|
result = Message::create(it, entries.end(), &defaultsRows, condition, "no file", templates, deleteMessages);
|
||||||
|
}
|
||||||
if (failedCreate) {
|
if (failedCreate) {
|
||||||
if (result == RESULT_OK)
|
if (result == RESULT_OK)
|
||||||
cout << "\"" << check[0] << "\": failed create error: unexpectedly succeeded" << endl;
|
cout << "\"" << check[0] << "\": failed create error: unexpectedly succeeded" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user