2000-02-19 13:36:48 +01:00
|
|
|
/*
|
2002-09-29 13:40:45 +02:00
|
|
|
* remote.h: General Remote Control handling
|
2000-02-19 13:36:48 +01:00
|
|
|
*
|
2000-04-24 09:46:05 +02:00
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
2000-02-19 13:36:48 +01:00
|
|
|
* how to reach the author.
|
|
|
|
*
|
2002-10-27 15:46:30 +01:00
|
|
|
* $Id: remote.h 1.18 2002/10/27 15:16:50 kls Exp $
|
2000-02-19 13:36:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __REMOTE_H
|
|
|
|
#define __REMOTE_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
2002-09-29 13:40:45 +02:00
|
|
|
#include "keys.h"
|
2000-10-08 09:25:20 +02:00
|
|
|
#include "thread.h"
|
2000-09-17 08:23:46 +02:00
|
|
|
#include "tools.h"
|
2000-02-19 13:36:48 +01:00
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
typedef unsigned long long int uint64;
|
2000-07-15 12:39:20 +02:00
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
class cRemote : public cListObject {
|
2000-09-17 08:23:46 +02:00
|
|
|
private:
|
2002-10-27 15:46:30 +01:00
|
|
|
enum { MaxKeys = MAXKEYSINMACRO };
|
2002-09-29 13:40:45 +02:00
|
|
|
static eKeys keys[MaxKeys];
|
|
|
|
static int in;
|
|
|
|
static int out;
|
|
|
|
static bool learning;
|
|
|
|
static char *unknownCode;
|
|
|
|
static cMutex mutex;
|
|
|
|
static cCondVar keyPressed;
|
|
|
|
char *name;
|
|
|
|
protected:
|
|
|
|
cRemote(const char *Name);
|
|
|
|
const char *GetSetup(void);
|
|
|
|
void PutSetup(const char *Setup);
|
|
|
|
bool Put(uint64 Code, bool Repeat = false, bool Release = false);
|
|
|
|
bool Put(const char *Code, bool Repeat = false, bool Release = false);
|
2000-07-15 12:39:20 +02:00
|
|
|
public:
|
2002-09-29 13:40:45 +02:00
|
|
|
virtual ~cRemote();
|
|
|
|
virtual bool Initialize(void) { return true; }
|
|
|
|
const char *Name(void) { return name; }
|
|
|
|
static void SetLearning(bool On) { learning = On; }
|
|
|
|
static void Clear(void);
|
|
|
|
static bool Put(eKeys Key);
|
2002-10-27 15:46:30 +01:00
|
|
|
static bool PutMacro(eKeys Key);
|
2002-09-29 13:40:45 +02:00
|
|
|
static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL);
|
2000-07-15 12:39:20 +02:00
|
|
|
};
|
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
class cRemotes : public cList<cRemote> {};
|
2000-07-15 12:39:20 +02:00
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
extern cRemotes Remotes;
|
2000-07-15 12:39:20 +02:00
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
#if defined REMOTE_KBD
|
2000-07-15 12:39:20 +02:00
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
class cKbdRemote : public cRemote, private cThread {
|
2000-07-15 12:39:20 +02:00
|
|
|
private:
|
2000-10-08 09:25:20 +02:00
|
|
|
virtual void Action(void);
|
2000-07-15 12:39:20 +02:00
|
|
|
public:
|
2002-09-29 13:40:45 +02:00
|
|
|
cKbdRemote(void);
|
|
|
|
virtual ~cKbdRemote();
|
2000-02-19 13:36:48 +01:00
|
|
|
};
|
|
|
|
|
2000-07-15 12:39:20 +02:00
|
|
|
#endif
|
|
|
|
|
2000-02-19 13:36:48 +01:00
|
|
|
#endif //__REMOTE_H
|