![]() |
GM6000 Digital Heater Controller Build: 20 (Branch = develop)
SDX-1330
|
This class defines an interface for 'transmitted' (encoding) a frame. More...
This class defines an interface for 'transmitted' (encoding) a frame.
What is a frame ? See the Decoder API for the detailed answer to this question. The Encoder interface will consume a raw sequence of characters and properly insert (when necessary) the framing characters to construct a valid frame. Below are some examples some framed sequences of characters:
Given:
SOF:= '.'
EOF:= ';'
ESC:= '~'
Raw Stream Encoded Sequence(s)
----------- --------------------
"abcde" ".abcde;"
"a" ".a;"
"" ".;"
"a;bcd" ";a~;bcd;"
"~" ".~~;"
".abc" "..abc;"
Notes:
o The quotes (") in the above example are NOT part of the frame
and/or character sequences - the quotes are only used to
illustrate sets of characters.
o The SOF character does not need to be escaped within a frame
because once a SOF has been found - the SOF character is NOT
looked/scanned for until after an EOF character has been
detected. Escaping an SOF character within a frame will
behave as expected, i.e. same behavior/semantics as escaping
the EOF character.
#include <Encoder.h>
Public Member Functions | |
| virtual bool | startFrame (void) noexcept=0 |
| Begins the frame. | |
| virtual bool | output (char src) noexcept=0 |
| Outputs the single character to the output destination. | |
| virtual bool | output (const char *src) noexcept=0 |
| Outputs the null terminated string to the output destination. | |
| virtual bool | output (const char *src, size_t numBytes) noexcept=0 |
| Outputs 'numBytes' of data (from 'src') to the output destination. | |
| virtual bool | endFrame (void) noexcept=0 |
| Ends the frame. | |
| virtual | ~Encoder () |
| Virtual Destructor. | |
|
inlinevirtual |
Virtual Destructor.
|
pure virtualnoexcept |
Ends the frame.
The method will return false if there an error occurred while writing to the output destination; else true is returned. If this method is called twice - without an intervening call to startFrame() - a Fatal error is generated
Implemented in Cpl::Text::Frame::BlockEncoder, and Cpl::Text::Frame::Encoder_.
|
pure virtualnoexcept |
Outputs the single character to the output destination.
The method will return false if there an error occurred while writing to the output destination; else true is returned. If this method is called without a previous call to startFrame(), i.e. the frame has NOT been started, a Fatal error is generated
Implemented in Cpl::Text::Frame::Encoder_.
|
pure virtualnoexcept |
Outputs the null terminated string to the output destination.
The method will return false if there an error occurred while writing to the output destination; else true is returned. If this method is called without a previous call to startFrame(), i.e. the frame has NOT been started, a Fatal error is generated
Implemented in Cpl::Text::Frame::Encoder_.
|
pure virtualnoexcept |
Outputs 'numBytes' of data (from 'src') to the output destination.
The method will return false if there an error occurred while writing to the output destination; else true is returned. If this method is called without a previous call to startFrame(), i.e. the frame has NOT been started, a Fatal error is generated
Implemented in Cpl::Text::Frame::Encoder_.
|
pure virtualnoexcept |
Begins the frame.
The method will return false if there an error occurred while writing to the output destination; else true is returned. If this method is called twice - without an intervening call to endFrame() - a Fatal error is generated
Implemented in Cpl::Text::Frame::Encoder_.