MythTV  master
lirc.h
Go to the documentation of this file.
1 #ifndef LIRC_H_
2 #define LIRC_H_
3 
4 #include <QByteArray>
5 #include <QString>
6 #include <QObject>
7 #include <QMutex>
8 #include <QList>
9 
10 #include <sys/types.h> // for uint
11 
12 #include "mthread.h"
13 
14 class LIRCPriv;
15 
24 class LIRC : public QObject, public MThread
25 {
26  Q_OBJECT
27  public:
28  LIRC(QObject *main_window,
29  const QString &lircd_device,
30  const QString &our_program,
31  const QString &config_file);
32  bool Init(void);
33 
34  virtual void start(void);
35  virtual void deleteLater(void);
36 
37  private:
38  virtual ~LIRC();
39  void TeardownAll();
40 
41  bool IsDoRunSet(void) const;
42  void run(void) override; // MThread
43  QList<QByteArray> GetCodes(void);
44  void Process(const QByteArray &data);
45 
46  mutable QMutex lock;
47  static QMutex lirclib_lock;
48  QObject *m_mainWindow {nullptr};
49  QString lircdDevice;
50  QString program;
51  QString configFile;
52  bool doRun;
54  QByteArray buf;
57  LIRCPriv *d {nullptr};
58 };
59 
60 #endif
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: lirc.cpp:410
bool Init(void)
Definition: lirc.cpp:164
bool IsDoRunSet(void) const
Definition: lirc.cpp:338
uint buf_offset
Definition: lirc.h:53
unsigned int uint
Definition: compat.h:140
QString lircdDevice
device on which to receive lircd data
Definition: lirc.h:49
virtual void start(void)
Definition: lirc.cpp:324
uint retryCount
Definition: lirc.h:56
LIRCPriv * d
Definition: lirc.h:57
Interface between mythtv and lircd.
Definition: lirc.h:24
QObject * m_mainWindow
window to send key events to
Definition: lirc.h:48
static QMutex lirclib_lock
Definition: lirc.h:47
uint eofCount
Definition: lirc.h:55
bool doRun
Definition: lirc.h:52
QMutex lock
Definition: lirc.h:46
QString configFile
file containing LIRC->key mappings
Definition: lirc.h:51
void TeardownAll()
Definition: lirc.cpp:104
QList< QByteArray > GetCodes(void)
Definition: lirc.cpp:480
void Process(const QByteArray &data)
Definition: lirc.cpp:344
QByteArray buf
Definition: lirc.h:54
virtual ~LIRC()
Definition: lirc.cpp:93
LIRC(QObject *main_window, const QString &lircd_device, const QString &our_program, const QString &config_file)
Definition: lirc.cpp:74
QString program
program to extract from config file
Definition: lirc.h:50
virtual void deleteLater(void)
Definition: lirc.cpp:98