Index: MessageSupport.h =================================================================== diff -u -r9512aac6feeb1379d6d425361fa78d58f75c86f6 -rb8c0a53bcfa6be12c305761b0b1b5c79e97b55ca --- MessageSupport.h (.../MessageSupport.h) (revision 9512aac6feeb1379d6d425361fa78d58f75c86f6) +++ MessageSupport.h (.../MessageSupport.h) (revision b8c0a53bcfa6be12c305761b0b1b5c79e97b55ca) @@ -19,6 +19,7 @@ #define __MESSAGESUPPORT_H__ #include "CommBuffers.h" +#include "MsgDefs.h" /** * @defgroup MessageSupport MessageSupport @@ -29,6 +30,38 @@ * @{ */ +// ********** public definitions ****************** + +#define MAX_MSG_PAYLOAD_SIZE 250 ///< Bytes +#define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) ///< Byte size of a message's overhead (fixed at 6 bytes). + +#pragma pack(push,1) + +/// Record structure for message header. +typedef struct +{ + S16 seqNo; ///< Sequence number (and ACK required bit) of message + U16 msgID; ///< ID of message + U08 payloadLen; ///< Length of payload in bytes +} MESSAGE_HEADER_T; + +/// Record structure for a message (header + payload). +typedef struct +{ + COMM_BUFFER_T in_buffer; ///< Message received into this channel buffer + MESSAGE_HEADER_T hdr; ///< Message header + U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; ///< Message payload +} MESSAGE_T; + +/// Record structure for a wrapped message (message + CRC). +typedef struct +{ + MESSAGE_T msg; ///< Message + U08 crc; ///< Message CRC +} MESSAGE_WRAPPER_T; + +#pragma pack(pop) + // ********** public function prototypes ********** BOOL broadcastData( MSG_ID_T msgID, COMM_BUFFER_T buffer, U08* dataPtr, U32 length );