X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdriver%2Frcconsole.h;fp=lib%2Fdriver%2Frcconsole.h;h=0c1dd636f308443e1b696a69658e1cadf638e749;hp=0000000000000000000000000000000000000000;hb=84670d3dc9c9dc29fd3af42b2f25092b3b6c2a09;hpb=f9723e7fbf7669f063151eaf53bb1ee9f4189289 diff --git a/lib/driver/rcconsole.h b/lib/driver/rcconsole.h new file mode 100644 index 0000000..0c1dd63 --- /dev/null +++ b/lib/driver/rcconsole.h @@ -0,0 +1,45 @@ +#ifndef __lib_driver_rcconsole_h +#define __lib_driver_rcconsole_h + +#include +#include + +class eRCConsoleDriver: public eRCDriver +{ + struct termios ot; +protected: + int handle; + eSocketNotifier *sn; + 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(int code); + eRCConsole(eRCDriver *driver); + const char *getDescription() const; + const char *getKeyDescription(const eRCKey &key) const; + int getKeyCompatibleCode(const eRCKey &key) const; +}; + +#endif