vdr/remote.h
Klaus Schmidinger 9f42c33ef6 Version 1.5.1
- Added cDevice::HasCi() so that devices with Common Interface can be avoided
  when tuning to an FTA channel, thus preserving the CAM resources even on budget
  DVB cards (suggested by Petri Helin).
- Fixed i18n characters for the Hungarian texts (thanks to Thomas Günther).
- Now using cPipe instead of popen() in cCommand::Execute() to avoid problems
  with open file handles when starting background commands (thanks to Reinhard
  Nissl).
- Removed 'assert(0)' from cDvbSpuDecoder::setTime() (thanks to Marco Schlüßler).
- Fixed a possible crash when loading an invalid XPM file (thanks to Martin Wache).
- Updated satellite names in 'sources.conf' (thanks to Thilo Wunderlich).
- Adapted 'libsi' to DVB-S2 (thanks to Marco Schlüßler).
- Fixed handling error status in cDvbTuner::GetFrontendStatus() (thanks to
  Reinhard Nissl).
- Shutdown handling has been rewritten (thanks to Udo Richter).
- Plugins can now implement the new function WakeupTime() to request VDR to wake
  up at a particular time (thanks to Udo Richter).
- The HUP signal now forces a restart of VDR (thanks to Udo Richter).
- cThread::EmergencyExit() has been replaced by ShutdownHandler.RequestEmergencyExit().
- Several references to "button" in a remote control context have been changed
  to "key" (based on a report from Marko Mäkelä regarding the "Menu button closes"
  text). The "MenuButtonCloses" parameter in 'setup.conf' has therefore been
  renamed to "MenuKeyCloses", accordingly. This will result in an "unknown config
  parameter: MenuButtonCloses" error message in the log file, so you may want to
  remove that entry from your 'setup.conf' file.
- Simplified the error handling in cDvbTuner::GetFrontendStatus() (based on a
  discussion with Reinhard Nissl).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Increased the maximum number of DVB devices to 8 (thanks to Rolf Ahrenberg).
- The new Setup parameter "Channel entry timeout" can be used to customize the time
  since the last keypress until a numerically entered channel number is considered
  complete, and the channel is switched (suggested by Helmut Auer). Setting this
  parameter to 0 turns off the automatic channel switching, and the user will
  have to confirm the entry by pressing the "Ok" key.
2007-02-25 18:00:00 +01:00

117 lines
3.1 KiB
C++

/*
* remote.h: General Remote Control handling
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.h 1.39 2007/02/24 15:53:00 kls Exp $
*/
#ifndef __REMOTE_H
#define __REMOTE_H
#include <stdio.h>
#include <termios.h>
#include <time.h>
#include "keys.h"
#include "thread.h"
#include "tools.h"
class cRemote : public cListObject {
private:
enum { MaxKeys = 2 * MAXKEYSINMACRO };
static eKeys keys[MaxKeys];
static int in;
static int out;
static cTimeMs repeatTimeout;
static cRemote *learning;
static char *unknownCode;
static cMutex mutex;
static cCondVar keyPressed;
static time_t lastActivity;
static const char *keyMacroPlugin;
static const char *callPlugin;
char *name;
protected:
cRemote(const char *Name);
const char *GetSetup(void);
void PutSetup(const char *Setup);
bool Put(uint64_t Code, bool Repeat = false, bool Release = false);
bool Put(const char *Code, bool Repeat = false, bool Release = false);
public:
virtual ~cRemote();
virtual bool Ready(void) { return true; }
virtual bool Initialize(void);
const char *Name(void) { return name; }
static void SetLearning(cRemote *Learning) { learning = Learning; }
static bool IsLearning() { return learning != NULL; }
static void Clear(void);
static bool Put(eKeys Key, bool AtFront = false);
static bool PutMacro(eKeys Key);
static bool CallPlugin(const char *Plugin);
///< Initiates calling the given plugin's main menu function.
///< The Plugin parameter is the name of the plugin, and must be
///< a static string. Returns true if the plugin call was successfully
///< initiated (the actual call to the plugin's main menu function
///< will take place some time later, during the next execution
///< of VDR's main loop). If there is already a plugin call pending
///< false will be returned and the caller should try again later.
static const char *GetPlugin(void);
///< Returns the name of the plugin that was set with a previous
///< call to PutMacro() or CallPlugin(). The internally stored pointer to the
///< plugin name will be reset to NULL by this call.
static bool HasKeys(void);
static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL);
static time_t LastActivity(void) { return lastActivity; }
///< Absolute time when last key was delivered by Get().
};
class cRemotes : public cList<cRemote> {};
extern cRemotes Remotes;
enum eKbdFunc {
kfNone,
kfF1 = 0x100,
kfF2,
kfF3,
kfF4,
kfF5,
kfF6,
kfF7,
kfF8,
kfF9,
kfF10,
kfF11,
kfF12,
kfUp,
kfDown,
kfLeft,
kfRight,
kfHome,
kfEnd,
kfPgUp,
kfPgDown,
kfIns,
kfDel,
};
class cKbdRemote : public cRemote, private cThread {
private:
static bool kbdAvailable;
static bool rawMode;
struct termios savedTm;
virtual void Action(void);
int ReadKey(void);
uint64_t ReadKeySequence(void);
int MapCodeToFunc(uint64_t Code);
public:
cKbdRemote(void);
virtual ~cKbdRemote();
static bool KbdAvailable(void) { return kbdAvailable; }
static uint64_t MapFuncToCode(int Func);
static void SetRawMode(bool RawMode);
};
#endif //__REMOTE_H