Infrared4Arduino
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
IrReader Class Referenceabstract

Abstract base class for all IR readers, capturing or receiving. More...

#include <IrReader.h>

Inheritance diagram for IrReader:
Inheritance graph
[legend]

Public Member Functions

virtual void reset ()
 
virtual void enable ()
 Start reception of IR data. More...
 
virtual void disable ()
 Stop reception of IR data. More...
 
virtual void receive ()=0
 Convenience function: enable, wait until data is collected or timeout has occured, disable. More...
 
virtual boolean isReady () const =0
 Returns true if there is collected data. More...
 
virtual size_t getDataLength () const =0
 Returns the number of collected durations. More...
 
virtual microseconds_t getDuration (unsigned int index) const =0
 Returns the index-th duration, if possible. More...
 
virtual void dump (Stream &stream) const
 Prints a textual representation of the received data to the Stream supplied. More...
 
IrSequencetoIrSequence () const
 Generates an IrSequence from the IrReader. More...
 
virtual boolean isEmpty () const
 
virtual void setEndingTimeout (milliseconds_t timeOut)
 
virtual milliseconds_t getEndingTimeout () const
 
virtual void setBeginningTimeout (milliseconds_t timeOut)
 
virtual milliseconds_t getBeginningTimeout () const
 
unsigned int getBufferSize () const
 
void setMarkExcess (int16_t markExcess_)
 Sets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations. More...
 
int16_t getMarkExcess () const
 Gets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations. More...
 

Static Public Attributes

static const milliseconds_t defaultBeginningTimeout = 2000U
 
static const milliseconds_t defaultEndingTimeout = 30U
 
static const size_t defaultCaptureLength = 100U
 

Protected Member Functions

 IrReader (size_t bufSize_)
 Constructs an IrReader with buffersize bufSize_, possibly increased to be even. More...
 
 IrReader ()
 
virtual ~IrReader ()
 

Static Protected Member Functions

static unsigned int forceEven (unsigned int x)
 

Protected Attributes

milliseconds_t beginningTimeout
 
milliseconds_t endingTimeout
 
size_t bufferSize
 
int16_t markExcess
 Microseconds subtracted from pulses and added to gaps. More...
 
boolean timeouted
 True if last receive ended with a timeout. More...
 

Detailed Description

Abstract base class for all IR readers, capturing or receiving.

It should also serve as an interface description, allowing for received data to be printed and decoded.

Definition at line 30 of file IrReader.h.

Constructor & Destructor Documentation

IrReader::IrReader ( size_t  bufSize_)
inlineprotected

Constructs an IrReader with buffersize bufSize_, possibly increased to be even.

Parameters
bufSize_

Definition at line 57 of file IrReader.h.

IrReader::IrReader ( )
inlineprotected

Definition at line 60 of file IrReader.h.

virtual IrReader::~IrReader ( )
inlineprotectedvirtual

Definition at line 63 of file IrReader.h.

Member Function Documentation

virtual void IrReader::disable ( )
inlinevirtual

Stop reception of IR data.

Reimplemented in IrReceiverSampler, and IrReceiverPoll.

Definition at line 80 of file IrReader.h.

void IrReader::dump ( Stream &  stream) const
virtual

Prints a textual representation of the received data to the Stream supplied.

Parameters
streamStream to which to print

Reimplemented in IrWidget.

Definition at line 21 of file IrReader.cpp.

virtual void IrReader::enable ( )
inlinevirtual

Start reception of IR data.

Reimplemented in IrReceiverSampler, and IrReceiverPoll.

Definition at line 74 of file IrReader.h.

static unsigned int IrReader::forceEven ( unsigned int  x)
inlinestaticprotected

Definition at line 49 of file IrReader.h.

virtual milliseconds_t IrReader::getBeginningTimeout ( ) const
inlinevirtual

Reimplemented in IrReceiverSampler, and IrReceiverPoll.

Definition at line 135 of file IrReader.h.

unsigned int IrReader::getBufferSize ( ) const
inline

Definition at line 139 of file IrReader.h.

virtual size_t IrReader::getDataLength ( ) const
pure virtual

Returns the number of collected durations.

Returns
number durations

Implemented in IrReceiverSampler, IrWidget, IrSequenceReader, and IrReceiverPoll.

virtual microseconds_t IrReader::getDuration ( unsigned int  index) const
pure virtual

Returns the index-th duration, if possible.

Parameters
indexindex of duration
Returns
requested duration

Implemented in IrReceiverSampler, IrWidget, IrSequenceReader, and IrReceiverPoll.

virtual milliseconds_t IrReader::getEndingTimeout ( ) const
inlinevirtual

Reimplemented in IrReceiverSampler, IrWidget, and IrReceiverPoll.

Definition at line 127 of file IrReader.h.

int16_t IrReader::getMarkExcess ( ) const
inline

Gets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations.

Returns
markExcess

Definition at line 157 of file IrReader.h.

virtual boolean IrReader::isEmpty ( ) const
inlinevirtual

Definition at line 119 of file IrReader.h.

virtual boolean IrReader::isReady ( ) const
pure virtual

Returns true if there is collected data.

Returns
status

Implemented in IrReceiverSampler, IrWidget, IrSequenceReader, and IrReceiverPoll.

virtual void IrReader::receive ( )
pure virtual

Convenience function: enable, wait until data is collected or timeout has occured, disable.

Implemented in IrWidget, IrReceiver, and IrSequenceReader.

virtual void IrReader::reset ( )
inlinevirtual

Reimplemented in IrReceiverSampler, IrWidget, and IrReceiverPoll.

Definition at line 67 of file IrReader.h.

virtual void IrReader::setBeginningTimeout ( milliseconds_t  timeOut)
inlinevirtual

Reimplemented in IrReceiverSampler, and IrReceiverPoll.

Definition at line 131 of file IrReader.h.

virtual void IrReader::setEndingTimeout ( milliseconds_t  timeOut)
inlinevirtual

Reimplemented in IrReceiverSampler, IrWidget, and IrReceiverPoll.

Definition at line 123 of file IrReader.h.

void IrReader::setMarkExcess ( int16_t  markExcess_)
inline

Sets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations.

Parameters
markExcess_possibly negative new value

Definition at line 148 of file IrReader.h.

IrSequence * IrReader::toIrSequence ( ) const

Generates an IrSequence from the IrReader.

Returns
IrSequence. The user must delete this to avoid memory leaks.

Definition at line 32 of file IrReader.cpp.

Member Data Documentation

milliseconds_t IrReader::beginningTimeout
protected

Definition at line 38 of file IrReader.h.

size_t IrReader::bufferSize
protected

Definition at line 41 of file IrReader.h.

const milliseconds_t IrReader::defaultBeginningTimeout = 2000U
static

Definition at line 33 of file IrReader.h.

const size_t IrReader::defaultCaptureLength = 100U
static

Definition at line 35 of file IrReader.h.

const milliseconds_t IrReader::defaultEndingTimeout = 30U
static

Definition at line 34 of file IrReader.h.

milliseconds_t IrReader::endingTimeout
protected

Definition at line 39 of file IrReader.h.

int16_t IrReader::markExcess
protected

Microseconds subtracted from pulses and added to gaps.

May be negative.

Definition at line 44 of file IrReader.h.

boolean IrReader::timeouted
protected

True if last receive ended with a timeout.

Definition at line 47 of file IrReader.h.


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