|
Open Model Railroad Network (OpenMRN)
|
Parses a sequence of characters; finds GridConnect protocol packet boundaries in the sequence of packets. More...
#include <GcStreamParser.hxx>
Public Member Functions | |
| bool | consume_byte (char c) |
| Adds the next character from the source stream. | |
| bool | parse_frame_to_output (struct can_frame *output_frame) |
| Parses the current contents of the frame buffer to a can_frame struct. | |
| void | frame_buffer (std::string *payload) |
Private Attributes | |
| char | cbuf_ [32] |
| Collects data from a partial GC packet. | |
| int | offset_ |
| offset of next byte in cbuf to write. | |
Parses a sequence of characters; finds GridConnect protocol packet boundaries in the sequence of packets.
Contains an internal buffer holding the partial (or last found) gridconnect packet.
This class is not thread-safe, but thread-compatible.
Definition at line 47 of file GcStreamParser.hxx.
|
inline |
Definition at line 50 of file GcStreamParser.hxx.
| bool GcStreamParser::consume_byte | ( | char | c | ) |
Adds the next character from the source stream.
| c | next character. |
Definition at line 40 of file GcStreamParser.cxx.
| void GcStreamParser::frame_buffer | ( | std::string * | payload | ) |
| payload | fills with the current contents of the frame buffer. |
Definition at line 78 of file GcStreamParser.cxx.
| bool GcStreamParser::parse_frame_to_output | ( | struct can_frame * | output_frame | ) |
Parses the current contents of the frame buffer to a can_frame struct.
Should be called if and inly if the previous consume_char call returned true.
| output_frame | is an output argument, non-NULL, into this we will be writing the binary frame. |
Definition at line 86 of file GcStreamParser.cxx.
|
private |
Collects data from a partial GC packet.
Definition at line 74 of file GcStreamParser.hxx.
|
private |
offset of next byte in cbuf to write.
Definition at line 76 of file GcStreamParser.hxx.