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  QString lircd_device,
30  QString our_program,
31  QString config_file);
32  bool Init(void);
33 
34  virtual void start(void);
35  virtual void deleteLater(void);
36 
37  private:
38  ~LIRC() override;
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 m_lock {QMutex::Recursive};
47  static QMutex s_lirclibLock;
48  QObject *m_mainWindow {nullptr};
49  QString m_lircdDevice;
50  QString m_program;
51  QString m_configFile;
52  bool m_doRun {false};
54  QByteArray m_buf;
57  LIRCPriv *d {nullptr}; // NOLINT(readability-identifier-naming)
58 };
59 
60 #endif
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
QByteArray m_buf
Definition: lirc.h:54
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:403
bool Init(void)
Definition: lirc.cpp:159
bool IsDoRunSet(void) const
Definition: lirc.cpp:331
bool m_doRun
Definition: lirc.h:52
virtual void start(void)
Definition: lirc.cpp:317
uint m_bufOffset
Definition: lirc.h:53
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
QString m_program
program to extract from config file
Definition: lirc.h:50
QMutex m_lock
Definition: lirc.h:46
unsigned int uint
Definition: compat.h:140
QString m_configFile
file containing LIRC->key mappings
Definition: lirc.h:51
QString m_lircdDevice
device on which to receive lircd data
Definition: lirc.h:49
uint m_retryCount
Definition: lirc.h:56
void TeardownAll()
Definition: lirc.cpp:100
QList< QByteArray > GetCodes(void)
Definition: lirc.cpp:471
void Process(const QByteArray &data)
Definition: lirc.cpp:337
uint m_eofCount
Definition: lirc.h:55
LIRC(QObject *main_window, QString lircd_device, QString our_program, QString config_file)
Definition: lirc.cpp:75
~LIRC() override
Definition: lirc.cpp:89
virtual void deleteLater(void)
Definition: lirc.cpp:94
static QMutex s_lirclibLock
Definition: lirc.h:47