50 return (x & 1) ? x + 1 : x;
112 operator bool()
const {
133 virtual void dump(Stream &stream)
const;
This file defines some general data types that are used in the library.
uint16_t microseconds_t
Type for durations in micro seconds.
uint32_t frequency_t
Type for modulation frequency in Hz.
uint16_t milliseconds_t
Type for durations in milli seconds.
Abstract base class for all IR readers, capturing or receiving.
virtual void disable()
Stop reception of IR data.
virtual bool isReady() const =0
Returns true if there is collected data.
IrReader(size_t bufSize_)
Constructs an IrReader with buffersize bufSize_, possibly increased to be even.
virtual void receive()=0
Convenience function: enable, wait until data is collected or timeout has occured,...
virtual void setBeginningTimeout(milliseconds_t timeOut)
virtual frequency_t getFrequency() const =0
Returns frequency of received signal.
virtual size_t getDataLength() const =0
Returns the number of collected durations.
virtual milliseconds_t getEndingTimeout() const
static constexpr size_t defaultCaptureLength
virtual milliseconds_t getBeginningTimeout() const
int16_t markExcess
Microseconds subtracted from pulses and added to gaps.
milliseconds_t beginningTimeout
static constexpr milliseconds_t defaultEndingTimeout
static unsigned int forceEven(unsigned int x)
virtual void enable()
Start reception of IR data.
static constexpr milliseconds_t defaultBeginningTimeout
IrSequence * toIrSequence() const
Generates an IrSequence from the IrReader.
virtual bool isEmpty() const
milliseconds_t endingTimeout
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...
virtual void setEndingTimeout(milliseconds_t timeOut)
bool timeouted
True if last receive ended with a timeout.
virtual void dump(Stream &stream) const
Prints a textual representation of the received data to the Stream supplied.
int16_t getMarkExcess() const
Gets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to...
virtual microseconds_t getDuration(unsigned int index) const =0
Returns the index-th duration, if possible.
This class consists of a vector of durations.