diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2000-07-15 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2000-07-15 18:00:00 +0200 |
commit | 3b78ec8374aac8daa560fa0cd06260fca6eb1500 (patch) | |
tree | e753b7fb9304a47651926ce1db67f83127b510fb /remote.h | |
parent | 9599a8fd8a6724e55ec4ad2ba2c975c0850073d9 (diff) | |
download | vdr-patch-lnbsharing-3b78ec8374aac8daa560fa0cd06260fca6eb1500.tar.gz vdr-patch-lnbsharing-3b78ec8374aac8daa560fa0cd06260fca6eb1500.tar.bz2 |
Version 0.06vdr-0.06
- Added support for LIRC remote control (thanks to Carsten Koch!).
There are now three different remote control modes: KBD (PC-Keyboard), RCU
and LIRC. See the INSTALL file for information on how to enable either of
these modes. The default mode is now KBD, not RCU as before (to make it
work immediately even if there is no actual remote control).
Diffstat (limited to 'remote.h')
-rw-r--r-- | remote.h | 85 |
1 files changed, 68 insertions, 17 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.h 1.5 2000/05/07 09:27:54 kls Exp $ + * $Id: remote.h 1.6 2000/06/24 15:52:56 kls Exp $ */ #ifndef __REMOTE_H @@ -13,14 +13,44 @@ #include <stdio.h> #include <time.h> -class cRcIo { +class cRcIoBase { +protected: + time_t t; + int firstTime, lastTime; + unsigned int lastCommand; + cRcIoBase(void); + virtual ~cRcIoBase(); +public: + enum { modeH = 'h', modeB = 'b', modeS = 's' }; + virtual bool SetCode(unsigned char Code, unsigned short Address) { return true; } + virtual bool SetMode(unsigned char Mode) { return true; } + virtual bool Number(int n, bool Hex = false) { return true; } + virtual void SetPoints(unsigned char Dp, bool On) {} + virtual bool String(char *s) { return true; } + virtual bool DetectCode(unsigned char *Code, unsigned short *Address) { return true; } + virtual void Flush(int WaitSeconds = 0) {} + virtual bool InputAvailable(bool Wait = false) = 0; + virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL) = 0; + }; + +#if defined REMOTE_KBD + +class cRcIoKBD : public cRcIoBase { +public: + cRcIoKBD(void); + virtual ~cRcIoKBD(); + virtual void Flush(int WaitSeconds = 0); + virtual bool InputAvailable(bool Wait = false); + virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); + }; + +#elif defined REMOTE_RCU + +class cRcIoRCU : public cRcIoBase { private: int f; unsigned char dp, code, mode; unsigned short address; - time_t t; - int firstTime, lastTime; - unsigned int lastCommand; int lastNumber; bool SendCommand(unsigned char Cmd); int ReceiveByte(bool Wait = true); @@ -28,18 +58,39 @@ private: bool SendByte(unsigned char c); bool Digit(int n, int v); public: - enum { modeH = 'h', modeB = 'b', modeS = 's' }; - cRcIo(char *DeviceName); - ~cRcIo(); - bool InputAvailable(bool Wait = false); - void Flush(int WaitSeconds = 0); - bool SetCode(unsigned char Code, unsigned short Address); - bool SetMode(unsigned char Mode); - bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); - bool Number(int n, bool Hex = false); - void SetPoints(unsigned char Dp, bool On); - bool String(char *s); - bool DetectCode(unsigned char *Code, unsigned short *Address); + cRcIoRCU(char *DeviceName); + virtual ~cRcIoRCU(); + virtual bool SetCode(unsigned char Code, unsigned short Address); + virtual bool SetMode(unsigned char Mode); + virtual bool Number(int n, bool Hex = false); + virtual void SetPoints(unsigned char Dp, bool On); + virtual bool String(char *s); + virtual bool DetectCode(unsigned char *Code, unsigned short *Address); + virtual void Flush(int WaitSeconds = 0); + virtual bool InputAvailable(bool Wait = false); + virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); + }; + +#elif defined REMOTE_LIRC + +class cRcIoLIRC : public cRcIoBase { +private: + enum { LIRC_BUFFER_SIZE = 128 }; + int f; + char buf[LIRC_BUFFER_SIZE]; + const char *ReceiveString(void); +public: + cRcIoLIRC(char *DeviceName); + virtual ~cRcIoLIRC(); + virtual void Flush(int WaitSeconds = 0); + virtual bool InputAvailable(bool Wait = false); + virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); }; +#else + +#error Please define a remote control mode! + +#endif + #endif //__REMOTE_H |