/
lirc.h
60 lines (50 loc) · 1.4 KB
/
lirc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef LIRC_H_
#define LIRC_H_
#include <QByteArray>
#include <QString>
#include <QObject>
#include <QMutex>
#include <QList>
#include <sys/types.h> // for uint
#include "mthread.h"
class LIRCPriv;
/**
* \class LIRC
*
* \brief Listens for input from the Linux Infrared Remote Control daemon and
* translates it into internal input events.
*
* \ingroup MythUI_Input
*/
class LIRC : public QObject, public MThread
{
Q_OBJECT
public:
LIRC(QObject *main_window,
QString lircd_device,
QString our_program,
QString config_file);
bool Init(void);
virtual void start(void);
virtual void deleteLater(void);
private:
virtual ~LIRC();
void TeardownAll();
bool IsDoRunSet(void) const;
void run(void) override; // MThread
QList<QByteArray> GetCodes(void);
void Process(QByteArray &data);
mutable QMutex lock;
static QMutex lirclib_lock;
QObject *m_mainWindow {nullptr}; ///< window to send key events to
QString lircdDevice; ///< device on which to receive lircd data
QString program; ///< program to extract from config file
QString configFile; ///< file containing LIRC->key mappings
bool doRun;
uint buf_offset;
QByteArray buf;
uint eofCount;
uint retryCount;
LIRCPriv *d {nullptr};
};
#endif