Pigweed
 
Loading...
Searching...
No Matches
pw::hdlc::Decoder Class Reference
Inheritance diagram for pw::hdlc::Decoder:
pw::hdlc::DecoderBuffer< kSizeBytes >

Public Member Functions

constexpr Decoder (ByteSpan buffer)
 
 Decoder (const Decoder &)=delete
 
Decoderoperator= (const Decoder &)=delete
 
 Decoder (Decoder &&)=default
 
Decoderoperator= (Decoder &&)=default
 
Result< FrameProcess (std::byte new_byte)
 Parses a single byte of an HDLC stream.
 
template<typename F , typename... Args>
void Process (ConstByteSpan data, F &&callback, Args &&... args)
 Processes a span of data and calls the provided callback with each frame or error.
 
size_t max_size () const
 
void Clear ()
 

Static Public Member Functions

static constexpr size_t RequiredBufferSizeForFrameSize (size_t max_frame_size)
 

Member Function Documentation

◆ Process()

Result< Frame > pw::hdlc::Decoder::Process ( std::byte  new_byte)

Parses a single byte of an HDLC stream.

Returns
embed:rst:leading-asterisk
 
*  A ``pw::Result`` with the complete frame if the byte completes a
*  frame. The status can be one of the following:
* 
*  .. pw-status-codes::
* 
*     OK: A frame was successfully decoded. The ``Result`` contains
*     the ``Frame``, which is invalidated by the next ``Process()`` call.
* 
*     UNAVAILABLE: No frame is available.
* 
*     RESOURCE_EXHAUSTED: A frame completed, but it was too large
*     to fit in the decoder's buffer.
* 
*     DATA_LOSS: A frame completed, but it was invalid. The frame
*     was incomplete or the frame check sequence verification failed.
* 
*  

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