Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -rd3f98384e9400f8acb84c88dee75f1c480986998 -r9392f5be540bb428dc64757ef2e50a4d4e5090a8 --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision d3f98384e9400f8acb84c88dee75f1c480986998) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 9392f5be540bb428dc64757ef2e50a4d4e5090a8) @@ -155,7 +155,7 @@ if (!ok){ qDebug() << "ERROR :" << "Unexpected Channel"; - qDebug() << Format::toHexString(mFrameId, false, 3) + " -- " + vFrame.payload().toHex(' '); + qDebug() << Format::toHexString(mFrameId, false, eLenChannelDigit) + " -- " + vFrame.payload().toHex(' '); return; } Index: sources/canbus/messagebuilder.cpp =================================================================== diff -u -r561055268da68e24fe91a1148b76bf1785dae14d -r9392f5be540bb428dc64757ef2e50a4d4e5090a8 --- sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision 561055268da68e24fe91a1148b76bf1785dae14d) +++ sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision 9392f5be540bb428dc64757ef2e50a4d4e5090a8) @@ -89,7 +89,7 @@ vPayload += (mAction >> 8) & 0xFF;//high byte vPayload += mAction & 0xFF;// low byte } else { - QString mHexString = Format::toHexString(vAction, false, 3); + QString mHexString = Format::toHexString(vAction, false, eLenMessageIDDigits); qDebug() << "ERROR :" << tr("Incorrect Action ID '%1'").arg(mHexString); return false; } @@ -117,7 +117,7 @@ } } if (vData.length() < len) { - QString mHexString = Format::toHexString(vAction, false, 3); + QString mHexString = Format::toHexString(vAction, false, eLenMessageIDDigits); qDebug() << "ERROR :" << tr("Not enough data has been provided for the Message ID '%1'").arg(mHexString); qDebug() << vData.toHex('.'); return false; @@ -232,8 +232,8 @@ quint8 mBeenRead = 0; if ( ! checkCRC(crcData, mExpected, mBeenRead ) ) { // CRC is always next byte after Data qDebug() << "ERROR :" << tr("CRC error, expected %1 but got %2") - .arg(Format::toHexString(mExpected, true, 2)) - .arg(Format::toHexString(mBeenRead, true, 2)); + .arg(Format::toHexString(mExpected, true, eLenCRCDigits)) + .arg(Format::toHexString(mBeenRead, true, eLenCRCDigits)); return false; } } @@ -385,10 +385,10 @@ byteList[i] = QByteArray("\033[36m") + byteList[i].constData() + QByteArray("\033[0m"); } } - view = Format::toHexString(vCan_Id, false, 3).toLatin1() + " " + byteList.join('.'); + view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + byteList.join('.'); fprintf(stderr, "%s\n", view.constData()); } else { - view = Format::toHexString(vCan_Id, false, 3).toLatin1() + " " + vPayload.toHex('.'); + view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex('.'); fprintf(stderr, "%s\n", view.constData()); } } Index: sources/canbus/messageglobals.h =================================================================== diff -u -rc5389647e2259e67f8e6d923f3481d7d3f4eab68 -r9392f5be540bb428dc64757ef2e50a4d4e5090a8 --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision c5389647e2259e67f8e6d923f3481d7d3f4eab68) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 9392f5be540bb428dc64757ef2e50a4d4e5090a8) @@ -56,6 +56,11 @@ eLenSyncByte = 1, ///< The length of Sync byte at the beginning of each header frame eLenActionId = 2, ///< The length of MessageID bytes (2) at the beginning of each header frame after sync eLenLength = 1, ///< The length of data length value byte at the beginning of each header frame after MessageID + + eLenCRCDigits = 2, + eLenChannelDigits = 3, + eLenMessageIDDigits = 4, + }; /*! Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r561055268da68e24fe91a1148b76bf1785dae14d -r9392f5be540bb428dc64757ef2e50a4d4e5090a8 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 561055268da68e24fe91a1148b76bf1785dae14d) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 9392f5be540bb428dc64757ef2e50a4d4e5090a8) @@ -306,7 +306,7 @@ */ void MessageInterpreter::printUnhandled(const Message &vMessage) { - QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, 3); + QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, eLenMessageIDDigits); qDebug() << "WARNG :" << tr("Unhandled Message ID (HD)"); qDebug().noquote() << QString(mActionIdHexString + " " + vMessage.data.toHex('.')).toLatin1(); qDebug() << "";