DevSlashLirc
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
Mode2LircDevice Class Reference

This class is a LIRC_MODE_MODE2 device as per lirc(4). More...

#include <Mode2LircDevice.h>

Inheritance diagram for Mode2LircDevice:
Inheritance graph
[legend]
Collaboration diagram for Mode2LircDevice:
Collaboration graph
[legend]

Public Member Functions

 Mode2LircDevice (const char *path=defaultFilename=defaultFilename, milliseconds_t beginTimeout=defaultBeginTimeout, size_t captureSize=defaultCaptureSize, milliseconds_t endTimeout=defaultEndTimeout)
 
virtual bool open ()
 
bool isMode2 () const
 
bool isLircCode () const
 
void report (std::ostream &stream=std::cout) const
 Prints a listing of the properties implemented on the stream supplied. More...
 
microseconds_t getRecResolution () const
 
bool canSetSendCarrier () const
 
bool canGetRecResolution () const
 
milliseconds_t getEndTimeout () const
 
void setEndTimeout (int timeout)
 
size_t getCaptureSize () const
 
void setCaptureSize (size_t captureSize_)
 
lirc_t read (int timeout)
 Reads exactly one duration. More...
 
void mode2dump (std::ostream &stream=std::cout)
 Reads and dumps readings in mode2 format. More...
 
IrSequencereceive ()
 Reads a sequence. More...
 
int write (const uint32_t *data, size_t length)
 A low-level interface to the write(2) call on the file descriptor. More...
 
bool send (const lirc_t *data, unsigned length)
 Mid-level sending routine. More...
 
bool send (const IrSequence &irSequence)
 High-level sending routine. More...
 
bool send (const IrSequence &irSequence, frequency_t frequency)
 High-level sending routine. More...
 
bool send (const lirc_t *data, unsigned length, frequency_t frequency)
 High-level sending routine. More...
 
int setSendCarrier (int frequency=defaultFrequency)
 Set the modulation frequency. More...
 
- Public Member Functions inherited from LircDevice
bool close ()
 
virtual ~LircDevice ()
 
bool isValid () const
 
milliseconds_t getBeginTimeout () const
 
void setBeginTimeout (milliseconds_t timeout)
 
bool canSend () const
 
bool canSetTransmitterMask () const
 
bool canRec () const
 
bool canSetRecTimeout () const
 
bool canSendPulse () const
 
bool canSendLircCode () const
 
bool canRecMode2 () const
 
bool canRecLircCode () const
 
unsigned getNumberTransmitters () const
 Return the number of transmitters as reported from the device. More...
 
int setTransmitterMask (uint32_t mask)
 Enable the set of transmitters specified in val, which contains a bit mask where each enabled transmitter is a 1. More...
 
int setRecTimeout (int arg)
 Set the integer value for IR inactivity timeout (microseconds). More...
 
int setRecTimeoutReports (bool enable)
 Enable or disable timeout packages. More...
 

Static Public Attributes

static const frequency_t defaultFrequency = 38000U
 
static const microseconds_t replacementEndingSilence = 100000U
 
static const milliseconds_t defaultEndTimeout = 200U
 
static const size_t defaultCaptureSize = 250
 
- Static Public Attributes inherited from LircDevice
static const char * version = "LircDevice " VERSION
 
static const char * defaultFilename = "/dev/lirc0"
 
static const milliseconds_t defaultBeginTimeout = 5000U
 
static const uint32_t INVALID = UINT32_MAX
 

Protected Attributes

milliseconds_t endTimeout
 
size_t captureSize
 
- Protected Attributes inherited from LircDevice
bool valid
 
const char * fileName
 
int fileDescriptor
 
unsigned numberTransmitters
 
uint32_t recordingMode
 
uint32_t features
 
milliseconds_t beginTimeout
 

Additional Inherited Members

- Protected Member Functions inherited from LircDevice
void report (const char *name, bool value, std::ostream &stream) const
 
bool reportValidity (std::ostream &stream=std::cout) const
 
int ioctl (uint32_t cmd, uint32_t arg)
 
bool canDo (uint32_t mask) const
 
 LircDevice (const char *path=defaultFilename, milliseconds_t beginTimeout=defaultBeginTimeout)
 
 LircDevice (const LircDevice &orig)
 
- Static Protected Attributes inherited from LircDevice
static const bool longReport = false
 Flag indicating how to format reports. More...
 

Detailed Description

This class is a LIRC_MODE_MODE2 device as per lirc(4).

Definition at line 9 of file Mode2LircDevice.h.

Constructor & Destructor Documentation

◆ Mode2LircDevice()

Mode2LircDevice::Mode2LircDevice ( const char *  path = defaultFilename = defaultFilename,
milliseconds_t  beginTimeout = defaultBeginTimeout,
size_t  captureSize = defaultCaptureSize,
milliseconds_t  endTimeout = defaultEndTimeout 
)

Definition at line 13 of file Mode2LircDevice.cpp.

Member Function Documentation

◆ canGetRecResolution()

bool Mode2LircDevice::canGetRecResolution ( ) const
inline

Definition at line 43 of file Mode2LircDevice.h.

◆ canSetSendCarrier()

bool Mode2LircDevice::canSetSendCarrier ( ) const
inline

Definition at line 42 of file Mode2LircDevice.h.

◆ getCaptureSize()

size_t Mode2LircDevice::getCaptureSize ( ) const
inline

Definition at line 54 of file Mode2LircDevice.h.

◆ getEndTimeout()

milliseconds_t Mode2LircDevice::getEndTimeout ( ) const
inline

Definition at line 45 of file Mode2LircDevice.h.

◆ getRecResolution()

microseconds_t Mode2LircDevice::getRecResolution ( ) const
inline

Definition at line 40 of file Mode2LircDevice.h.

◆ isLircCode()

bool Mode2LircDevice::isLircCode ( ) const
inlinevirtual

Implements LircDevice.

Definition at line 36 of file Mode2LircDevice.h.

◆ isMode2()

bool Mode2LircDevice::isMode2 ( ) const
inlinevirtual

Implements LircDevice.

Definition at line 35 of file Mode2LircDevice.h.

◆ mode2dump()

void Mode2LircDevice::mode2dump ( std::ostream &  stream = std::cout)

Reads and dumps readings in mode2 format.

Parameters
stream

Definition at line 116 of file Mode2LircDevice.cpp.

◆ open()

bool Mode2LircDevice::open ( )
virtual

Reimplemented from LircDevice.

Definition at line 17 of file Mode2LircDevice.cpp.

◆ read()

lirc_t Mode2LircDevice::read ( int  timeout)

Reads exactly one duration.

Read a number.

Blocks.

Returns
duration as lirc_t.
Parameters
timeouttimeout in milliseconds; 0 for no timeout (wait forever)
Returns

Definition at line 68 of file Mode2LircDevice.cpp.

◆ receive()

IrSequence * Mode2LircDevice::receive ( )

Reads a sequence.

The mechanism for the ending may be device dependent, but in general returns a sane IrSequence.

Returns
received IrSequence

Definition at line 89 of file Mode2LircDevice.cpp.

◆ report()

void Mode2LircDevice::report ( std::ostream &  stream = std::cout) const
virtual

Prints a listing of the properties implemented on the stream supplied.

Parameters
stream

Reimplemented from LircDevice.

Definition at line 45 of file Mode2LircDevice.cpp.

◆ send() [1/4]

bool Mode2LircDevice::send ( const lirc_t *  data,
unsigned  length 
)

Mid-level sending routine.

Sends the data.

Parameters
data
length;required to be odd.
Returns
success of operation

Definition at line 151 of file Mode2LircDevice.cpp.

◆ send() [2/4]

bool Mode2LircDevice::send ( const IrSequence irSequence)

High-level sending routine.

Sends the irSequence with the requested frequency and duty cycle.

Parameters
irSequence
Returns
success of operation

Definition at line 161 of file Mode2LircDevice.cpp.

◆ send() [3/4]

bool Mode2LircDevice::send ( const IrSequence irSequence,
frequency_t  frequency 
)
inline

High-level sending routine.

Sends the irSequence with the requested frequency.

Parameters
irSequence
frequency
Returns
success of operation

Definition at line 113 of file Mode2LircDevice.h.

◆ send() [4/4]

bool Mode2LircDevice::send ( const lirc_t *  data,
unsigned  length,
frequency_t  frequency 
)

High-level sending routine.

Sends the irSequence with the requested frequency.

Parameters
data
length
frequency
Returns
success of operation

Definition at line 165 of file Mode2LircDevice.cpp.

◆ setCaptureSize()

void Mode2LircDevice::setCaptureSize ( size_t  captureSize_)
inline

Definition at line 58 of file Mode2LircDevice.h.

◆ setEndTimeout()

void Mode2LircDevice::setEndTimeout ( int  timeout)
inline

Definition at line 49 of file Mode2LircDevice.h.

◆ setSendCarrier()

int Mode2LircDevice::setSendCarrier ( int  frequency = defaultFrequency)
inline

Set the modulation frequency.

The argument is the frequency (Hz).

Definition at line 128 of file Mode2LircDevice.h.

◆ write()

int Mode2LircDevice::write ( const uint32_t *  data,
size_t  length 
)

A low-level interface to the write(2) call on the file descriptor.

Parameters
datadata to be written
lengthof data
Returns
number or characters actually written.

Definition at line 128 of file Mode2LircDevice.cpp.

Member Data Documentation

◆ captureSize

size_t Mode2LircDevice::captureSize
protected

Definition at line 17 of file Mode2LircDevice.h.

◆ defaultCaptureSize

const size_t Mode2LircDevice::defaultCaptureSize = 250
static

Definition at line 23 of file Mode2LircDevice.h.

◆ defaultEndTimeout

const milliseconds_t Mode2LircDevice::defaultEndTimeout = 200U
static

Definition at line 22 of file Mode2LircDevice.h.

◆ defaultFrequency

const frequency_t Mode2LircDevice::defaultFrequency = 38000U
static

Definition at line 20 of file Mode2LircDevice.h.

◆ endTimeout

milliseconds_t Mode2LircDevice::endTimeout
protected

Definition at line 16 of file Mode2LircDevice.h.

◆ replacementEndingSilence

const microseconds_t Mode2LircDevice::replacementEndingSilence = 100000U
static

Definition at line 21 of file Mode2LircDevice.h.


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