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
LIRC::TeardownAll
void TeardownAll()
Definition: lirc.cpp:100
LIRC::m_lock
QMutex m_lock
Definition: lirc.h:46
LIRC::m_mainWindow
QObject * m_mainWindow
window to send key events to
Definition: lirc.h:48
LIRC::m_lircdDevice
QString m_lircdDevice
device on which to receive lircd data
Definition: lirc.h:49
LIRC::m_configFile
QString m_configFile
file containing LIRC->key mappings
Definition: lirc.h:51
LIRC::m_retryCount
uint m_retryCount
Definition: lirc.h:56
LIRC::Process
void Process(const QByteArray &data)
Definition: lirc.cpp:337
LIRC::~LIRC
~LIRC() override
Definition: lirc.cpp:89
LIRCPriv
Definition: lirc.cpp:45
LIRC::GetCodes
QList< QByteArray > GetCodes(void)
Definition: lirc.cpp:471
LIRC::m_eofCount
uint m_eofCount
Definition: lirc.h:55
LIRC::LIRC
LIRC(QObject *main_window, QString lircd_device, QString our_program, QString config_file)
Definition: lirc.cpp:75
LIRC::s_lirclibLock
static QMutex s_lirclibLock
Definition: lirc.h:47
LIRC::deleteLater
virtual void deleteLater(void)
Definition: lirc.cpp:94
LIRC::m_buf
QByteArray m_buf
Definition: lirc.h:54
LIRC::run
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
uint
unsigned int uint
Definition: compat.h:140
LIRC::IsDoRunSet
bool IsDoRunSet(void) const
Definition: lirc.cpp:331
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
mthread.h
LIRC::m_bufOffset
uint m_bufOffset
Definition: lirc.h:53
LIRC::Init
bool Init(void)
Definition: lirc.cpp:159
LIRC::m_doRun
bool m_doRun
Definition: lirc.h:52
LIRC
Interface between mythtv and lircd.
Definition: lirc.h:25
LIRC::d
LIRCPriv * d
Definition: lirc.h:57
LIRC::m_program
QString m_program
program to extract from config file
Definition: lirc.h:50
LIRC::start
virtual void start(void)
Definition: lirc.cpp:317