DevSlashLirc
LircCodeLircDevice.cpp
Go to the documentation of this file.
1 #include "LircCodeLircDevice.h"
2 
3 #include <sys/ioctl.h>
4 
5 static const int IOCTL_OK = 0;
6 
8 }
9 
11 }
12 
14  if (recordingMode != LIRC_MODE_LIRCCODE) {
15  std::cerr << "This is not a lirccode device!" << std::endl;
16  valid = false;
17  return false;
18  }
19 
20  int status = ::ioctl(fileDescriptor, LIRC_GET_LENGTH, &codeLength);
21  if (status != IOCTL_OK) {
22  std::cerr << "Error: " << status << std::endl;
23  return false;
24  }
25  return true;
26 }
27 
28 void LircCodeLircDevice::report(std::ostream& stream) const {
29  if (!reportValidity(stream))
30  return;
31 
32  stream << "recording mode: lirccode" << std::endl;
33 
34  if (codeLength != INVALID)
35  stream << "codeLength = " << codeLength << std::endl;
36  else if (longReport)
37  stream << "codeLength: not available" << std::endl;
38 
39  LircDevice::report(stream);
40 }
41 
42 // TODO
44  std::cerr << "Not implemented yet" << std::endl;
45  return 0U;
46 }
47 
48 // TODO
49 bool LircCodeLircDevice::writeCode(uint32_t code) {
50  (void) code;
51  std::cerr << "Not implemented yet" << std::endl;
52  return false;
53 }
LircCodeLircDevice(const char *path=defaultFilename)
int fileDescriptor
Definition: LircDevice.h:31
bool valid
Definition: LircDevice.h:29
uint32_t recordingMode
Definition: LircDevice.h:33
int ioctl(uint32_t cmd, uint32_t arg)
Definition: LircDevice.cpp:98
bool reportValidity(std::ostream &stream=std::cout) const
Definition: LircDevice.cpp:138
static const uint32_t INVALID
Definition: LircDevice.h:53
void report(const char *name, bool value, std::ostream &stream) const
Definition: LircDevice.cpp:102
static const bool longReport
Flag indicating how to format reports.
Definition: LircDevice.h:27
bool writeCode(uint32_t code)
This abstract class contains the common functionality of the derived classes.
Definition: LircDevice.h:24
void report(std::ostream &stream=std::cout) const
Prints a listing of the properties implemented on the stream supplied.