COSA
An Object-Oriented Platform for Arduino Programming
VWI::Codec Class Referenceabstract

#include <VWI.hh>

Inheritance diagram for VWI::Codec:
Inheritance graph
Collaboration diagram for VWI::Codec:
Collaboration graph

Public Member Functions

 Codec (uint8_t bits_per_symbol, uint16_t start_symbol, uint8_t preamble_max=VWI::Transmitter::PREAMBLE_MAX)
 
virtual const uint8_t * preamble ()=0
 
virtual uint8_t encode4 (uint8_t nibble)=0
 
virtual uint8_t decode4 (uint8_t symbol)=0
 
virtual uint8_t decode8 (uint16_t symbol)
 

Public Attributes

const uint8_t BITS_PER_SYMBOL
 
const uint16_t START_SYMBOL
 
const uint8_t PREAMBLE_MAX
 
const uint8_t SYMBOL_MASK
 
const uint16_t BITS_MSB
 

Detailed Description

The Virtual Wire Codec; define message preamble and start symbol. Supports encode and decoding of data to transmission symbols. Cosa support several transmission codecs. They may be used to optimize performance in a given scenario; speed, noise, message length, etc.

Definition at line 73 of file VWI.hh.

Constructor & Destructor Documentation

VWI::Codec::Codec ( uint8_t  bits_per_symbol,
uint16_t  start_symbol,
uint8_t  preamble_max = VWI::Transmitter::PREAMBLE_MAX 
)

Construct Codec with given symbol and preamble definition. The Codec is assumed to code 4 bits to max 8 bit symbol for transmission.

Parameters
[in]bits_per_symbol.
[in]start_symbol.
[in]preamble_max.

Definition at line 59 of file VWI.cpp.

Member Function Documentation

virtual uint8_t VWI::Codec::decode4 ( uint8_t  symbol)
pure virtual

Decode symbol back to 4 bits (nibble) of data.

Parameters
[in]symbolto decode.
Returns
data.

Implemented in HammingCodec_7_4, HammingCodec_8_4, BitstuffingCodec, Block4B5BCodec, ManchesterCodec, and VirtualWireCodec.

virtual uint8_t VWI::Codec::decode8 ( uint16_t  symbol)
inlinevirtual

Decode two packed symbols (max 16-bit) back to 8 bits (byte) of data.

Parameters
[in]symbolto decode.
Returns
data.

Definition at line 136 of file VWI.hh.

virtual uint8_t VWI::Codec::encode4 ( uint8_t  nibble)
pure virtual

Encode 4 bits (nibble) to a symbol with BITS_PER_SYMBOL.

Parameters
[in]nibbledata to encode.
Returns
symbol.

Implemented in HammingCodec_7_4, HammingCodec_8_4, BitstuffingCodec, Block4B5BCodec, ManchesterCodec, and VirtualWireCodec.

virtual const uint8_t* VWI::Codec::preamble ( )
pure virtual

Provide pointer to frame preamble in program memory. PREAMBLE_MAX should contain the length of the preamble including start symbol.

Returns
pointer to program memory.

Implemented in HammingCodec_7_4, HammingCodec_8_4, BitstuffingCodec, VirtualWireCodec, Block4B5BCodec, and ManchesterCodec.

Member Data Documentation

const uint16_t VWI::Codec::BITS_MSB

Symbol MSB.

Definition at line 91 of file VWI.hh.

const uint8_t VWI::Codec::BITS_PER_SYMBOL

Bits per symbol.

Definition at line 76 of file VWI.hh.

const uint8_t VWI::Codec::PREAMBLE_MAX

Size of preamble with start symbol. Should be less or equal to Transmitter::PREAMBLE_MAX.

Definition at line 85 of file VWI.hh.

const uint16_t VWI::Codec::START_SYMBOL

Start symbol.

Definition at line 79 of file VWI.hh.

const uint8_t VWI::Codec::SYMBOL_MASK

Symbol mask.

Definition at line 88 of file VWI.hh.


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