Codec Wrapper that records all edges passed to decodeEdge() for later analysis or testing.
More...
#include <RecorderCodec.h>
|
| | RecorderCodec (Codec &ref) |
| |
| void | init (Preamble &detector, uint32_t shortPulseUs=600, uint32_t longPulseUs=1200, uint32_t toleranceUs=200) override |
| |
| void | setFrameSize (uint16_t size) |
| |
| bool | begin (uint32_t bitFrequencyHz) |
| | initialization method for codecs that require setup before use (e.g., loading PIO programs, configuring state machines).
|
| |
| CodecEnum | getCodecType () const override |
| |
| size_t | getEdgeCount () const |
| | Get the number of protocol symbols (bits, pulses, etc.) per encoded byte.
|
| |
| int | getEndOfFrameDelayUs () override |
| |
| Vector< OutputEdge > & | getRecordedEdges () |
| |
| void | clear () |
| |
| size_t | encode (uint8_t byte, Vector< OutputEdge > &output) override |
| | Fill output vector with protocol-specific OutputSpec(s) for a byte.
|
| |
| bool | decodeEdge (uint32_t durationUs, bool level, uint8_t &result) override |
| | Edge-based decoding for protocol-agnostic RX drivers.
|
| |
| virtual void | reset () |
| | Reset the internal state of the codec.
|
| |
| void | setPreamble (Preamble &preamble) |
| | Set the Preamble Detector object.
|
| |
| Preamble & | getPreamble () |
| | Get the preamble detector associated with this codec.
|
| |
| uint16_t | getFrameSize () const |
| | Get the configured frame size.
|
| |
| virtual bool | getIdleLevel () const |
| | Provides the initial ldle state (low or hith)
|
| |
| const char * | name () const |
| | Get the name of the codec type as a string (e.g., "PulseDistance", "Manchester").
|
| |
| size_t | encodePreamble (Vector< OutputEdge > &output) |
| |
| virtual size_t | flushEncoder (Vector< OutputEdge > &output) |
| | Flush any pending encoder state at end of frame.
|
| |
|
| virtual void | encodeByte (uint8_t byte, std::vector< bool > &bits) const |
| | Encode a byte to protocol bitstream. Default implementation encodes to raw bits (MSB first), but can be overridden by protocols that require different bit formatting (e.g., Manchester). The output bits are stored in.
|
| |
Codec Wrapper that records all edges passed to decodeEdge() for later analysis or testing.
Definition at line 11 of file RecorderCodec.h.
◆ RecorderCodec()
| pulsewire::RecorderCodec::RecorderCodec |
( |
Codec & |
ref | ) |
|
|
inline |
◆ begin()
| bool pulsewire::RecorderCodec::begin |
( |
uint32_t |
bitFrequencyHz | ) |
|
|
inlinevirtual |
initialization method for codecs that require setup before use (e.g., loading PIO programs, configuring state machines).
Reimplemented from pulsewire::Codec.
Definition at line 24 of file RecorderCodec.h.
◆ clear()
| void pulsewire::RecorderCodec::clear |
( |
| ) |
|
|
inline |
◆ decodeEdge()
Edge-based decoding for protocol-agnostic RX drivers.
Called on each signal edge (duration since last edge, new level, minUs, maxUs). The codec maintains its own state and assembles frames internally.
- Parameters
-
| durationUs | Time in microseconds since last edge. |
| level | New logic level after the edge (true = HIGH, false = LOW). |
| frameBuffer | Output buffer for decoded frame (if available). |
| frameBufferSize | Size of frameBuffer (bytes). |
| frameLen | Set to decoded frame length if a frame is available. |
- Returns
- True if a complete frame is decoded and available in frameBuffer.
Implements pulsewire::Codec.
Definition at line 43 of file RecorderCodec.h.
◆ encode()
Fill output vector with protocol-specific OutputSpec(s) for a byte.
Encodes the byte to protocol bits and appends OutputSpec(s) for each bit.
- Parameters
-
| byte | The byte to encode. |
| output | Vector to append OutputSpec(s). |
- Returns
- Number of OutputSpec entries added.
Implements pulsewire::Codec.
Definition at line 39 of file RecorderCodec.h.
◆ encodeByte()
|
|
inlineprotectedvirtualinherited |
Encode a byte to protocol bitstream. Default implementation encodes to raw bits (MSB first), but can be overridden by protocols that require different bit formatting (e.g., Manchester). The output bits are stored in.
- Parameters
-
| byte | The input byte to encode. |
| bits | Output buffer for encoded bits (protocol-specific format). |
Definition at line 204 of file Codec.h.
◆ encodePreamble()
◆ flushEncoder()
Flush any pending encoder state at end of frame.
Some codecs (e.g., Miller) accumulate pending duration that must be output at the end of the frame. This method outputs any remaining pending state. Default implementation does nothing.
- Parameters
-
| output | Vector to append OutputSpec(s). |
- Returns
- Number of OutputSpec entries added.
Reimplemented in pulsewire::MillerCodec.
Definition at line 185 of file Codec.h.
◆ getCodecType()
| CodecEnum pulsewire::RecorderCodec::getCodecType |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getEdgeCount()
| size_t pulsewire::RecorderCodec::getEdgeCount |
( |
| ) |
const |
|
inlinevirtual |
Get the number of protocol symbols (bits, pulses, etc.) per encoded byte.
- Returns
- Number of protocol symbols per byte.
Implements pulsewire::Codec.
Definition at line 31 of file RecorderCodec.h.
◆ getEndOfFrameDelayUs()
| int pulsewire::RecorderCodec::getEndOfFrameDelayUs |
( |
| ) |
|
|
inlineoverridevirtual |
◆ getFrameSize()
| uint16_t pulsewire::Codec::getFrameSize |
( |
| ) |
const |
|
inlineinherited |
Get the configured frame size.
Definition at line 120 of file Codec.h.
◆ getIdleLevel()
◆ getPreamble()
| Preamble & pulsewire::Codec::getPreamble |
( |
| ) |
|
|
inlineinherited |
Get the preamble detector associated with this codec.
- Returns
- Reference to the Preamble instance used for preamble detection.
Definition at line 100 of file Codec.h.
◆ getRecordedEdges()
◆ init()
◆ name()
| const char * pulsewire::Codec::name |
( |
| ) |
const |
|
inlineinherited |
Get the name of the codec type as a string (e.g., "PulseDistance", "Manchester").
Definition at line 135 of file Codec.h.
◆ reset()
◆ setFrameSize()
| void pulsewire::RecorderCodec::setFrameSize |
( |
uint16_t |
size | ) |
|
|
inline |
◆ setPreamble()
◆ _bitFrequencyHz
| uint16_t pulsewire::Codec::_bitFrequencyHz = 0 |
|
protectedinherited |
◆ _bitPeriodUs
| uint32_t pulsewire::Codec::_bitPeriodUs = 0 |
|
protectedinherited |
◆ _decodeEdgeStream
◆ _defaultPreamble
◆ _frameSize
| uint16_t pulsewire::Codec::_frameSize = 0 |
|
protectedinherited |
◆ _inFrame
◆ _preamble
| Preamble* pulsewire::Codec::_preamble = &_defaultPreamble |
|
protectedinherited |
◆ _recordedEdges
◆ _ref
| Codec& pulsewire::RecorderCodec::_ref |
|
protected |
The documentation for this class was generated from the following file: