trunk 20080912
[gitenigma.git] / include / lib / driver / rcconsole.h
blob0c1dd636f308443e1b696a69658e1cadf638e749
1 #ifndef __lib_driver_rcconsole_h
2 #define __lib_driver_rcconsole_h
4 #include <termios.h>
5 #include <lib/driver/rc.h>
7 class eRCConsoleDriver: public eRCDriver
9 struct termios ot;
10 protected:
11 int handle;
12 eSocketNotifier *sn;
13 void keyPressed(int);
14 public:
15 eRCConsoleDriver(const char *filename);
16 ~eRCConsoleDriver();
17 void flushBuffer() const
19 char data[16];
20 if (handle != -1)
21 while ( ::read(handle, data, 16) == 16 );
23 void lock() const
25 if ( sn )
26 sn->stop();
28 void unlock() const
30 if ( sn )
31 sn->start();
35 class eRCConsole: public eRCDevice
37 public:
38 void handleCode(int code);
39 eRCConsole(eRCDriver *driver);
40 const char *getDescription() const;
41 const char *getKeyDescription(const eRCKey &key) const;
42 int getKeyCompatibleCode(const eRCKey &key) const;
45 #endif