semf
semf::app::ErrorCorrectionCode Class Referenceabstract

Interface for error correction code implementations. More...

#include <errorcorrectioncode.h>

Collaboration diagram for semf::app::ErrorCorrectionCode:
Collaboration graph

Public Member Functions

virtual ~ErrorCorrectionCode ()=default
 
virtual size_t encode (const uint8_t data[], size_t dataBitSize, uint8_t buffer[], size_t bufferSize) const =0
 Add ecc bits to the data and write them to the buffer. More...
 
virtual size_t decode (const uint8_t data[], size_t dataSize, uint8_t buffer[], size_t bufferSize) const =0
 Remove ecc bits from the data, corrects bit errors and write them to the buffer. More...
 
virtual size_t blockBitSize (size_t messageBitSize) const =0
 Calculates the size of the bits which are needed to store a certain amount of bits with ecc. More...
 

Public Attributes

Signal< Errorerror
 

Detailed Description

Interface for error correction code implementations.

Definition at line 24 of file errorcorrectioncode.h.

Constructor & Destructor Documentation

◆ ~ErrorCorrectionCode()

virtual semf::app::ErrorCorrectionCode::~ErrorCorrectionCode ( )
virtualdefault

Member Function Documentation

◆ blockBitSize()

virtual size_t semf::app::ErrorCorrectionCode::blockBitSize ( size_t  messageBitSize) const
pure virtual

Calculates the size of the bits which are needed to store a certain amount of bits with ecc.

Parameters
messageBitSizeBit size of message without ecc bits.
Returns
The bits which are needed to store the message bits with ecc.

◆ decode()

virtual size_t semf::app::ErrorCorrectionCode::decode ( const uint8_t  data[],
size_t  dataSize,
uint8_t  buffer[],
size_t  bufferSize 
) const
pure virtual

Remove ecc bits from the data, corrects bit errors and write them to the buffer.

Parameters
dataData including ecc bits.
dataSizeThe size of data.
bufferBuffer for storing the corrected data without ecc bits.
bufferSizeThe size of the buffer.
Returns
The number of bits that have been written into the buffer.

◆ encode()

virtual size_t semf::app::ErrorCorrectionCode::encode ( const uint8_t  data[],
size_t  dataBitSize,
uint8_t  buffer[],
size_t  bufferSize 
) const
pure virtual

Add ecc bits to the data and write them to the buffer.

Parameters
dataData which should be encoded.
dataBitSizeThe size of the data.
bufferThe buffer for storing the data including ecc bits.
bufferSizeThe size of the buffer.
Returns
The number of bits that have been written into the buffer.

Member Data Documentation

◆ error

Signal<Error> semf::app::ErrorCorrectionCode::error

Signal is emitted after an error occurred.

Definition at line 55 of file errorcorrectioncode.h.