blob: 30f5fe5a77af0974eef099c191c83df9884d10e5 (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Gav Wood <gav@kde.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef KLIRCCLIENT_H
#define KLIRCCLIENT_H
#include <tqobject.h>
#include <tqmap.h>
#include <tqstring.h>
#include <tqstringlist.h>
class QSocket;
class QSocketNotifier;
/**
@author Malte Starostik
@author Gav Wood
*/
class KLircClient: public QObject
{
Q_OBJECT
private:
struct lirc_config *theConfig;
TQSocket *theSocket;
TQSocketNotifier *theNotifier;
TQMap<TQString, TQStringList> theRemotes;
bool listIsUpToDate;
void updateRemotes();
void sendCommand(const TQString &command);
const TQString readLine();
private slots:
void slotRead();
void slotClosed();
signals:
/**
* Emitted when the list of controls / buttons was completely read
*/
void remotesRead();
/**
* Emitted when a IR command was received
*
* The arguments are the name of the remote control used,
* the name of the button pressed and the repeat counter.
*
* The signal is emitted repeatedly as long as the button
* on the remote control remains pressed.
* The repeat counter starts with 0 and increases
* every time this signal is emitted.
*/
void commandReceived(const TQString &remote, const TQString &button, int repeatCounter);
/**
* Emitted when the Lirc connection is closed.
*/
void connectionClosed();
public:
/**
* Query status of connection.
*
* @returns true if connected to lircd.
*/
bool isConnected() const;
/**
* Query status of remote list.
*
* Make sure this is true before calling remotes()/buttons(...).
*
* @returns true if up to date.
*/
bool haveFullList() const;
/**
* Retrieve list of remote controls.
*
* @returns said list.
*/
const TQStringList remotes() const;
/**
* Retrieve list of buttons of a praticular remote control.
*
* @returns said list.
*/
const TQStringList buttons(const TQString &theRemote) const;
/**
* Connects to lirc.
*
* @returns true if connection is made.
*/
bool connectToLirc();
KLircClient(TQWidget *parent = 0, const char *name = 0);
~KLircClient();
};
#endif
|