diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 7 | ||||
-rw-r--r-- | remote.c | 21 | ||||
-rw-r--r-- | remote.h | 15 | ||||
-rw-r--r-- | svdrp.c | 8 |
5 files changed, 40 insertions, 12 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 18216f0e..3091b97e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1077,6 +1077,7 @@ Reinhard Nissl <rnissl@gmx.de> for speeding up cRemux::ScanVideoPacket() for implementing cDevice::ForceTransferMode() for changing the behaviour when hitting the end of a recording in fast forward mode + for suggesting to give the cRemote::CallPlugin() function a boolean return value Richard Robson <richard_robson@beeb.net> for reporting freezing replay if a timer starts while in Transfer Mode from the @@ -4500,7 +4500,7 @@ Video Disk Recorder Revision History - Now checking whether there is any text before calling cStatus::MsgOsdTextItem() (reported by Joachim Wilke). -2006-04-15: Version 1.3.47 +2006-04-17: Version 1.3.47 - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed a crash when setting the time transponder in the Setup menu, caused by the @@ -4611,3 +4611,8 @@ Video Disk Recorder Revision History with XML). The single quote is not mapped at all, and the slash is interchanged with the tilde. Existing recordings will be handled like before, so there is no need to actually rename them. +- The cRemote::CallPlugin() function now has a boolean return value that tells + the caller whether initiating the plugin call was successful (suggested by + Reinhard Nissl). If it returns false, another plugin call is currently pending + and the caller should try again later. This also means that the SVDRP command + PLUG can now return an error code is the call fails. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 1.49 2006/01/29 12:27:08 kls Exp $ + * $Id: remote.c 1.50 2006/04/17 08:58:28 kls Exp $ */ #include "remote.h" @@ -145,10 +145,23 @@ bool cRemote::Put(const char *Code, bool Repeat, bool Release) return false; } -void cRemote::CallPlugin(const char *Plugin) +bool cRemote::CallPlugin(const char *Plugin) { - plugin = Plugin; - Put(k_Plugin); + cMutexLock MutexLock(&mutex); + if (!plugin) { + plugin = Plugin; + Put(k_Plugin); + return true; + } + return false; +} + +const char *cRemote::GetPlugin(void) +{ + cMutexLock MutexLock(&mutex); + const char *p = plugin; + plugin = NULL; + return p; } bool cRemote::HasKeys(void) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.h 1.34 2006/03/31 14:18:44 kls Exp $ + * $Id: remote.h 1.35 2006/04/17 08:59:48 kls Exp $ */ #ifndef __REMOTE_H @@ -46,11 +46,18 @@ public: static void Clear(void); static bool Put(eKeys Key, bool AtFront = false); static bool PutMacro(eKeys Key); - static void CallPlugin(const char *Plugin); + 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. - static const char *GetPlugin(void) { return plugin; } + ///< 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 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); }; @@ -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.94 2006/03/26 09:14:13 kls Exp $ + * $Id: svdrp.c 1.95 2006/04/17 09:02:23 kls Exp $ */ #include "svdrp.h" @@ -1351,8 +1351,10 @@ void cSVDRP::CmdPLUG(const char *Option) } } else if (strcasecmp(cmd, "MAIN") == 0) { - cRemote::CallPlugin(plugin->Name()); - Reply(250, "Initiated call to main menu function of plugin \"%s\"", plugin->Name()); + if (cRemote::CallPlugin(plugin->Name())) + Reply(250, "Initiated call to main menu function of plugin \"%s\"", plugin->Name()); + else + Reply(550, "A plugin call is already pending - please try again later"); } else { int ReplyCode = 900; |