Index: sources/canbus/messageglobals.h =================================================================== diff -u -r1732e83d2a0308b9c706f37d6d7724a364bbff2a -r460df093c4475816fc25d6b4c3ebfc50424ccca3 --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 1732e83d2a0308b9c706f37d6d7724a364bbff2a) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 460df093c4475816fc25d6b4c3ebfc50424ccca3) @@ -26,12 +26,11 @@ * \brief Payload Length * \details List of each action acceptable data length in the whole message packet. */ -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}, +const QHash payloadLen { + {GuiActionType::PowerOff , 1}, + {GuiActionType::KeepAlive , 0}, + {GuiActionType::BloodFlow , 24}, + {GuiActionType::String , 255}, }; /*! @@ -48,21 +47,22 @@ * \details Global information for each message frame. */ enum Frame_Data : quint8 { - eLenCanFrame = 8, - eLenMaxHeaderData = 3, - eLenMaxData = 255, + eLenCanFrame = 8, ///< The length of each can frame. Should be padded by 0x00 if is less. + eLenHeaderInfo = 3, ///< The Header length witch is included in CRC after Sync byte + eLenMaxHeaderData = 3, ///< Maximum data byte can be in one frame as header data portion + eLenMaxData = 255, ///< Maximum data length in a Can Message since data length value kept in one byte - eLenSyncByte = 1, - eLenActionId = 2, - eLenLength = 1, - + eLenSyncByte = 1, ///< The length of Sync byte at the beginning of each header frame + eLenActionId = 2, ///< The length of Message ID bytes (2) at the beginning of each header frame after sync + eLenLength = 1, ///< The length of data length value byte at the beginning of each header frame after Message ID }; /*! * \brief The Can_Id enum * \details The Valid Can Bus Message Id of each frame */ enum Can_Id : quint16 { + eChlid_NONE = 0x000, // Broadcasts //// Alarm eChlid_HD_Alarm = 0x001, ///< HD alarm broadcast @@ -90,9 +90,11 @@ * \brief The Message struct * \details The message structure after it's been glued together. */ -struct Message { // TODO : Should be converted to MessageModel +struct Message { // TODO : Should be converted to MessageModel class // no time left for now !!! + Can_Id can_id; GuiActionType actionId = GuiActionType::Unknown; int length = 0; + QByteArray head; QByteArray data; bool initialized = false; bool isEmpty () { return !initialized || !data.length(); }