1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Implemented the SVDRP command REMO

This commit is contained in:
Klaus Schmidinger 2007-04-30 12:53:35 +02:00
parent d8264ee1b2
commit 6e93ac9525
6 changed files with 39 additions and 5 deletions

View File

@ -585,6 +585,7 @@ Helmut Auer <vdr@helmutauer.de>
for reporting that the shutdown script is given a reboot time in the past if there for reporting that the shutdown script is given a reboot time in the past if there
is a recording going on or about to start, and the user insists in shutting down now is a recording going on or about to start, and the user insists in shutting down now
for suggesting to make the channel entry timeout configurable for suggesting to make the channel entry timeout configurable
for a patch that was used to implement the SVDRP command REMO
Jeremy Hall <jhall@UU.NET> Jeremy Hall <jhall@UU.NET>
for fixing an incomplete initialization of the filter parameters in eit.c for fixing an incomplete initialization of the filter parameters in eit.c
@ -2078,3 +2079,6 @@ Petri Helin <phelin@googlemail.com>
Oktay Yolgeçen <oktay_73@yahoo.de> Oktay Yolgeçen <oktay_73@yahoo.de>
for translating OSD texts to the Turkish language for translating OSD texts to the Turkish language
Krzysztof Parma <krzycho@zoz.wodzislaw.pl>
for suggesting to implement the SVDRP command REMO

View File

@ -5186,3 +5186,6 @@ Video Disk Recorder Revision History
to Anssi Hannula). to Anssi Hannula).
- Fixed handling ChannelUp/Down keys if there is currently a replay running - Fixed handling ChannelUp/Down keys if there is currently a replay running
(thanks to Marco Schlüßler). (thanks to Marco Schlüßler).
- The new SVDRP command REMO can be used to turn VDR's remote control off and
on in case other programs need to be controlled (based on patches from Krzysztof
Parma and Helmut Auer).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: remote.c 1.56 2007/02/24 13:23:12 kls Exp $ * $Id: remote.c 1.57 2007/04/30 12:27:56 kls Exp $
*/ */
#include "remote.h" #include "remote.h"
@ -31,6 +31,7 @@ cMutex cRemote::mutex;
cCondVar cRemote::keyPressed; cCondVar cRemote::keyPressed;
const char *cRemote::keyMacroPlugin = NULL; const char *cRemote::keyMacroPlugin = NULL;
const char *cRemote::callPlugin = NULL; const char *cRemote::callPlugin = NULL;
bool cRemote::enabled = true;
time_t cRemote::lastActivity = 0; time_t cRemote::lastActivity = 0;
cRemote::cRemote(const char *Name) cRemote::cRemote(const char *Name)
@ -185,7 +186,7 @@ eKeys cRemote::Get(int WaitMs, char **UnknownCode)
if ((k & k_Repeat) != 0) if ((k & k_Repeat) != 0)
repeatTimeout.Set(REPEATTIMEOUT); repeatTimeout.Set(REPEATTIMEOUT);
lastActivity = time(NULL); lastActivity = time(NULL);
return k; return enabled ? k : kNone;
} }
else if (!WaitMs || !keyPressed.TimedWait(mutex, WaitMs) && repeatTimeout.TimedOut()) else if (!WaitMs || !keyPressed.TimedWait(mutex, WaitMs) && repeatTimeout.TimedOut())
return kNone; return kNone;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: remote.h 1.39 2007/02/24 15:53:00 kls Exp $ * $Id: remote.h 1.40 2007/04/30 12:37:37 kls Exp $
*/ */
#ifndef __REMOTE_H #ifndef __REMOTE_H
@ -31,6 +31,7 @@ private:
static time_t lastActivity; static time_t lastActivity;
static const char *keyMacroPlugin; static const char *keyMacroPlugin;
static const char *callPlugin; static const char *callPlugin;
static bool enabled;
char *name; char *name;
protected: protected:
cRemote(const char *Name); cRemote(const char *Name);
@ -45,6 +46,8 @@ public:
const char *Name(void) { return name; } const char *Name(void) { return name; }
static void SetLearning(cRemote *Learning) { learning = Learning; } static void SetLearning(cRemote *Learning) { learning = Learning; }
static bool IsLearning() { return learning != NULL; } static bool IsLearning() { return learning != NULL; }
static bool Enabled(void) { return enabled; }
static void SetEnabled(bool Enabled) { enabled = Enabled; }
static void Clear(void); static void Clear(void);
static bool Put(eKeys Key, bool AtFront = false); static bool Put(eKeys Key, bool AtFront = false);
static bool PutMacro(eKeys Key); static bool PutMacro(eKeys Key);

24
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * graphical interface that sits on top of an SVDRP connection.
* *
* $Id: svdrp.c 1.100 2006/08/12 09:09:55 kls Exp $ * $Id: svdrp.c 1.101 2007/04/30 12:41:07 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@ -290,6 +290,9 @@ const char *HelpPages[] = {
" format defined in vdr(5) for the 'epg.data' file. A '.' on a line\n" " format defined in vdr(5) for the 'epg.data' file. A '.' on a line\n"
" by itself terminates the input and starts processing of the data (all\n" " by itself terminates the input and starts processing of the data (all\n"
" entered data is buffered until the terminating '.' is seen).", " entered data is buffered until the terminating '.' is seen).",
"REMO [ on | off ]\n"
" Turns the remote control on or off. Without a parameter, the current\n"
" status of the remote control is reported.",
"SCAN\n" "SCAN\n"
" Forces an EPG scan. If this is a single DVB device system, the scan\n" " Forces an EPG scan. If this is a single DVB device system, the scan\n"
" will be done on the primary device unless it is currently recording.", " will be done on the primary device unless it is currently recording.",
@ -1406,6 +1409,24 @@ void cSVDRP::CmdPUTE(const char *Option)
DELETENULL(PUTEhandler); DELETENULL(PUTEhandler);
} }
void cSVDRP::CmdREMO(const char *Option)
{
if (*Option) {
if (!strcasecmp(Option, "ON")) {
cRemote::SetEnabled(true);
Reply(250, "Remote control enabled");
}
else if (!strcasecmp(Option, "OFF")) {
cRemote::SetEnabled(false);
Reply(250, "Remote control disabled");
}
else
Reply(501, "Invalid Option \"%s\"", Option);
}
else
Reply(250, "Remote control is %s", cRemote::Enabled() ? "enabled" : "disabled");
}
void cSVDRP::CmdSCAN(const char *Option) void cSVDRP::CmdSCAN(const char *Option)
{ {
EITScanner.ForceScan(); EITScanner.ForceScan();
@ -1526,6 +1547,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("PLAY")) CmdPLAY(s); else if (CMD("PLAY")) CmdPLAY(s);
else if (CMD("PLUG")) CmdPLUG(s); else if (CMD("PLUG")) CmdPLUG(s);
else if (CMD("PUTE")) CmdPUTE(s); else if (CMD("PUTE")) CmdPUTE(s);
else if (CMD("REMO")) CmdREMO(s);
else if (CMD("SCAN")) CmdSCAN(s); else if (CMD("SCAN")) CmdSCAN(s);
else if (CMD("STAT")) CmdSTAT(s); else if (CMD("STAT")) CmdSTAT(s);
else if (CMD("UPDT")) CmdUPDT(s); else if (CMD("UPDT")) CmdUPDT(s);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: svdrp.h 1.28 2006/08/06 08:51:09 kls Exp $ * $Id: svdrp.h 1.29 2007/04/30 12:28:28 kls Exp $
*/ */
#ifndef __SVDRP_H #ifndef __SVDRP_H
@ -78,6 +78,7 @@ private:
void CmdPLAY(const char *Option); void CmdPLAY(const char *Option);
void CmdPLUG(const char *Option); void CmdPLUG(const char *Option);
void CmdPUTE(const char *Option); void CmdPUTE(const char *Option);
void CmdREMO(const char *Option);
void CmdSCAN(const char *Option); void CmdSCAN(const char *Option);
void CmdSTAT(const char *Option); void CmdSTAT(const char *Option);
void CmdUPDT(const char *Option); void CmdUPDT(const char *Option);