EV3UartProtocolParserSensorSide
|
This is a C++ parser library for the EV3 UART protocol, meant to decode messages that may arrive at the sensor side of the connection.
EV3UartGenerator/
/
(root folder of this library)EV3UartGenerator/
/
(root folder of this library)The EV3UartProtocolParserSensorSide::Parser accepts data, byte-by-byte from any UART backend that supplies data that is sent from the EV3 to the sensor.
The parse result is available from the EV3UartProtocolParserSensorSide::Parser::update() function as a ParserReturn structure:
The various fields in the EV3UartProtocolParserSensorSide::ParserReturn structure offers more information on what was parsed. EV3UartProtocolParserSensorSide::Parser::data() obtains the payload of the message sent from the EV3, if the header byte from the EV3 does not represent the entirety of the message (i.e. CMD_WRITE and CMD_SELECT messages)
If there is a need to reset the state of the parser, i.e. the connection between the EV3 and the sensor has been reset, the function EV3UartProtocolParserSensorSide::Parser::reset_state() can be called. The next byte parsed will be treated as a header byte.
For more information, see EV3UartProtocolParserSensorSide
This library uses the Catch2 testing framework: https://github.com/catchorg/Catch2
Tests are located under the test/
subfolder.
To build and run the tests,
test/
folder recursively to your build pathLicensed under the MIT license.
See LICENSE for more details.