10 #include <sys/ioctl.h> 15 static const int IOCTL_OK = 0;
16 static const int IOCTL_ERROR = -1;
24 std::cerr <<
"Error: Cannot open " <<
fileName << std::endl;
30 if (status == IOCTL_ERROR) {
31 std::cerr <<
"Error: Cannot stat " <<
fileName << std::endl;
35 if (!S_ISCHR(s.st_mode)) {
36 std::cerr <<
"Error: " <<
fileName <<
" is not a character device" << std::endl;
45 if (status != IOCTL_OK)
49 std::cerr <<
"This cannot happen!" << std::endl;
54 if (status != IOCTL_OK) {
55 std::cerr <<
"Error: " << status << std::endl;
70 fileName(orig.fileName),
71 fileDescriptor(orig.fileDescriptor),
72 numberTransmitters(orig.numberTransmitters),
73 recordingMode(orig.recordingMode),
74 features(orig.features),
75 beginTimeout(orig.beginTimeout) {
87 if (status != IOCTL_OK)
88 std::cerr <<
"Error when closing " <<
fileName <<
": " << status << std::endl;
91 std::cerr <<
"Successful close of " <<
fileName << std::endl;
95 return status == IOCTL_OK;
104 stream << name <<
": " << (value ?
"true" :
"false") << std::endl;
107 stream << name << std::endl;
122 #ifdef SUPPORT_NEVER_IMPLEMENTED_OPTIONS 123 report(
"canSendRaw", canSendRaw(), stream);
124 report(
"canSendMode2", canSendMode2(), stream);
125 report(
"canRecRaw", canRecRaw(), stream);
126 report(
"canRecPulse", canRecPulse(), stream);
127 report(
"canSetRecCarrier", canSetRecCarrier(), stream);
128 report(
"canSetRecDutyCycle", canSetRecDutyCycle(), stream);
129 report(
"canSetRecDutyCycleRange", canSetRecDutyCycleRange(), stream);
130 report(
"canSetRecCarrierRange", canSetRecCarrierRange(), stream);
131 report(
"canSetRecFilter", canSetRecFilter(), stream);
132 report(
"canNotifyDecoder", canNotifyDecoder(), stream);
133 report(
"canMeasureCarrier", canMeasureCarrier(), stream);
134 report(
"canUseWidebandReceiver", canUseWidebandReceiver(), stream);
135 #endif //SUPPORT_NEVER_IMPLEMENTED_OPTIONS 139 stream << (
valid ?
"VALID" :
"INVALID") << std::endl;
bool canSendLircCode() const
bool canSendPulse() const
static const char * version
bool canRecLircCode() const
int ioctl(uint32_t cmd, uint32_t arg)
bool reportValidity(std::ostream &stream=std::cout) const
uint32_t milliseconds_t
Type for durations in milli seconds.
void report(const char *name, bool value, std::ostream &stream) const
static const bool longReport
Flag indicating how to format reports.
bool canSetRecTimeout() const
unsigned getNumberTransmitters() const
Return the number of transmitters as reported from the device.
int setTransmitterMask(uint32_t mask)
Enable the set of transmitters specified in val, which contains a bit mask where each enabled transmi...
static const char * defaultFilename
LircDevice(const char *path=defaultFilename, milliseconds_t beginTimeout=defaultBeginTimeout)
This abstract class contains the common functionality of the derived classes.
bool canSetTransmitterMask() const
unsigned numberTransmitters