Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
IrSignal Class Reference

This class models an IR signal with intro-, repeat-, and ending sequences. More...

#include <IrSignal.h>

Public Member Functions

 IrSignal ()
 Constructs an empty IrSignal. More...
 
 IrSignal (const IrSignal &orig)=default
 
 IrSignal (IrSignal &&orig)=default
 
IrSignaloperator= (const IrSignal &rhs)=default
 
IrSignaloperator= (IrSignal &&rhs)=default
 
virtual ~IrSignal ()=default
 
 IrSignal (const microseconds_t *intro, size_t lengthIntro, const microseconds_t *repeat, size_t lengthRepeat, const microseconds_t *ending, size_t lengthEnding, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Constructor that "moves" the data pointers. More...
 
 IrSignal (const microseconds_t *intro, size_t lengthIntro, const microseconds_t *repeat, size_t lengthRepeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Constructor that "moves" the data pointers. More...
 
 IrSignal (const IrSequence &intro, const IrSequence &repeat, const IrSequence &ending, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Copy constructor. More...
 
 IrSignal (IrSequence &&intro, IrSequence &&repeat, IrSequence &&ending, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Move constructor. More...
 
 IrSignal (const IrSequence &intro, const IrSequence &repeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Copy constructors for IrSignals without ending sequence. More...
 
 IrSignal (IrSequence &&intro, IrSequence &&repeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 Move constructor for IrSignals without ending sequence. More...
 
frequency_t getFrequency () const
 
dutycycle_t getDutyCycle () const
 
const IrSequencegetEnding () const
 
const IrSequencegetRepeat () const
 
const IrSequencegetIntro () const
 
 operator bool () const
 True if and only if at least one of the sequences is true (= non-empty). More...
 
void dump (Stream &stream, bool usingSigns=false) const
 Print a human readable representation of the IrSignal on the Stream supplied. More...
 
void dumpWithSigns (Stream &stream) const
 Print a human readable representation of the IrSignal on the Stream supplied, using signs. More...
 
bool dumpFrequency (Stream &stream) const
 If the frequency is sensible, print it to the stream and return true. More...
 
bool dumpDutyCycle (Stream &stream) const
 If the duty cycle is sensible, print it to the stream and return true. More...
 
unsigned int noRepetitions (unsigned int noSends) const
 Implementation of the count semantics, i.e., how many repetitions should be sent if the signal is sent noSend times. More...
 

Static Public Member Functions

static IrSignalreadFlash (const microseconds_t *intro, size_t lengthIntro, const microseconds_t *repeat, size_t lengthRepeat, const microseconds_t *ending, size_t lengthEnding, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 
static IrSignalreadFlash (const microseconds_t *intro, size_t lengthIntro, const microseconds_t *repeat, size_t lengthRepeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle)
 
static bool dumpFrequency (Stream &stream, frequency_t frequency)
 Static version of dumpFrequency. More...
 
static bool dumpDutyCycle (Stream &stream, dutycycle_t dutyCycle)
 Static version of dumpDutyCycle. More...
 

Static Public Attributes

static constexpr frequency_t defaultFrequency = 38000U
 
static constexpr frequency_t invalidFrequency = static_cast<frequency_t>(-1)
 
static constexpr dutycycle_t noDutyCycle = static_cast<dutycycle_t>(-1)
 
static constexpr dutycycle_t defaultDutyCycle = noDutyCycle
 
static constexpr const char * version = VERSION
 

Detailed Description

This class models an IR signal with intro-, repeat-, and ending sequences.

This class is immutable.

Definition at line 11 of file IrSignal.h.

Constructor & Destructor Documentation

◆ IrSignal() [1/9]

IrSignal::IrSignal ( )
inline

Constructs an empty IrSignal.

Definition at line 32 of file IrSignal.h.

◆ IrSignal() [2/9]

IrSignal::IrSignal ( const IrSignal orig)
default

◆ IrSignal() [3/9]

IrSignal::IrSignal ( IrSignal &&  orig)
default

◆ ~IrSignal()

virtual IrSignal::~IrSignal ( )
virtualdefault

◆ IrSignal() [4/9]

IrSignal::IrSignal ( const microseconds_t intro,
size_t  lengthIntro,
const microseconds_t repeat,
size_t  lengthRepeat,
const microseconds_t ending,
size_t  lengthEnding,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Constructor that "moves" the data pointers.

This is essentially a convenience function that combines IrSequence and IrSignal constructors.

Parameters
intro
lengthIntro
repeat
lengthRepeat
ending
lengthEnding
frequency
dutyCycle

Definition at line 24 of file IrSignal.cpp.

◆ IrSignal() [5/9]

IrSignal::IrSignal ( const microseconds_t intro,
size_t  lengthIntro,
const microseconds_t repeat,
size_t  lengthRepeat,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Constructor that "moves" the data pointers.

No ending sequence. This is essentially a convenience function that combines IrSequence and IrSignal constructors.

Parameters
intro
lengthIntro
repeat
lengthRepeat
frequency
dutyCycle

Definition at line 35 of file IrSignal.cpp.

◆ IrSignal() [6/9]

IrSignal::IrSignal ( const IrSequence intro,
const IrSequence repeat,
const IrSequence ending,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Copy constructor.

Parameters
intro
repeat
ending
frequency
dutyCycle

Definition at line 4 of file IrSignal.cpp.

◆ IrSignal() [7/9]

IrSignal::IrSignal ( IrSequence &&  intro,
IrSequence &&  repeat,
IrSequence &&  ending,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Move constructor.

Parameters
intro
repeat
ending
frequency
dutyCycle

Definition at line 9 of file IrSignal.cpp.

◆ IrSignal() [8/9]

IrSignal::IrSignal ( const IrSequence intro,
const IrSequence repeat,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Copy constructors for IrSignals without ending sequence.

Parameters
intro
repeat
frequency
dutyCycle

Definition at line 14 of file IrSignal.cpp.

◆ IrSignal() [9/9]

IrSignal::IrSignal ( IrSequence &&  intro,
IrSequence &&  repeat,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)

Move constructor for IrSignals without ending sequence.

Parameters
intro
repeat
frequency
dutyCycle

Definition at line 19 of file IrSignal.cpp.

Member Function Documentation

◆ dump()

void IrSignal::dump ( Stream &  stream,
bool  usingSigns = false 
) const

Print a human readable representation of the IrSignal on the Stream supplied.

Parameters
streamStream onto the output is printed.
usingSignsis true, prepend marks with '+' and gaps with '-'.

Definition at line 68 of file IrSignal.cpp.

◆ dumpDutyCycle() [1/2]

bool IrSignal::dumpDutyCycle ( Stream &  stream) const
inline

If the duty cycle is sensible, print it to the stream and return true.

Otherwise do nothing and return false. No extra spaces or line feeds are generated.

Parameters
streamStream onto the output is printed.

Definition at line 193 of file IrSignal.h.

◆ dumpDutyCycle() [2/2]

bool IrSignal::dumpDutyCycle ( Stream &  stream,
dutycycle_t  dutyCycle 
)
static

Static version of dumpDutyCycle.

Parameters
streamStream onto the output is printed.
dutyCycle

Definition at line 89 of file IrSignal.cpp.

◆ dumpFrequency() [1/2]

bool IrSignal::dumpFrequency ( Stream &  stream) const
inline

If the frequency is sensible, print it to the stream and return true.

Otherwise do nothing and return false. No extra spaces or line feeds are generated.

Definition at line 176 of file IrSignal.h.

◆ dumpFrequency() [2/2]

bool IrSignal::dumpFrequency ( Stream &  stream,
frequency_t  frequency 
)
static

Static version of dumpFrequency.

Parameters
streamStream onto the output is printed.
frequencymodulation frequency

Definition at line 80 of file IrSignal.cpp.

◆ dumpWithSigns()

void IrSignal::dumpWithSigns ( Stream &  stream) const
inline

Print a human readable representation of the IrSignal on the Stream supplied, using signs.

Parameters
streamStream onto the output is printed.

Definition at line 167 of file IrSignal.h.

◆ getDutyCycle()

dutycycle_t IrSignal::getDutyCycle ( ) const
inline

Definition at line 134 of file IrSignal.h.

◆ getEnding()

const IrSequence & IrSignal::getEnding ( ) const
inline

Definition at line 138 of file IrSignal.h.

◆ getFrequency()

frequency_t IrSignal::getFrequency ( ) const
inline

Definition at line 130 of file IrSignal.h.

◆ getIntro()

const IrSequence & IrSignal::getIntro ( ) const
inline

Definition at line 146 of file IrSignal.h.

◆ getRepeat()

const IrSequence & IrSignal::getRepeat ( ) const
inline

Definition at line 142 of file IrSignal.h.

◆ noRepetitions()

unsigned int IrSignal::noRepetitions ( unsigned int  noSends) const
inline

Implementation of the count semantics, i.e., how many repetitions should be sent if the signal is sent noSend times.

Parameters
noSendsnumber of times to "send signal".

Definition at line 209 of file IrSignal.h.

◆ operator bool()

IrSignal::operator bool ( ) const
inline

True if and only if at least one of the sequences is true (= non-empty).

Returns

Definition at line 154 of file IrSignal.h.

◆ operator=() [1/2]

IrSignal & IrSignal::operator= ( const IrSignal rhs)
default

◆ operator=() [2/2]

IrSignal & IrSignal::operator= ( IrSignal &&  rhs)
default

◆ readFlash() [1/2]

static IrSignal * IrSignal::readFlash ( const microseconds_t intro,
size_t  lengthIntro,
const microseconds_t repeat,
size_t  lengthRepeat,
const microseconds_t ending,
size_t  lengthEnding,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)
static

◆ readFlash() [2/2]

static IrSignal * IrSignal::readFlash ( const microseconds_t intro,
size_t  lengthIntro,
const microseconds_t repeat,
size_t  lengthRepeat,
frequency_t  frequency = defaultFrequency,
dutycycle_t  dutyCycle = defaultDutyCycle 
)
static

Member Data Documentation

◆ defaultDutyCycle

constexpr dutycycle_t IrSignal::defaultDutyCycle = noDutyCycle
staticconstexpr

Definition at line 16 of file IrSignal.h.

◆ defaultFrequency

constexpr frequency_t IrSignal::defaultFrequency = 38000U
staticconstexpr

Definition at line 13 of file IrSignal.h.

◆ invalidFrequency

constexpr frequency_t IrSignal::invalidFrequency = static_cast<frequency_t>(-1)
staticconstexpr

Definition at line 14 of file IrSignal.h.

◆ noDutyCycle

constexpr dutycycle_t IrSignal::noDutyCycle = static_cast<dutycycle_t>(-1)
staticconstexpr

Definition at line 15 of file IrSignal.h.

◆ version

constexpr const char* IrSignal::version = VERSION
staticconstexpr

Definition at line 17 of file IrSignal.h.


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