summaryrefslogtreecommitdiff
path: root/PLUGINS/src/servicedemo/svccli.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-21 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-21 18:00:00 +0200
commitdab203efe9e24f1dade33ee1da6a39b26f8501f0 (patch)
tree9399cbee3798f5232eddca484e118275fe8e472e /PLUGINS/src/servicedemo/svccli.c
parentddd1e13e53c4970058884e2af31c2681617e7bf3 (diff)
downloadvdr-patch-lnbsharing-dab203efe9e24f1dade33ee1da6a39b26f8501f0.tar.gz
vdr-patch-lnbsharing-dab203efe9e24f1dade33ee1da6a39b26f8501f0.tar.bz2
Version 1.3.30vdr-1.3.30
- Improved responsiveness inside CAM menus. - Added handling of the 'Close MMI' tag to avoid error log messages with CAMs that actually use it. - Now waiting at startup until all DVB devices are ready. This includes having all CAMs initialized and ready to decrypt, so that no more "channel not available" happens if VDR is started with the current channel being an encrypted one, or a timer on such a channel hits right after starting VDR. - Fixed cVideoRepacker to better handle errors in data (thanks to Reinhard Nissl). - Fixed cDvbTuner to avoid lockups on NPTL systems (thanks to Marcel Wiesweg). - Added 'Service' functions to the plugin interface (thanks to Udo Richter). See PLUGINS.html, section "Custom services" for details. - Replaced the get/put_unaligned() macros from <asm/unaligned.h> with own inline functions to avoid problems on platforms that don't provide these (thanks to David Woodhouse for his help).
Diffstat (limited to 'PLUGINS/src/servicedemo/svccli.c')
-rw-r--r--PLUGINS/src/servicedemo/svccli.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/PLUGINS/src/servicedemo/svccli.c b/PLUGINS/src/servicedemo/svccli.c
new file mode 100644
index 0000000..9a4ed44
--- /dev/null
+++ b/PLUGINS/src/servicedemo/svccli.c
@@ -0,0 +1,90 @@
+/*
+ * svccli.c: Sample service client plugin
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ * $Id: svccli.c 1.1 2005/08/21 10:44:29 kls Exp $
+ */
+
+#include <stdlib.h>
+#include <vdr/interface.h>
+#include <vdr/plugin.h>
+
+static const char *VERSION = "0.1.1";
+static const char *DESCRIPTION = "Service demo client";
+static const char *MAINMENUENTRY = "Service demo";
+
+class cPluginSvcCli : public cPlugin {
+public:
+ virtual const char *Version(void) { return VERSION; }
+ virtual const char *Description(void) { return DESCRIPTION; }
+ virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
+ virtual cOsdObject *MainMenuAction(void);
+ virtual bool Service(const char *Id, void *Data);
+ };
+
+struct ReportBoredPlugin_v1_0 {
+ cPlugin *BoredPlugin;
+ };
+
+struct AddService_v1_0 {
+ int a, b;
+ int sum;
+ };
+
+// --- cPluginSvcCli ----------------------------------------------------------
+
+cOsdObject *cPluginSvcCli::MainMenuAction(void)
+{
+ char s[128];
+ cPlugin *p;
+
+ // Inform server plugin that we are bored
+ // (directed communication)
+ ReportBoredPlugin_v1_0 rbp;
+ rbp.BoredPlugin = this;
+ p = cPluginManager::GetPlugin("svcsvr");
+ if (p)
+ p->Service("ReportBoredPlugin-v1.0", &rbp);
+
+ // See if any plugin can add
+ // (detect capability)
+ p = cPluginManager::CallFirstService("AddService-v1.0", NULL);
+ if (p) {
+ snprintf(s, sizeof(s), "Plugin %s can add", p->Name());
+ Interface->Confirm(s);
+ }
+
+ // Perform add
+ // (use general service)
+ AddService_v1_0 adds;
+ adds.a = 1;
+ adds.b = 1;
+ if (cPluginManager::CallFirstService("AddService-v1.0", &adds)) {
+ snprintf(s, sizeof(s), "Plugin thinks that 1+1=%i", adds.sum);
+ Interface->Confirm(s);
+ }
+
+ // Inform other plugins that we are bored
+ // (broadcast)
+ rbp.BoredPlugin = this;
+ cPluginManager::CallAllServices("ReportBoredPlugin-v1.0", &rbp);
+
+ return NULL;
+}
+
+bool cPluginSvcCli::Service(const char *Id, void *Data)
+{
+ if (strcmp(Id, "ReportBoredPlugin-v1.0") == 0) {
+ if (Data) {
+ ReportBoredPlugin_v1_0 *rbp = (ReportBoredPlugin_v1_0*)Data;
+ char s[128];
+ snprintf(s, sizeof(s), "Plugin %s informed client that it is bored.", rbp->BoredPlugin->Name());
+ Interface->Confirm(s);
+ }
+ return true;
+ }
+ return false;
+}
+
+VDRPLUGINCREATOR(cPluginSvcCli); // Don't touch this!