You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
2.1 KiB
116 lines
2.1 KiB
15 years ago
|
//
|
||
|
//
|
||
|
// C++ Interface: $MODULE$
|
||
|
//
|
||
|
// Description:
|
||
|
//
|
||
|
//
|
||
|
// Author: Gav Wood <gav@kde.org>, (C) 2003
|
||
|
//
|
||
|
// Copyright: See COPYING file that comes with this distribution
|
||
|
//
|
||
|
//
|
||
11 years ago
|
#ifndef TDELIRCCLIENT_H
|
||
|
#define TDELIRCCLIENT_H
|
||
15 years ago
|
|
||
14 years ago
|
#include <tqobject.h>
|
||
|
#include <tqmap.h>
|
||
|
#include <tqstring.h>
|
||
|
#include <tqstringlist.h>
|
||
15 years ago
|
|
||
14 years ago
|
class TQSocket;
|
||
|
class TQSocketNotifier;
|
||
15 years ago
|
|
||
|
/**
|
||
|
@author Malte Starostik
|
||
|
@author Gav Wood
|
||
|
*/
|
||
|
|
||
14 years ago
|
class KLircClient: public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
|
||
|
private:
|
||
|
struct lirc_config *theConfig;
|
||
14 years ago
|
TQSocket *theSocket;
|
||
|
TQSocketNotifier *theNotifier;
|
||
|
TQMap<TQString, TQStringList> theRemotes;
|
||
15 years ago
|
bool listIsUpToDate;
|
||
|
|
||
|
void updateRemotes();
|
||
14 years ago
|
void sendCommand(const TQString &command);
|
||
|
const TQString readLine();
|
||
15 years ago
|
|
||
|
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.
|
||
|
*/
|
||
14 years ago
|
void commandReceived(const TQString &remote, const TQString &button, int repeatCounter);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* 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.
|
||
|
*/
|
||
14 years ago
|
const TQStringList remotes() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Retrieve list of buttons of a praticular remote control.
|
||
|
*
|
||
|
* @returns said list.
|
||
|
*/
|
||
14 years ago
|
const TQStringList buttons(const TQString &theRemote) const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Connects to lirc.
|
||
|
*
|
||
|
* @returns true if connection is made.
|
||
|
*/
|
||
|
bool connectToLirc();
|
||
|
|
||
13 years ago
|
KLircClient(TQWidget *parent = 0, const char *name = 0);
|
||
15 years ago
|
~KLircClient();
|
||
|
};
|
||
|
|
||
|
#endif
|