blob: 8a24612c5bd6f4fa6566d5e20e7d063b11572297 (
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
|
#ifndef __lib_driver_rcconsole_h
#define __lib_driver_rcconsole_h
#include <termios.h>
#include <lib/driver/rc.h>
class eRCConsoleDriver: public eRCDriver
{
struct termios ot;
protected:
int handle;
ePtr<eSocketNotifier> sn;
bool m_escape;
void keyPressed(int);
public:
eRCConsoleDriver(const char *filename);
~eRCConsoleDriver();
void flushBuffer() const
{
char data[16];
if (handle != -1)
while ( ::read(handle, data, 16) == 16 );
}
void lock() const
{
if ( sn )
sn->stop();
}
void unlock() const
{
if ( sn )
sn->start();
}
};
class eRCConsole: public eRCDevice
{
public:
void handleCode(long code);
eRCConsole(eRCDriver *driver);
const char *getDescription() const;
const char *getKeyDescription(const eRCKey &key) const;
int getKeyCompatibleCode(const eRCKey &key) const;
};
#endif
|