FDO2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fdo2::LineAssembler Class Reference

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>

Public Member Functions

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
 

Detailed Description

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.

Member Function Documentation

◆ 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
byteThe byte.
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_lfWhether 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: