|
@@ -17,14 +17,6 @@
|
|
|
|
|
|
#include "shellmatta.h"
|
|
#include "shellmatta.h"
|
|
|
|
|
|
-/** @brief packet definition with reduced payload (for internal packets) */
|
|
|
|
-typedef struct __attribute__((__packed__))
|
|
|
|
-{
|
|
|
|
- shellmatta_transport_header_t header; /**< header of the packet */
|
|
|
|
- //char payload[SHELLMATTA_TRANPORT_PAYLOAD_MAXLENGTH]; TODO - this has to be the maximum needed internal payload
|
|
|
|
- uint32_t crc; /**< checksum of the packet */
|
|
|
|
-} shellmatta_transport_packet_int_t;
|
|
|
|
-
|
|
|
|
/** @brief value of start-of-header character */
|
|
/** @brief value of start-of-header character */
|
|
#define SHELLMATTA_TRANSPORT_START_OF_HEADER 0x01u
|
|
#define SHELLMATTA_TRANSPORT_START_OF_HEADER 0x01u
|
|
/** @brief currently supported protocol version */
|
|
/** @brief currently supported protocol version */
|
|
@@ -32,17 +24,28 @@ typedef struct __attribute__((__packed__))
|
|
|
|
|
|
/* header field length defines */
|
|
/* header field length defines */
|
|
/** @brief length of header */
|
|
/** @brief length of header */
|
|
-#define SHELLMATTA_TRANSPORT_LENGTH_HEADER ((uint8_t)(8))
|
|
|
|
|
|
+#define SHELLMATTA_TRANSPORT_LENGTH_HEADER ((uint8_t)(8))
|
|
|
|
+/** @brief maximum length of shellmatta internal packages (e.g. sequence counter packets) */
|
|
|
|
+#define SHELLMATTA_TRANSPORT_LENGTH_PAYLOAD_INT ((uint8_t)(32))
|
|
/** @brief length of crc32 */
|
|
/** @brief length of crc32 */
|
|
-#define SHELLMATTA_TRANSPORT_LENGTH_CRC ((uint8_t)(4))
|
|
|
|
|
|
+#define SHELLMATTA_TRANSPORT_LENGTH_CRC ((uint8_t)(4))
|
|
/** @brief length of crc32 */
|
|
/** @brief length of crc32 */
|
|
-#define SHELLMATTA_TRANSPORT_LENGTH_STATIC (SHELLMATTA_TRANSPORT_LENGTH_HEADER + SHELLMATTA_TRANSPORT_LENGTH_CRC)
|
|
|
|
|
|
+#define SHELLMATTA_TRANSPORT_LENGTH_STATIC (SHELLMATTA_TRANSPORT_LENGTH_HEADER + SHELLMATTA_TRANSPORT_LENGTH_CRC)
|
|
|
|
|
|
/** @brief helper macro for CRC calculation */
|
|
/** @brief helper macro for CRC calculation */
|
|
#define SHELLMATTA_TRANSPORT_CALC_CRC(transporLayer, data, size) NULL != (transportLayer)->customCrcFct ? \
|
|
#define SHELLMATTA_TRANSPORT_CALC_CRC(transporLayer, data, size) NULL != (transportLayer)->customCrcFct ? \
|
|
(transportLayer)->customCrcFct((data), (size)) : \
|
|
(transportLayer)->customCrcFct((data), (size)) : \
|
|
crc32Calc((data), (size));
|
|
crc32Calc((data), (size));
|
|
|
|
|
|
|
|
+/** @brief packet definition with reduced payload (for internal packets) */
|
|
|
|
+typedef struct __attribute__((__packed__))
|
|
|
|
+{
|
|
|
|
+ shellmatta_transport_header_t header; /**< header of the packet */
|
|
|
|
+ char payload[SHELLMATTA_TRANSPORT_LENGTH_PAYLOAD_INT]; /**< payload of the packet */
|
|
|
|
+ uint32_t crc; /**< checksum of the packet */
|
|
|
|
+} shellmatta_transport_packet_int_t;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @brief definitions of shellmatta transport layer packet types
|
|
* @brief definitions of shellmatta transport layer packet types
|
|
*/
|
|
*/
|