summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-04-17 09:10:39 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2006-04-17 09:10:39 +0200
commitacf716f1ef5e4cdbc2b38fecdf4d46b2ad75b747 (patch)
tree19e8f750d1092403c40078c607d94715fcb7ebb4
parent8c6deb20f2fc1c77c0fa2698e20f998ebda355a2 (diff)
downloadvdr-acf716f1ef5e4cdbc2b38fecdf4d46b2ad75b747.tar.gz
vdr-acf716f1ef5e4cdbc2b38fecdf4d46b2ad75b747.tar.bz2
The cRemote::CallPlugin() function now has a boolean return value that tells the caller whether initiating the plugin call was successful
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY7
-rw-r--r--remote.c21
-rw-r--r--remote.h15
-rw-r--r--svdrp.c8
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
diff --git a/HISTORY b/HISTORY
index dc937e5c..4efe9ab9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/remote.c b/remote.c
index 1687d018..c0b92867 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.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)
diff --git a/remote.h b/remote.h
index ce6055ff..3a2bb749 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.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);
};
diff --git a/svdrp.c b/svdrp.c
index 0cf73e9f..e0b56e43 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.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;