Collects the bytes of a reply into lines, one byte at a time (datasheet 4.1: one CR ends a reply).
More...
#include <fdo2_protocol.hpp>
|
|
constexpr | LineAssembler () noexcept=default |
| | An empty assembler that ignores a leading LF.
|
| |
| constexpr void | Reset (bool ignore_lf) noexcept |
| | Drop the partial line and the discard state.
|
| |
| constexpr PushResult | PushByte (uint8_t byte) noexcept |
| | Feed one byte.
|
| |
| constexpr std::span< const char > | Line () const noexcept |
| |
| constexpr uint32_t | TakeDiscarded () noexcept |
| |
| constexpr bool | Discarding () const noexcept |
| |
| constexpr std::size_t | Pending () const noexcept |
| |
Collects the bytes of a reply into lines, one byte at a time (datasheet 4.1: one CR ends a reply).
A byte outside 0x20 to 0x7E other than CR (a LF at the start of a line is dropped when ignore_lf), or 800 characters without a CR, makes PushByte() return Bad once; the rest of that line is discarded up to the next CR (resynchronisation) and counted. A line is never delivered without its CR; an empty line (CR alone) is ignored.
◆ Discarding()
| constexpr bool fdo2::LineAssembler::Discarding |
( |
| ) |
const |
|
inlineconstexprnoexcept |
- Returns
- true while the rest of a bad line is being discarded.
◆ Line()
| constexpr std::span< const char > fdo2::LineAssembler::Line |
( |
| ) |
const |
|
inlineconstexprnoexcept |
- Returns
- The line completed by the last
Line result; valid until the next PushByte().
◆ Pending()
| constexpr std::size_t fdo2::LineAssembler::Pending |
( |
| ) |
const |
|
inlineconstexprnoexcept |
- Returns
- The characters of the partial line.
◆ PushByte()
| constexpr PushResult fdo2::LineAssembler::PushByte |
( |
uint8_t |
byte | ) |
|
|
inlineconstexprnoexcept |
Feed one byte.
- Parameters
-
- Returns
Pending, Line or Bad.
◆ Reset()
| constexpr void fdo2::LineAssembler::Reset |
( |
bool |
ignore_lf | ) |
|
|
inlineconstexprnoexcept |
Drop the partial line and the discard state.
- Parameters
-
| ignore_lf | Whether a LF at the start of a line is dropped. |
◆ TakeDiscarded()
| constexpr uint32_t fdo2::LineAssembler::TakeDiscarded |
( |
| ) |
|
|
inlineconstexprnoexcept |
- Returns
- The number of bytes discarded while resynchronising since the last
TakeDiscarded().
The documentation for this class was generated from the following file: