Index: sources/canbus/messageglobals.h =================================================================== diff -u -r272bb81655222b2bf0c3c7099523c0b658eb9cb8 -r1732e83d2a0308b9c706f37d6d7724a364bbff2a --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 272bb81655222b2bf0c3c7099523c0b658eb9cb8) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 1732e83d2a0308b9c706f37d6d7724a364bbff2a) @@ -19,15 +19,19 @@ // Project #include "guiglobals.h" +using namespace Gui; namespace Can { /*! * \brief Payload Length * \details List of each action acceptable data length in the whole message packet. */ -const QHash payloadLen { - {Gui::GuiActionType::PowerOff, 1}, - {Gui::GuiActionType::Check_In, 0} +const QHash payloadLen { +// {/*GuiActionType::PowerOff*/ 0x0100, 1}, +// {/*GuiActionType::Check_In*/ 0x0700, 0} + {static_cast(GuiActionType::PowerOff ), 1}, + {static_cast(GuiActionType::KeepAlive), 0}, + {static_cast(GuiActionType::String ), 255}, }; /*! @@ -53,6 +57,7 @@ eLenLength = 1, }; + /*! * \brief The Can_Id enum * \details The Valid Can Bus Message Id of each frame @@ -79,22 +84,23 @@ // UI lessens occasionally eChlid_DG_UI = eChlid_DG_Alarm, ///< No direct channel has been defined between DG&UI, May be required for logging eChlid_UI_DG = eChlid_UI_Sync , ///< No direct channel has been defined between DG&UI, May be required for logging - }; /*! * \brief The Message struct * \details The message structure after it's been glued together. */ -struct Message { - quint8 length; - Gui::GuiActionType actionId; +struct Message { // TODO : Should be converted to MessageModel + GuiActionType actionId = GuiActionType::Unknown; + int length = 0; QByteArray data; - - bool isComplete() { return data.length() == length; } - bool isEmpty () { return data.length() == 0 ; } + bool initialized = false; + bool isEmpty () { return !initialized || !data.length(); } + bool isComplete() { return !isEmpty() && data.length() == length; } }; + typedef QList MessageList; +typedef QList FrameList; }