Arduino PulseWire Transceiver Library
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
pulsewire::IRProtocol Class Reference

IRProtocol: Represents a specific IR protocol with all its parameters. More...

#include <IRProtocol.h>

Inheritance diagram for pulsewire::IRProtocol:
Inheritance graph
[legend]
Collaboration diagram for pulsewire::IRProtocol:
Collaboration graph
[legend]

Public Member Functions

 IRProtocol (IRProtocolEnum proto, CodecEnum codecType, uint32_t frequency, size_t dataLength, uint32_t shortPulse, uint32_t longPulse, uint32_t tolerance, Vector< OutputEdge > edges)
 
void begin (IRProtocolEnum proto, uint32_t frequency, size_t dataLength, uint32_t shortPulse, uint32_t longPulse, uint32_t tolerance, Vector< OutputEdge > edges, CodecEnum codecType=CodecEnum::PulseDistance)
 Set all fields for this IR protocol, including preamble edges.
 
void copyFrom (const IRProtocol &other)
 Copy all fields from another IRProtocol instance.
 
virtual IRProtocolEnum getProtocolID () const
 Returns the protocol enum identifier for this IR protocol.
 
const charname () const
 
virtual int getEdges (Vector< OutputEdge > &output) const override
 Returns the preamble edges for this protocol.
 
virtual size_t preambleLength () const override
 Returns the number of edges in the preamble.
 
virtual uint32_t frequency () const
 Returns the carrier frequency in Hz.
 
virtual size_t dataLength () const
 Returns the expected data length in bytes (not including preamble)
 
virtual uint32_t shortPulseUs () const
 Returns the duration of the short pulse in microseconds.
 
virtual uint32_t longPulseUs () const
 Returns the duration of the long pulse in microseconds.
 
virtual uint32_t toleranceUs () const
 Tolerance in microseconds for pulse duration matching during detection.
 
virtual Codeccodec ()
 Provides the codec associated with this protocol.
 
virtual bool begin (uint16_t bitFrequencyHz)
 
void reset ()
 
virtual bool detect (const OutputEdge &edge)
 Detects if the incoming edge matches the expected preamble pattern.
 
bool inRange (uint32_t value, uint32_t target, uint32_t tolerance) const
 

Protected Attributes

pulsewire::Vector< pulsewire::OutputEdge_history
 
pulsewire::Vector< pulsewire::OutputEdge_expected
 

Detailed Description

IRProtocol: Represents a specific IR protocol with all its parameters.

Use one of the predefined static instances for common protocols:

Definition at line 124 of file IRProtocol.h.

Constructor & Destructor Documentation

◆ IRProtocol()

pulsewire::IRProtocol::IRProtocol ( IRProtocolEnum  proto,
CodecEnum  codecType,
uint32_t  frequency,
size_t  dataLength,
uint32_t  shortPulse,
uint32_t  longPulse,
uint32_t  tolerance,
Vector< OutputEdge edges 
)
inline

Definition at line 127 of file IRProtocol.h.

◆ ~IRProtocol()

pulsewire::IRProtocol::~IRProtocol ( )
inline

Definition at line 140 of file IRProtocol.h.

Member Function Documentation

◆ begin() [1/2]

void pulsewire::IRProtocol::begin ( IRProtocolEnum  proto,
uint32_t  frequency,
size_t  dataLength,
uint32_t  shortPulse,
uint32_t  longPulse,
uint32_t  tolerance,
Vector< OutputEdge edges,
CodecEnum  codecType = CodecEnum::PulseDistance 
)
inline

Set all fields for this IR protocol, including preamble edges.

Definition at line 148 of file IRProtocol.h.

◆ begin() [2/2]

virtual bool pulsewire::Preamble::begin ( uint16_t  bitFrequencyHz)
inlinevirtualinherited

Definition at line 44 of file Preamble.h.

◆ codec()

virtual Codec & pulsewire::IRProtocol::codec ( )
inlinevirtual

Provides the codec associated with this protocol.

Definition at line 205 of file IRProtocol.h.

◆ copyFrom()

void pulsewire::IRProtocol::copyFrom ( const IRProtocol other)
inline

Copy all fields from another IRProtocol instance.

Definition at line 165 of file IRProtocol.h.

◆ dataLength()

virtual size_t pulsewire::IRProtocol::dataLength ( ) const
inlinevirtual

Returns the expected data length in bytes (not including preamble)

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 197 of file IRProtocol.h.

◆ detect()

virtual bool pulsewire::Preamble::detect ( const OutputEdge edge)
inlinevirtualinherited

Detects if the incoming edge matches the expected preamble pattern.

Reimplemented in pulsewire::IRMultiProtocol, and pulsewire::NoPreamble.

Definition at line 52 of file Preamble.h.

◆ frequency()

virtual uint32_t pulsewire::IRProtocol::frequency ( ) const
inlinevirtual

Returns the carrier frequency in Hz.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 195 of file IRProtocol.h.

◆ getEdges()

virtual int pulsewire::IRProtocol::getEdges ( Vector< OutputEdge > &  output) const
inlineoverridevirtual

Returns the preamble edges for this protocol.

Implements pulsewire::Preamble.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 185 of file IRProtocol.h.

◆ getProtocolID()

virtual IRProtocolEnum pulsewire::IRProtocol::getProtocolID ( ) const
inlinevirtual

Returns the protocol enum identifier for this IR protocol.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 180 of file IRProtocol.h.

◆ inRange()

bool pulsewire::Preamble::inRange ( uint32_t  value,
uint32_t  target,
uint32_t  tolerance 
) const
inlineinherited

Utility function to check if a value is within a specified tolerance range of a target

Definition at line 95 of file Preamble.h.

◆ longPulseUs()

virtual uint32_t pulsewire::IRProtocol::longPulseUs ( ) const
inlinevirtual

Returns the duration of the long pulse in microseconds.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 201 of file IRProtocol.h.

◆ name()

const char * pulsewire::IRProtocol::name ( ) const
inline

Definition at line 182 of file IRProtocol.h.

◆ preambleLength()

virtual size_t pulsewire::IRProtocol::preambleLength ( ) const
inlineoverridevirtual

Returns the number of edges in the preamble.

Implements pulsewire::Preamble.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 193 of file IRProtocol.h.

◆ reset()

void pulsewire::Preamble::reset ( )
inlineinherited

Definition at line 49 of file Preamble.h.

◆ shortPulseUs()

virtual uint32_t pulsewire::IRProtocol::shortPulseUs ( ) const
inlinevirtual

Returns the duration of the short pulse in microseconds.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 199 of file IRProtocol.h.

◆ toleranceUs()

virtual uint32_t pulsewire::IRProtocol::toleranceUs ( ) const
inlinevirtual

Tolerance in microseconds for pulse duration matching during detection.

Reimplemented in pulsewire::IRMultiProtocol.

Definition at line 203 of file IRProtocol.h.

Field Documentation

◆ _expected

pulsewire::Vector<pulsewire::OutputEdge> pulsewire::Preamble::_expected
protectedinherited

Definition at line 102 of file Preamble.h.

◆ _history

pulsewire::Vector<pulsewire::OutputEdge> pulsewire::Preamble::_history
protectedinherited

Definition at line 101 of file Preamble.h.


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