TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES > Class Template Reference

Receives the packets of a PacketEncoder: the written bytes (e.g. the output of a modem decoder) are deframed, corrected and checked, and the payload of the valid packets is written to the output. More...

#include <PacketStream.h>

Inheritance diagram for tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >:
Collaboration diagram for tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >:

Public Member Functions

 PacketDecoder ()=default
 PacketDecoder (Print &out)
void setOutput (Print &out)
size_t write (uint8_t ch) override
size_t write (const uint8_t *data, size_t len) override
const PacketStatistics & statistics () const
 Statistics of the received packets.
void reset ()
 Resets the statistics and drops an incomplete frame.

Protected Member Functions

void processFrame ()

Protected Attributes

Print * p_out = nullptr
uint8_t frame [MAX_FRAME]
int frame_len = 0
bool overflow = false
bool escaped = false
PacketStatistics stats
RS::ReedSolomon< MSG_LEN, ECC_BYTES > rs

Static Protected Attributes

static constexpr int MSG_LEN = MAX_PAYLOAD + PacketFormat::CRC_BYTES
static constexpr int MAX_FRAME = MSG_LEN + ECC_BYTES

Detailed Description

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
class tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >

Receives the packets of a PacketEncoder: the written bytes (e.g. the output of a modem decoder) are deframed, corrected and checked, and the payload of the valid packets is written to the output.

Template Parameters
MAX_PAYLOADmust be the same as in the PacketEncoder
ECC_BYTESmust be the same as in the PacketEncoder

Constructor & Destructor Documentation

◆ PacketDecoder() [1/2]

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::PacketDecoder ( )
default

◆ PacketDecoder() [2/2]

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::PacketDecoder ( Print & out)
inline

Member Function Documentation

◆ processFrame()

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
void tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::processFrame ( )
inlineprotected

◆ reset()

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
void tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::reset ( )
inline

Resets the statistics and drops an incomplete frame.

◆ setOutput()

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
void tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::setOutput ( Print & out)
inline

◆ statistics()

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
const PacketStatistics & tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::statistics ( ) const
inline

Statistics of the received packets.

◆ write() [1/2]

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
size_t tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::write ( const uint8_t * data,
size_t len )
inlineoverride

◆ write() [2/2]

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
size_t tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::write ( uint8_t ch)
inlineoverride

Member Data Documentation

◆ escaped

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
bool tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::escaped = false
protected

◆ frame

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
uint8_t tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::frame[MAX_FRAME]
protected

◆ frame_len

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
int tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::frame_len = 0
protected

◆ MAX_FRAME

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
int tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::MAX_FRAME = MSG_LEN + ECC_BYTES
staticconstexprprotected

◆ MSG_LEN

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
int tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::MSG_LEN = MAX_PAYLOAD + PacketFormat::CRC_BYTES
staticconstexprprotected

◆ overflow

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
bool tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::overflow = false
protected

◆ p_out

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
Print* tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::p_out = nullptr
protected

◆ rs

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
RS::ReedSolomon<MSG_LEN, ECC_BYTES> tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::rs
protected

◆ stats

template<uint8_t MAX_PAYLOAD = 64, uint8_t ECC_BYTES = 16>
PacketStatistics tinymodem::PacketDecoder< MAX_PAYLOAD, ECC_BYTES >::stats
protected

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