Index: sources/canbus/MessageBuilder.cpp =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/canbus/MessageBuilder.cpp (.../MessageBuilder.cpp) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/canbus/MessageBuilder.cpp (.../MessageBuilder.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -15,6 +15,7 @@ #include "MessageBuilder.h" // Qt +#include // Project #include "Logger.h" @@ -442,31 +443,36 @@ qDebug() << " "; return; } + QString datetime = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzzzzz"); QByteArray view; + view.append(datetime); // coco begin validated: printPayload and specially vUseColor is for debugging purposes and has been validated manually. if (vUseColor) { QList byteList; - byteList = vPayload.toHex('.').split('.'); + byteList = vPayload.toHex('.').toUpper().split('.'); for (int i = 0; i < byteList.length(); i++) { if (vIsHeader) { - if(i == 0) { + if(i == 0) { // A5 byteList[i] = QByteArray("\033[32m") + byteList[i].constData(); } - if (i == 1 || i == 2) { + if (i == 1 || i == 2) { // sequence byteList[i] = QByteArray("\033[33m") + byteList[i].constData(); } - if (i > 2) { + if (i == 3 || i == 4) { // message id + byteList[i] = QByteArray("\033[35m") + byteList[i].constData(); + } + if (i > 4) { byteList[i] = QByteArray("\033[36m") + byteList[i].constData() + QByteArray("\033[0m"); } } else { byteList[i] = QByteArray("\033[36m") + byteList[i].constData() + QByteArray("\033[0m"); } } - view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + byteList.join('.'); + view += Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + byteList.join(' '); // the fprintf is used for the colored output fprintf(stderr, "%s\n", view.constData()); } else { - view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex('.'); + view += Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex(' '); // the fprintf is used for the colored output fprintf(stderr, "%s\n", view.constData()); }