MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Transitive::Protocol::IdleGapFramer Class Reference

Messages ended by a quiet period on the line, as in Modbus RTU. More...

#include <Framing.hpp>

Collaboration diagram for MayaFlux::Transitive::Protocol::IdleGapFramer:

Public Member Functions

size_t buffered () const noexcept
 Bytes held for a message that has not ended.
template<MessageSink Sink>
FrameReport flush (Sink &&sink)
 End the message in progress, delivering it, or ending a discard.
std::chrono::microseconds gap () const noexcept
 How long the line must stay quiet before the caller calls flush().
 IdleGapFramer (std::chrono::microseconds gap, size_t max_message=default_max_line) noexcept
template<MessageSink Sink>
FrameReport push (Message bytes, Sink &&)
void reset () noexcept
 Drop any partial message and any discard in progress.

Private Attributes

bool m_discarding { false }
std::chrono::microseconds m_gap
size_t m_max_message
std::vector< uint8_t > m_pending

Detailed Description

Messages ended by a quiet period on the line, as in Modbus RTU.

The framer reads no clock. push() only gathers bytes, and the caller ends the message by calling flush() once gap() has passed with no further push(), for example from a timer re-armed on every chunk. A message longer than max_message is dropped with FrameFault::Oversized, and the rest of that burst is ignored until flush().

Not thread safe: one thread at a time per framer, and flush() must not run concurrently with push().

Definition at line 782 of file Framing.hpp.


The documentation for this class was generated from the following file: