From 6e93ac95258aeb37b6b642484ccaa37e091b84ab Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 30 Apr 2007 12:53:35 +0200 Subject: [PATCH] Implemented the SVDRP command REMO --- CONTRIBUTORS | 4 ++++ HISTORY | 3 +++ remote.c | 5 +++-- remote.h | 5 ++++- svdrp.c | 24 +++++++++++++++++++++++- svdrp.h | 3 ++- 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b2aaa52e..a639d39c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -585,6 +585,7 @@ Helmut Auer 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 for suggesting to make the channel entry timeout configurable + for a patch that was used to implement the SVDRP command REMO Jeremy Hall for fixing an incomplete initialization of the filter parameters in eit.c @@ -2078,3 +2079,6 @@ Petri Helin Oktay Yolgeçen for translating OSD texts to the Turkish language + +Krzysztof Parma + for suggesting to implement the SVDRP command REMO diff --git a/HISTORY b/HISTORY index fb3ed56d..910efbaa 100644 --- a/HISTORY +++ b/HISTORY @@ -5186,3 +5186,6 @@ Video Disk Recorder Revision History to Anssi Hannula). - Fixed handling ChannelUp/Down keys if there is currently a replay running (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). diff --git a/remote.c b/remote.c index bbc73787..c7eb7fb9 100644 --- a/remote.c +++ b/remote.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -31,6 +31,7 @@ cMutex cRemote::mutex; cCondVar cRemote::keyPressed; const char *cRemote::keyMacroPlugin = NULL; const char *cRemote::callPlugin = NULL; +bool cRemote::enabled = true; time_t cRemote::lastActivity = 0; cRemote::cRemote(const char *Name) @@ -185,7 +186,7 @@ eKeys cRemote::Get(int WaitMs, char **UnknownCode) if ((k & k_Repeat) != 0) repeatTimeout.Set(REPEATTIMEOUT); lastActivity = time(NULL); - return k; + return enabled ? k : kNone; } else if (!WaitMs || !keyPressed.TimedWait(mutex, WaitMs) && repeatTimeout.TimedOut()) return kNone; diff --git a/remote.h b/remote.h index fb326897..a38d6616 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.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 @@ -31,6 +31,7 @@ private: static time_t lastActivity; static const char *keyMacroPlugin; static const char *callPlugin; + static bool enabled; char *name; protected: cRemote(const char *Name); @@ -45,6 +46,8 @@ public: const char *Name(void) { return name; } static void SetLearning(cRemote *Learning) { learning = Learning; } static bool IsLearning() { return learning != NULL; } + static bool Enabled(void) { return enabled; } + static void SetEnabled(bool Enabled) { enabled = Enabled; } static void Clear(void); static bool Put(eKeys Key, bool AtFront = false); static bool PutMacro(eKeys Key); diff --git a/svdrp.c b/svdrp.c index 8ca8afd1..96bc3836 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * 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" @@ -290,6 +290,9 @@ const char *HelpPages[] = { " 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" " 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" " 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.", @@ -1406,6 +1409,24 @@ void cSVDRP::CmdPUTE(const char *Option) 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) { EITScanner.ForceScan(); @@ -1526,6 +1547,7 @@ void cSVDRP::Execute(char *Cmd) else if (CMD("PLAY")) CmdPLAY(s); else if (CMD("PLUG")) CmdPLUG(s); else if (CMD("PUTE")) CmdPUTE(s); + else if (CMD("REMO")) CmdREMO(s); else if (CMD("SCAN")) CmdSCAN(s); else if (CMD("STAT")) CmdSTAT(s); else if (CMD("UPDT")) CmdUPDT(s); diff --git a/svdrp.h b/svdrp.h index 65d2f69c..deee42ca 100644 --- a/svdrp.h +++ b/svdrp.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -78,6 +78,7 @@ private: void CmdPLAY(const char *Option); void CmdPLUG(const char *Option); void CmdPUTE(const char *Option); + void CmdREMO(const char *Option); void CmdSCAN(const char *Option); void CmdSTAT(const char *Option); void CmdUPDT(const char *Option);