- add rcconsole key input (for now)
[vuplus_dvbapp] / lib / driver / rcconsole.h
diff --git a/lib/driver/rcconsole.h b/lib/driver/rcconsole.h
new file mode 100644 (file)
index 0000000..0c1dd63
--- /dev/null
@@ -0,0 +1,45 @@
+#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;
+       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