Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -rc0b30f1fa82d0121706351057ab52b3bb1141459 -r7936e751fe1cd3517d0d548b53fef41f41b4db4a --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision c0b30f1fa82d0121706351057ab52b3bb1141459) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 7936e751fe1cd3517d0d548b53fef41f41b4db4a) @@ -22,6 +22,7 @@ #include "Logger.h" #include "format.h" #include "Settings.h" +#include "StateController.h" using namespace Can; @@ -31,12 +32,12 @@ // a macro to simplify the transmit message // would be better later to be replaced by a template method // like the notify method of received messages -#define INTERPRET_TRANSMIT_MESSAGE(vMODEL) \ - if ( ! length ) { logInvalidLength(vActionId); return false; } \ - vCanId = vMODEL::canid(); \ +#define INTERPRET_TRANSMIT_MESSAGE() \ + /*if ( ! length ) { logInvalidLength(vActionId); return false; }*/ \ + vCanId = eChlid_HD_Sync; /*vMODEL::canid();*/ \ vPayload = Format::fromVariant(vData); \ - LOG_APPED_MSG(vActionId, vMODEL::toString(vData)); \ - DEBUG_SIGNAL(0, typeid(vMODEL).name()) + /*LOG_APPED_MSG(vActionId, vMODEL::toString(vData));*/ \ + /*DEBUG_SIGNAL(0, typeid(vMODEL).name())*/ // another version of the INTERPRET_TRANSMIT_MESSAGE for empty messages // same later improvements apply to this MACRO as well. @@ -53,7 +54,7 @@ * \param parent - QObject parent owner object. * Qt handles the children destruction by their parent objects life-cycle. */ -MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) { } +MessageInterpreter::MessageInterpreter(QObject *parent) : QObject(parent) {} /*! * \brief MessageInterpreter::notify @@ -207,6 +208,7 @@ vPayload.clear(); int length = vData.length(); Q_UNUSED(length); + INTERPRET_TRANSMIT_MESSAGE(); return ok; } @@ -243,6 +245,11 @@ if (vText) *vText = "DI"; return Can_Source::eCan_DI; + case eChlid_UI_HD : // 0x100, ///< UI for dry demo + if (vText) *vText = "UI"; + return Can_Source::eCan_UI; + // TODO why no break? + default: if (vText) *vText = "XX"; return Can_Source::eCan_Unknown; @@ -280,6 +287,10 @@ if (vText) *vText = "DI"; return Can_Id::eChlid_UI_Sync; + case eChlid_UI_HD : // 0x100, ///< UI for dry demo + if (vText) *vText = "HD"; + return Can_Id::eChlid_HD_UI; + default: if (vText) *vText = "XX"; return Can_Id::eChlid_UI_Sync; @@ -312,13 +323,13 @@ switch (identifySource(vMessage.can_id)) { case Can_Source::eCan_HD: ok = interpretMessage_HD(vMessage, vData); break; case Can_Source::eCan_DG: ok = interpretMessage_DG(vMessage, vData); break; - default : printUnhandled (vMessage ); qDebug() << "2" <<__FUNCTION__; break; // ok is false, the individual interpreters for ?HD/DG should not be called, and it should be done here. + default : printUnhandled (vMessage ); /*qDebug() << "2" <<__FUNCTION__;*/ break; // ok is false, the individual interpreters for ?HD/DG should not be called, and it should be done here. } } else { Q_UNUSED (vData ); printUnhandled (vMessage ); - qDebug() << "1" <<__FUNCTION__; + //qDebug() << "1" <<__FUNCTION__ << vMessage.actionId; } return ok; } @@ -410,7 +421,7 @@ { QString category = Storage::Settings_Category_MessagesUnhandled; QStringList groups = _Settings.groups(category); - qDebug() << "cat"; + // DEBUG: qDebug() << groups; for(const auto &group: qAsConst(groups)) { bool ok; @@ -431,7 +442,9 @@ bool ok = false; quint16 id = vMessage.actionId; QString logString = QString("%1,").arg(id,4,16); - qDebug() << "ID" << logString; + QVariantList logVariant; + logVariant.append(id); + if (_messageList.contains(id)) { ok = true; QStringList items = _messageList[id]; @@ -448,6 +461,7 @@ } } else { + logVariant.append(vMessage.data); if ( item == "F32" ) { Types::F32 param; if (! GetValue(vMessage.data, index, param )) logString += ",?"; @@ -491,7 +505,12 @@ } } LOG_APPED(logString); - qDebug() << "Message" << logString; + if ((id != 0x700) && (id != 0xFFFF) ) { + // Message 0x0700 is UI check in. It is not needed to be processed for dry demo + // Message 0xFFFF is the ack message and it is not needed to be processed for dry demo + qDebug() << "Message" << logString; + emit didUnhandledMsgReady(logVariant); + } } else { if ( gDisableUnhandledReport ) { // if the unhandled message error has been disabled, return.