Index: sources/canbus/messageglobals.h =================================================================== diff -u -r68fe14b0d2f0e79d03c95cc0dfff5b47948b6d5b -rb2ebb6f71cf9b0c2ba68a47776e5b220b165b21c --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 68fe14b0d2f0e79d03c95cc0dfff5b47948b6d5b) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision b2ebb6f71cf9b0c2ba68a47776e5b220b165b21c) @@ -13,22 +13,36 @@ */ #pragma once +// Qt +#include + +// Project #include "guiactions.h" namespace Can { -namespace Message { +/*! + * \brief Payload Length + * \details List of each action acceptable data length in the whole message packet. + */ const QHash payloadLen { - {Gui::GuiActionType::PowerOff, 255}, + {Gui::GuiActionType::PowerOff, 1}, {Gui::GuiActionType::Check_In, 0} }; -// constants +/*! + * \brief The Payload_Data enum + * \details Global information for message packet. + */ enum Payload_Data : quint8 { ePayload_None = 0x00, ePayload_Sync = 0xA5, }; +/*! + * \brief The Frame_Data enum + * \details Global information for each message frame. + */ enum Frame_Data : quint8 { eLenCanFrame = 8, eLenMaxHeaderData = 3, @@ -39,7 +53,10 @@ eLenLength = 1, }; - +/*! + * \brief The Can_Id enum + * \details The Valid Can Bus Message Id of each frame + */ enum Can_Id : quint16 { // Broadcasts //// Alarm @@ -64,5 +81,20 @@ 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; + QByteArray data; + + bool isComplete() { return data.length() == length; } + bool isEmpty () { return data.length() == 0 ; } +}; +typedef QList MessageList; + } -} +