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

The cRemote::CallPlugin() function now has a boolean return value that tells the caller whether initiating the plugin call was successful

This commit is contained in:
Klaus Schmidinger 2006-04-17 09:10:39 +02:00
parent 8c6deb20f2
commit acf716f1ef
5 changed files with 40 additions and 12 deletions

View File

@ -1077,6 +1077,7 @@ Reinhard Nissl <rnissl@gmx.de>
for speeding up cRemux::ScanVideoPacket() for speeding up cRemux::ScanVideoPacket()
for implementing cDevice::ForceTransferMode() for implementing cDevice::ForceTransferMode()
for changing the behaviour when hitting the end of a recording in fast forward mode 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> Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -4500,7 +4500,7 @@ Video Disk Recorder Revision History
- Now checking whether there is any text before calling cStatus::MsgOsdTextItem() - Now checking whether there is any text before calling cStatus::MsgOsdTextItem()
(reported by Joachim Wilke). (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). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed a crash when setting the time transponder in the Setup menu, caused by the - 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 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 with the tilde. Existing recordings will be handled like before, so there is
no need to actually rename them. 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.

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.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" #include "remote.h"
@ -145,10 +145,23 @@ bool cRemote::Put(const char *Code, bool Repeat, bool Release)
return false; return false;
} }
void cRemote::CallPlugin(const char *Plugin) bool cRemote::CallPlugin(const char *Plugin)
{ {
cMutexLock MutexLock(&mutex);
if (!plugin) {
plugin = Plugin; plugin = Plugin;
Put(k_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) bool cRemote::HasKeys(void)

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.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 #ifndef __REMOTE_H
@ -46,11 +46,18 @@ public:
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);
static void CallPlugin(const char *Plugin); static bool CallPlugin(const char *Plugin);
///< Initiates calling the given plugin's main menu function. ///< Initiates calling the given plugin's main menu function.
///< The Plugin parameter is the name of the plugin, and must be ///< The Plugin parameter is the name of the plugin, and must be
///< a static string. ///< a static string. Returns true if the plugin call was successfully
static const char *GetPlugin(void) { return plugin; } ///< 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 bool HasKeys(void);
static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL); static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL);
}; };

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.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" #include "svdrp.h"
@ -1351,8 +1351,10 @@ void cSVDRP::CmdPLUG(const char *Option)
} }
} }
else if (strcasecmp(cmd, "MAIN") == 0) { else if (strcasecmp(cmd, "MAIN") == 0) {
cRemote::CallPlugin(plugin->Name()); if (cRemote::CallPlugin(plugin->Name()))
Reply(250, "Initiated call to main menu function of plugin \"%s\"", 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 { else {
int ReplyCode = 900; int ReplyCode = 900;