made SymbolString master/slave aware and contain only unescaped data, moved CRC tracking and escpaing/enscaping to BusHandler, moved parseInt/parseSignedInt from datatype.h to symbol.h, added new error code for retrival of unexpted symbol after a send to the bus

This commit is contained in:
john30
2017-02-26 16:31:32 +01:00
parent 5087ece9a4
commit 1a878694d2
17 changed files with 586 additions and 565 deletions
+11 -11
View File
@@ -473,14 +473,14 @@ int main() {
string check[5] = checks[i];
istringstream isstr(check[0]);
string expectStr = check[1];
SymbolString mstr(false);
SymbolString mstr(true);
result_t result = mstr.parseHex(check[2]);
if (result != RESULT_OK) {
cout << "\"" << check[0] << "\": parse \"" << check[2] << "\" error: " << getResultCode(result) << endl;
error = true;
continue;
}
SymbolString sstr(false);
SymbolString sstr;
result = sstr.parseHex(check[3]);
if (result != RESULT_OK) {
cout << "\"" << check[0] << "\": parse \"" << check[3] << "\" error: " << getResultCode(result) << endl;
@@ -563,17 +563,17 @@ int main() {
}
ostringstream output;
SymbolString writeMstr(false);
result = writeMstr.parseHex(mstr.getDataStr(true, false).substr(0, 10));
SymbolString writeMstr(true);
result = writeMstr.parseHex(mstr.getDataStr().substr(0, 10));
if (result != RESULT_OK) {
cout << " parse \"" << mstr.getDataStr(true, false).substr(0, 10) << "\" error: " << getResultCode(result)
cout << " parse \"" << mstr.getDataStr().substr(0, 10) << "\" error: " << getResultCode(result)
<< endl;
error = true;
}
SymbolString writeSstr(false);
result = writeSstr.parseHex(sstr.getDataStr(true, false).substr(0, 2));
SymbolString writeSstr;
result = writeSstr.parseHex(sstr.getDataStr().substr(0, 2));
if (result != RESULT_OK) {
cout << " parse \"" << sstr.getDataStr(true, false).substr(0, 2) << "\" error: " << getResultCode(result)
cout << " parse \"" << sstr.getDataStr().substr(0, 2) << "\" error: " << getResultCode(result)
<< endl;
error = true;
}
@@ -621,9 +621,9 @@ int main() {
error = true;
} else {
bool match = mstr == writeMstr && sstr == writeSstr;
verify(failedWriteMatch, "write", expectStr, match, mstr.getDataStr(true, false) + " "
+ sstr.getDataStr(true, false), writeMstr.getDataStr(true, false) + " "
+ writeSstr.getDataStr(true, false));
verify(failedWriteMatch, "write", expectStr, match, mstr.getDataStr() + " "
+ sstr.getDataStr(), writeMstr.getDataStr() + " "
+ writeSstr.getDataStr());
}
}
delete fields;