Go to the documentation of this file.
101 int bufferSize = (int)raw.size();
105 const unsigned char* buffer = raw.data();
107 bool foundPreamble =
false;
108 bool foundEnd =
false;
111 for (
int i = 0; i < bufferSize; i++)
117 foundPreamble =
true;
123 if ((buffer[i] ==
LF) && (buffer[i - 1] ==
CR))
130 if ((i -
start) == 1 && (i + 9) < bufferSize)
136 foundPreamble =
false;
139 if (foundPreamble && foundEnd)
struct XsMessage XsMessage
A list of uint8_t values.
const unsigned char AFTER_PREAMBLE_EM1000
MessageLocation findMessage(XsProtocolType &type, const XsByteArray &raw) const override
Find the first message in the raw byte stream.
static const int MAXIMUM_MESSAGE_SIZE
@ XPT_Nmea
The NMEA protocol, only the messages that can be sent from Xsens devices are recognized.
int type() const override
int m_size
The size of the message, when less than 0 it indicates the expected message size.
Structure for storing a single message.
const char PREAMBLE_EM1000
static const int MINIMUM_MESSAGE_SIZE
ProtocolHandler()
Default constructor.
virtual ~ProtocolHandler()
Deafult destructor.
XsProtocolType
Protocol types (XsDevice::enableProtocol())
int minimumMessageSize() const override
XsMessage convertToMessage(MessageLocation &location, const XsByteArray &raw) const override
Converts raw data using location into a XsMessage object.
Stores the location of a message in a buffer using a start position and a size.
int m_startPos
The offset of the first byte of the message or -1 if no message.
int maximumMessageSize() const override