Classes | Macros | Typedefs | Functions | Variables
xsmessage.h File Reference
#include "xstypesconfig.h"
#include "pstdint.h"
#include "xsbytearray.h"
#include "xsdataidentifier.h"
#include "xsxbusmessageid.h"
#include "xsstring.h"
#include "xsresultvalue.h"
#include "xsbusid.h"
Include dependency graph for xsmessage.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  XsMessageHeader::LengthData::ExtendedLength
 
struct  XsMessageHeader::LengthData::ExtendedLength::ExtendedParts
 
union  XsMessageHeader::LengthData
 
struct  XsMessage
 Structure for storing a single message. More...
 
struct  XsMessageHeader
 A message header. More...
 

Macros

#define swapEndian16(src)   (uint16_t)(((uint16_t)(src) >> 8) | ((uint16_t)(src) << 8))
 
#define swapEndian32(src)   (uint32_t)(((uint32_t)(src) >> 24) | (((uint32_t)(src) >> 8) & 0xFF00) | (((uint32_t)(src) << 8) & 0xFF0000) | ((uint32_t)(src) << 24))
 
#define swapEndian64(src)   (uint64_t)(((src >> 56) & 0xFFULL) | ((src >> 40) & 0xFF00ULL) | ((src >> 24) & 0xFF0000ULL) | ((src >> 8) & 0xFF000000ULL) | ((src << 8) & 0xFF00000000ULL) | ((src << 24) & 0xFF0000000000ULL) | ((src << 40) & 0xFF000000000000ULL) | ((src << 56)))
 
#define XS_EXTLENCODE   0xFF
 
#define XS_LEN_CHECKSUM   1
 
#define XS_LEN_FLOAT   4
 
#define XS_LEN_MSGEXTHEADER   6
 
#define XS_LEN_MSGEXTHEADERCS   7
 
#define XS_LEN_MSGHEADER   4
 
#define XS_LEN_MSGHEADERCS   5
 
#define XS_LEN_UNSIGINT   4
 
#define XS_LEN_UNSIGSHORT   2
 
#define XS_MAXDATALEN   (8192-XS_LEN_MSGEXTHEADERCS)
 
#define XS_MAXGARBAGE   (XS_MAXMSGLEN+1)
 
#define XS_MAXMSGLEN   (XS_MAXDATALEN+XS_LEN_MSGEXTHEADERCS)
 
#define XS_MAXSHORTDATALEN   254
 
#define XS_MAXSHORTMSGLEN   (XS_MAXSHORTDATALEN+XS_LEN_MSGHEADERCS)
 
#define XS_PREAMBLE   0xFA
 
#define XSMESSAGE_INITIALIZER   { XSBYTEARRAY_INITIALIZER, 1, 0 }
 

Typedefs

typedef struct XsMessage XsMessage
 
typedef struct XsMessageHeader XsMessageHeader
 

Functions

XSTYPES_DLL_API void XsMessage_assign (XsMessage *thisPtr, XsSize dataSize)
 This function reinitializes the XsMessage object and reserves dataSize bytes for data. More...
 
XSTYPES_DLL_API int XsMessage_compare (XsMessage const *a, XsMessage const *b)
 Compare the contents of the messages a and b, returning non-0 if they are different. More...
 
XSTYPES_DLL_API uint8_t XsMessage_computeChecksum (XsMessage const *thisPtr)
 Computes the checksum for the message. More...
 
const XSTYPES_DLL_API uint8_t * XsMessage_constData (XsMessage const *thisPtr, XsSize offset)
 This function returns a const pointer to the offset in the data of the message in thisptr. More...
 
XSTYPES_DLL_API void XsMessage_construct (XsMessage *thisPtr)
 This function initializes the XsMessage object. More...
 
XSTYPES_DLL_API void XsMessage_constructSized (XsMessage *thisPtr, XsSize dataSize)
 This function initializes the XsMessage object and reserves dataSize bytes for data. More...
 
XSTYPES_DLL_API void XsMessage_copy (XsMessage *copy, XsMessage const *src)
 This function copies from thisPtr to copy. More...
 
XSTYPES_DLL_API void XsMessage_copyConstruct (XsMessage *thisPtr, XsMessage const *src)
 Construct an XsMessage as a copy of XsMessage src. More...
 
XSTYPES_DLL_API XsSize XsMessage_dataSize (XsMessage const *thisPtr)
 This function returns the datasize of the message in thisptr. More...
 
XSTYPES_DLL_API void XsMessage_deleteData (XsMessage *thisPtr, XsSize count, XsSize offset)
 Remove count bytes of data from the message at offset. More...
 
XSTYPES_DLL_API void XsMessage_destruct (XsMessage *thisPtr)
 This function clears the data in the message. More...
 
XSTYPES_DLL_API int XsMessage_empty (XsMessage const *thisPtr)
 Test if this message is empty. More...
 
const XSTYPES_DLL_API XsMessageHeaderXsMessage_getConstHeader (XsMessage const *thisPtr)
 
const XSTYPES_DLL_API uint8_t * XsMessage_getDataBuffer (XsMessage const *thisPtr, XsSize offset)
 Returns a const pointer to the data buffer of the message. More...
 
XSTYPES_DLL_API uint8_t XsMessage_getDataByte (XsMessage const *thisPtr, XsSize offset)
 Returns the byte value at offset in the data of the message. More...
 
XSTYPES_DLL_API double XsMessage_getDataDouble (XsMessage const *thisPtr, XsSize offset)
 Returns the double at offset in the data of the message. More...
 
XSTYPES_DLL_API double XsMessage_getDataF1220 (XsMessage const *thisPtr, XsSize offset)
 Returns the F12.20 value at offset in the data of the message. More...
 
XSTYPES_DLL_API float XsMessage_getDataFloat (XsMessage const *thisPtr, XsSize offset)
 Returns the float value at offset in the data of the message. More...
 
XSTYPES_DLL_API double XsMessage_getDataFP1632 (XsMessage const *thisPtr, XsSize offset)
 Returns the F16.32 value at offset in the data of the message. More...
 
XSTYPES_DLL_API void XsMessage_getDataFPValuesById (XsMessage const *thisPtr, XsDataIdentifier dataIdentifier, double *dest, XsSize offset, XsSize numValues)
 Return current data values as double, conversion depends on outputSetting. More...
 
XSTYPES_DLL_API uint32_t XsMessage_getDataLong (XsMessage const *thisPtr, XsSize offset)
 Returns the long value at offset in the data of the message. More...
 
XSTYPES_DLL_API uint64_t XsMessage_getDataLongLong (XsMessage const *thisPtr, XsSize offset)
 Returns the long value at offset in the data of the message. More...
 
XSTYPES_DLL_API void XsMessage_getDataRealValuesById (XsMessage const *thisPtr, XsDataIdentifier dataIdentifier, XsReal *dest, XsSize offset, XsSize numValues)
 Return current data values as XsReal, conversion is done automatically based on data identifier. More...
 
XSTYPES_DLL_API uint16_t XsMessage_getDataShort (XsMessage const *thisPtr, XsSize offset)
 Returns the short value at offset in the data of the message. More...
 
XSTYPES_DLL_API void XsMessage_getEndianCorrectData (XsMessage const *thisPtr, void *value, XsSize size, XsSize offset)
 Get data of size size at offset, and put it byteswapped into value. More...
 
XSTYPES_DLL_API uint8_t XsMessage_getFPValueSize (XsDataIdentifier id)
 
XSTYPES_DLL_API XsMessageHeaderXsMessage_getHeader (XsMessage *)
 Returns a pointer to the message header for this message. More...
 
const XSTYPES_DLL_API uint8_t * XsMessage_getMessageStart (XsMessage const *thisPtr)
 This function returns a const pointer to the header of the message in thisptr. More...
 
XSTYPES_DLL_API XsSize XsMessage_getTotalMessageSize (XsMessage const *thisPtr)
 Return the length of the message buffer. More...
 
XSTYPES_DLL_API void XsMessage_insertData (XsMessage *thisPtr, XsSize count, XsSize offset)
 Create count bytes of empty space at offset in this message. More...
 
XSTYPES_DLL_API int XsMessage_isChecksumOk (XsMessage const *thisPtr)
 Returns non-zero if the checksum inside the message is correct for the message, zero otherwise. More...
 
XSTYPES_DLL_API void XsMessage_load (XsMessage *thisPtr, XsSize msgSize, unsigned char const *src)
 This function initializes the XsMessage object and reserves msgSize bytes for data, it then copies in the data from src. More...
 
XSTYPES_DLL_API void XsMessage_recomputeChecksum (XsMessage *thisPtr)
 Update the checksum for the message. More...
 
XSTYPES_DLL_API void XsMessage_resizeData (XsMessage *thisPtr, XsSize newSize)
 Resize the buffer of message to newSize bytes. More...
 
XSTYPES_DLL_API void XsMessage_setBusId (XsMessage *thisPtr, uint8_t busId)
 Set the bus id for this message to busId. More...
 
XSTYPES_DLL_API void XsMessage_setDataBuffer (XsMessage *thisPtr, const uint8_t *buffer, XsSize size, XsSize offset)
 Puts size number of bytes from buffer into the message at offset. More...
 
XSTYPES_DLL_API void XsMessage_setDataByte (XsMessage *thisPtr, uint8_t value, XsSize offset)
 Set the byte at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataDouble (XsMessage *thisPtr, double value, XsSize offset)
 Sets the double at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataF1220 (XsMessage *thisPtr, double value, XsSize offset)
 Sets the F12.20 at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataFloat (XsMessage *thisPtr, float value, XsSize offset)
 Sets the float at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataFP1632 (XsMessage *thisPtr, double value, XsSize offset)
 Sets the F16.32 at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataFPValuesById (XsMessage *thisPtr, XsDataIdentifier dataIdentifier, double const *data, XsSize offset, XsSize numValues)
 Write a number of floating/fixed point values into to the data buffer, conversion depends on outputSettings. More...
 
XSTYPES_DLL_API void XsMessage_setDataLong (XsMessage *thisPtr, uint32_t value, XsSize offset)
 Sets the long at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataLongLong (XsMessage *thisPtr, uint64_t value, XsSize offset)
 Sets the long at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setDataRealValuesById (XsMessage *thisPtr, XsDataIdentifier dataIdentifier, XsReal const *data, XsSize offset, XsSize numValues)
 Write a number of floating/fixed point values into to the data buffer, conversion depends on data identifier. More...
 
XSTYPES_DLL_API void XsMessage_setDataShort (XsMessage *thisPtr, uint16_t value, XsSize offset)
 Sets the short at offset in the message to value. More...
 
XSTYPES_DLL_API void XsMessage_setEndianCorrectData (XsMessage *thisPtr, void const *value, XsSize size, XsSize offset)
 Set value value of size size byteswapped at offset. More...
 
XSTYPES_DLL_API void XsMessage_setMessageId (XsMessage *thisPtr, XsXbusMessageId msgId)
 Set the message id for this message to msgId. More...
 
XSTYPES_DLL_API void XsMessage_swap (XsMessage *a, XsMessage *b)
 Swap the contents of a and b. More...
 
XSTYPES_DLL_API void XsMessage_toHexString (XsMessage const *thisPtr, XsSize maxBytes, XsString *resultValue)
 Return a string containing the first maxBytes bytes of the message in hex format. More...
 

Variables

XS_PACKED_STRUCT_START struct XsMessageHeader XS_PACKED_STRUCT
 

Macro Definition Documentation

◆ swapEndian16

#define swapEndian16 (   src)    (uint16_t)(((uint16_t)(src) >> 8) | ((uint16_t)(src) << 8))

Definition at line 721 of file xsmessage.h.

◆ swapEndian32

#define swapEndian32 (   src)    (uint32_t)(((uint32_t)(src) >> 24) | (((uint32_t)(src) >> 8) & 0xFF00) | (((uint32_t)(src) << 8) & 0xFF0000) | ((uint32_t)(src) << 24))

Definition at line 722 of file xsmessage.h.

◆ swapEndian64

#define swapEndian64 (   src)    (uint64_t)(((src >> 56) & 0xFFULL) | ((src >> 40) & 0xFF00ULL) | ((src >> 24) & 0xFF0000ULL) | ((src >> 8) & 0xFF000000ULL) | ((src << 8) & 0xFF00000000ULL) | ((src << 24) & 0xFF0000000000ULL) | ((src << 40) & 0xFF000000000000ULL) | ((src << 56)))

Definition at line 723 of file xsmessage.h.

◆ XS_EXTLENCODE

#define XS_EXTLENCODE   0xFF

Definition at line 145 of file xsmessage.h.

◆ XS_LEN_CHECKSUM

#define XS_LEN_CHECKSUM   1

Definition at line 151 of file xsmessage.h.

◆ XS_LEN_FLOAT

#define XS_LEN_FLOAT   4

Definition at line 154 of file xsmessage.h.

◆ XS_LEN_MSGEXTHEADER

#define XS_LEN_MSGEXTHEADER   6

Definition at line 148 of file xsmessage.h.

◆ XS_LEN_MSGEXTHEADERCS

#define XS_LEN_MSGEXTHEADERCS   7

Definition at line 150 of file xsmessage.h.

◆ XS_LEN_MSGHEADER

#define XS_LEN_MSGHEADER   4

Definition at line 147 of file xsmessage.h.

◆ XS_LEN_MSGHEADERCS

#define XS_LEN_MSGHEADERCS   5

Definition at line 149 of file xsmessage.h.

◆ XS_LEN_UNSIGINT

#define XS_LEN_UNSIGINT   4

Definition at line 153 of file xsmessage.h.

◆ XS_LEN_UNSIGSHORT

#define XS_LEN_UNSIGSHORT   2

Definition at line 152 of file xsmessage.h.

◆ XS_MAXDATALEN

#define XS_MAXDATALEN   (8192-XS_LEN_MSGEXTHEADERCS)

Definition at line 157 of file xsmessage.h.

◆ XS_MAXGARBAGE

#define XS_MAXGARBAGE   (XS_MAXMSGLEN+1)

Definition at line 161 of file xsmessage.h.

◆ XS_MAXMSGLEN

#define XS_MAXMSGLEN   (XS_MAXDATALEN+XS_LEN_MSGEXTHEADERCS)

Definition at line 159 of file xsmessage.h.

◆ XS_MAXSHORTDATALEN

#define XS_MAXSHORTDATALEN   254

Definition at line 158 of file xsmessage.h.

◆ XS_MAXSHORTMSGLEN

#define XS_MAXSHORTMSGLEN   (XS_MAXSHORTDATALEN+XS_LEN_MSGHEADERCS)

Definition at line 160 of file xsmessage.h.

◆ XS_PREAMBLE

#define XS_PREAMBLE   0xFA

Definition at line 144 of file xsmessage.h.

◆ XSMESSAGE_INITIALIZER

#define XSMESSAGE_INITIALIZER   { XSBYTEARRAY_INITIALIZER, 1, 0 }

Definition at line 84 of file xsmessage.h.

Typedef Documentation

◆ XsMessage

typedef struct XsMessage XsMessage

Definition at line 85 of file xsmessage.h.

◆ XsMessageHeader

Definition at line 86 of file xsmessage.h.

Function Documentation

◆ XsMessage_getFPValueSize()

XSTYPES_DLL_API uint8_t XsMessage_getFPValueSize ( XsDataIdentifier  id)
related

Variable Documentation

◆ XS_PACKED_STRUCT

XS_PACKED_STRUCT_START struct XsMessageHeader XS_PACKED_STRUCT


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:21