Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r460df093c4475816fc25d6b4c3ebfc50424ccca3 -r4c1551d45b40987c2d59c11e95760e9b6c55fc68 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 460df093c4475816fc25d6b4c3ebfc50424ccca3) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 4c1551d45b40987c2d59c11e95760e9b6c55fc68) @@ -16,7 +16,9 @@ // Qt // Project +#include "format.h" + using namespace Can; MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) { } @@ -49,7 +51,7 @@ quint8 tmp = vData[ix].toUInt(); vPayload += tmp; } else { - QString mActionIdHexString = GuiActions::toHexString(vActionId); + QString mActionIdHexString = Format::toHexString(vActionId); qDebug() << "ERROR :" << tr("Incorrect data for Message ID (UI) '%1'").arg(mActionIdHexString); ok = false; } @@ -65,7 +67,7 @@ break; default: - QString mActionIdHexString = GuiActions::toHexString(vActionId); + QString mActionIdHexString = Format::toHexString(vActionId); qDebug() << "ERROR :" << tr("Unknown Message ID (UI) '%1'").arg(mActionIdHexString); ok = false; break; @@ -119,16 +121,22 @@ break; } - case GuiActionType::Alarm: + case GuiActionType::AlarmStatus: + printUnhandled(vMessage); break; - default: { - QString mActionIdHexString = GuiActions::toHexString(vMessage.actionId); - qDebug() << "ERROR :" << tr("Unknown Message ID (HD) '%1'").arg(mActionIdHexString); - ok = false; + case GuiActionType::AlarmTriggered: + printUnhandled(vMessage); break; + + case GuiActionType::AlarmCleared: + printUnhandled(vMessage); + break; + + default: + printUnhandled(vMessage); + break; } - } return ok; } @@ -147,7 +155,7 @@ return false; } if ( vMessage.data.length() < payloadLen[GuiActionType::BloodFlow] ) { - QString mActionIdHexString = GuiActions::toHexString(vMessage.actionId); + QString mActionIdHexString = Format::toHexString(vMessage.actionId); qDebug() << "ERROR :" << tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString); return false; } @@ -215,9 +223,17 @@ quint8 tmp = vMessage.data[ix]; vShowHide = tmp; } else { - QString mActionIdHexString = GuiActions::toHexString(vMessage.actionId); + QString mActionIdHexString = Format::toHexString(vMessage.actionId); qDebug() << "ERROR :" << tr("Incorrect data for Message ID (HD) '%1'").arg(mActionIdHexString); ok = false; } return ok; } + +void MessageInterpreter::printUnhandled(const Message &vMessage) +{ + QString mActionIdHexString = Format::toHexString(vMessage.actionId, false, 3); + qDebug() << "WARNG :" << tr("Unhandled Message ID (HD)"); + qDebug().noquote() << QString(mActionIdHexString + " " + vMessage.data.toHex('.')).toLatin1(); + qDebug() << ""; +}