Infrared4Arduino  1.1.0
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 ()
 
 IrSignal (const IrSignal &orig)
 
virtual ~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, bool toBeFreed=false)
 
 IrSignal (const microseconds_t *intro, size_t lengthIntro, const microseconds_t *repeat, size_t lengthRepeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle, bool toBeFreed=false)
 
 IrSignal (const IrSequence &intro, const IrSequence &repeat, const IrSequence &ending, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle, bool toBeFreed=true)
 
 IrSignal (const IrSequence &intro, const IrSequence &repeat, frequency_t frequency=defaultFrequency, dutycycle_t dutyCycle=defaultDutyCycle, bool toBeFreed=true)
 
IrSignalclone () const
 Creates a (deep) copy of the current object. More...
 
frequency_t getFrequency () const
 
dutycycle_t getDutyCycle () const
 
const IrSequencegetEnding () const
 
const IrSequencegetRepeat () const
 
const IrSequencegetIntro () const
 
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 const frequency_t defaultFrequency = 38000U
 
static const frequency_t invalidFrequency = (frequency_t) -1
 
static const dutycycle_t noDutyCycle = -1
 

Detailed Description

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

This class is immutable.

Definition at line 10 of file IrSignal.h.

Constructor & Destructor Documentation

◆ IrSignal() [1/6]

IrSignal::IrSignal ( )

◆ IrSignal() [2/6]

IrSignal::IrSignal ( const IrSignal orig)

Definition at line 14 of file IrSignal.cpp.

◆ ~IrSignal()

IrSignal::~IrSignal ( )
virtual

Definition at line 39 of file IrSignal.cpp.

◆ IrSignal() [3/6]

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,
bool  toBeFreed = false 
)

Definition at line 18 of file IrSignal.cpp.

◆ IrSignal() [4/6]

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

Definition at line 29 of file IrSignal.cpp.

◆ IrSignal() [5/6]

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

Definition at line 4 of file IrSignal.cpp.

◆ IrSignal() [6/6]

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

Definition at line 9 of file IrSignal.cpp.

Member Function Documentation

◆ clone()

IrSignal * IrSignal::clone ( ) const

Creates a (deep) copy of the current object.

The user must delete it manually.

Returns
Pointer to the cloned object.

Definition at line 68 of file IrSignal.cpp.

◆ 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 72 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.
frequencymodulation frequency

Definition at line 126 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.
frequencymodulation frequency

Definition at line 93 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 108 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 84 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 99 of file IrSignal.h.

◆ getDutyCycle()

dutycycle_t IrSignal::getDutyCycle ( ) const
inline

Definition at line 72 of file IrSignal.h.

◆ getEnding()

const IrSequence& IrSignal::getEnding ( ) const
inline

Definition at line 76 of file IrSignal.h.

◆ getFrequency()

frequency_t IrSignal::getFrequency ( ) const
inline

Definition at line 68 of file IrSignal.h.

◆ getIntro()

const IrSequence& IrSignal::getIntro ( ) const
inline

Definition at line 84 of file IrSignal.h.

◆ getRepeat()

const IrSequence& IrSignal::getRepeat ( ) const
inline

Definition at line 80 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 142 of file IrSignal.h.

◆ 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

◆ defaultFrequency

const frequency_t IrSignal::defaultFrequency = 38000U
static

Definition at line 12 of file IrSignal.h.

◆ invalidFrequency

const frequency_t IrSignal::invalidFrequency = (frequency_t) -1
static

Definition at line 13 of file IrSignal.h.

◆ noDutyCycle

const dutycycle_t IrSignal::noDutyCycle = -1
static

Definition at line 14 of file IrSignal.h.


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