Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -r2bc6542cebc264eb343f791f75223a1ca151465e -r73d6d02c19467735e92f7c451ca5d3b47a2a90e4 --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 2bc6542cebc264eb343f791f75223a1ca151465e) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 73d6d02c19467735e92f7c451ca5d3b47a2a90e4) @@ -213,7 +213,8 @@ { bool ok = true; QString mSenderID = "UI,"; - vCanId = Can::Can_Id::eChlid_UI_HD; + if (vCanId == Can::Can_Id::eChlid_NONE ) + vCanId = Can::Can_Id::eChlid_UI_HD ; vPayload.clear(); int length = vData.length(); @@ -303,27 +304,58 @@ * \return the source of the message in enum * \sa can::Can_Source */ -Can_Source MessageInterpreter::identifySource(Can_Id vCanId) +Can_Source MessageInterpreter::identifySource(Can_Id vCanId, QString *vText) { switch (vCanId) { case eChlid_HD_DG : // 0x008, ///< HD => DG case eChlid_HD_UI : // 0x020, ///< HD => UI case eChlid_HD_Alarm: // 0x001, ///< HD alarm broadcast case eChlid_HD_Sync : // 0x040, ///< HD sync broadcast + if (vText) *vText = "HD"; return Can_Source::eCan_HD; case eChlid_DG_HD : // 0x010, ///< DG => HD case eChlid_DG_UI : // 0x070, ///< DG => UI case eChlid_DG_Alarm: // 0x002, ///< DG alarm broadcast case eChlid_DG_Sync : // 0x080, ///< DG sync broadcast + if (vText) *vText = "DG"; return Can_Source::eCan_DG; default: + if (vText) *vText = "XX"; return Can_Source::eCan_Unknown; } } /*! + * \brief MessageInterpreter::identifyDestination + * \details Identifies the destination of the message regarding the channel id for the acknowledges + * \return the destination of the message in enum + * \sa can::Can_Source + * \sa can::Can_Id + */ +Can_Id MessageInterpreter::identifyDestination(Can_Id vCanId, QString *vText) +{ + switch (vCanId) { + case eChlid_HD_UI : // 0x020, ///< HD => UI + case eChlid_HD_Alarm: // 0x001, ///< HD alarm broadcast + case eChlid_HD_Sync : // 0x040, ///< HD sync broadcast + if (vText) *vText = "HD"; + return Can_Id::eChlid_UI_HD; + + case eChlid_DG_UI : // 0x070, ///< DG => UI + case eChlid_DG_Alarm: // 0x002, ///< DG alarm broadcast + case eChlid_DG_Sync : // 0x080, ///< DG sync broadcast + if (vText) *vText = "DG"; + return Can_Id::eChlid_UI_DG; + + default: + if (vText) *vText = "XX"; + return Can_Id::eChlid_UI_Sync; + } +} + +/*! * \brief MessageInterpreter::interpretMessage * \details This method will call appropriate message interpreter * for received messages from HD or DG regarding the Can_Id.