summaryrefslogtreecommitdiff
path: root/remote.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-10-08 09:25:20 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-10-08 09:25:20 +0200
commit97c3bb61482855769f0208062610543475f02006 (patch)
tree98ed285302e4b4a9fcc6186587b2da234776ec14 /remote.h
parent60958ab1323d4f4750338165b89a99f4f2fbe4a7 (diff)
downloadvdr-97c3bb61482855769f0208062610543475f02006.tar.gz
vdr-97c3bb61482855769f0208062610543475f02006.tar.bz2
Remote control uses threads
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/remote.h b/remote.h
index 75dc4ac1..b9e79b4d 100644
--- a/remote.h
+++ b/remote.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.h 1.10 2000/10/03 10:45:35 kls Exp $
+ * $Id: remote.h 1.11 2000/10/07 18:50:51 kls Exp $
*/
#ifndef __REMOTE_H
@@ -12,13 +12,12 @@
#include <stdio.h>
#include <time.h>
+#include "thread.h"
#include "tools.h"
class cRcIoBase {
protected:
time_t t;
- int firstTime, lastTime;
- unsigned int lastCommand;
cRcIoBase(void);
virtual ~cRcIoBase();
public:
@@ -29,9 +28,9 @@ public:
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 WaitMs = 0) = 0;
- virtual bool InputAvailable(bool Wait = false) = 0;
- virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL) = 0;
+ virtual void Flush(int WaitMs = 0) {}
+ virtual bool InputAvailable(void) = 0;
+ virtual bool GetCommand(unsigned int *Command = NULL) = 0;
};
#if defined REMOTE_KBD
@@ -43,23 +42,27 @@ public:
cRcIoKBD(void);
virtual ~cRcIoKBD();
virtual void Flush(int WaitMs = 0);
- virtual bool InputAvailable(bool Wait = false);
- virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
+ virtual bool InputAvailable(void);
+ virtual bool GetCommand(unsigned int *Command = NULL);
};
#elif defined REMOTE_RCU
-class cRcIoRCU : public cRcIoBase {
+class cRcIoRCU : public cRcIoBase, private cThread {
private:
- cFile f;
+ int f;
unsigned char dp, code, mode;
unsigned short address;
+ unsigned short receivedAddress;
+ unsigned int receivedCommand;
+ bool receivedData, receivedRepeat;
int lastNumber;
bool SendCommand(unsigned char Cmd);
- int ReceiveByte(bool Wait = true);
+ int ReceiveByte(int TimeoutMs = 0);
bool SendByteHandshake(unsigned char c);
bool SendByte(unsigned char c);
bool Digit(int n, int v);
+ virtual void Action(void);
public:
cRcIoRCU(char *DeviceName);
virtual ~cRcIoRCU();
@@ -70,25 +73,24 @@ public:
virtual bool String(char *s);
virtual bool DetectCode(unsigned char *Code, unsigned short *Address);
virtual void Flush(int WaitMs = 0);
- virtual bool InputAvailable(bool Wait = false);
- virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
+ virtual bool InputAvailable(void) { return receivedData; }
+ virtual bool GetCommand(unsigned int *Command = NULL);
};
#elif defined REMOTE_LIRC
-class cRcIoLIRC : public cRcIoBase {
+class cRcIoLIRC : public cRcIoBase, private cThread {
private:
enum { LIRC_KEY_BUF = 8, LIRC_BUFFER_SIZE = 128 };
- cFile f;
+ int f;
char keyName[LIRC_KEY_BUF];
- int repeat;
- const char *ReceiveString(void);
+ bool receivedData, receivedRepeat;
+ virtual void Action(void);
public:
cRcIoLIRC(char *DeviceName);
virtual ~cRcIoLIRC();
- virtual void Flush(int WaitMs = 0);
- virtual bool InputAvailable(bool Wait = false);
- virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
+ virtual bool InputAvailable(void) { return receivedData; }
+ virtual bool GetCommand(unsigned int *Command = NULL);
};
#else