2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef VOMPSTANDALONE
22 #include <vdr/plugin.h>
27 #include "mvpserver.h"
28 #include "mvpclient.h"
30 static const char *VERSION = "0.2.7";
31 static const char *DESCRIPTION = "VDR on MVP plugin by Chris Tallon";
33 #ifndef VOMPSTANDALONE
34 class cPluginVompserver : public cPlugin
37 cPluginVompserver(void);
38 virtual ~cPluginVompserver();
39 virtual const char *Version(void) { return VERSION; }
40 virtual const char *Description(void) { return DESCRIPTION; }
41 virtual const char *CommandLineHelp(void);
42 virtual bool ProcessArgs(int argc, char *argv[]);
43 virtual bool Initialize(void);
44 virtual bool Start(void);
45 virtual bool SetupParse(const char *Name, const char *Value);
46 #if VDRVERSNUM > 10300
47 virtual cString Active(void);
56 cPluginVompserver::cPluginVompserver(void)
58 // Initialize any member variables here.
59 // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
60 // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
65 bool cPluginVompserver::Start(void)
67 // Start any background activities the plugin shall perform.
68 int success = mvpserver.run(configDir);
69 if (success) return true;
73 cPluginVompserver::~cPluginVompserver()
75 // Clean up after yourself!
79 const char *cPluginVompserver::CommandLineHelp(void)
81 // Return a string that describes all known command line options.
83 return " -c dir config path relative to VDR plugins config path\n";
86 bool cPluginVompserver::ProcessArgs(int argc, char *argv[])
88 // Implement command line argument processing here if applicable.
91 while ((c = getopt(argc, argv, "c:")) != -1)
106 bool cPluginVompserver::Initialize(void)
108 // Initialize any background activities the plugin shall perform.
112 bool cPluginVompserver::SetupParse(const char *Name, const char *Value)
114 // Parse your own setup parameters and store their values.
118 #if VDRVERSNUM > 10300
120 cString cPluginVompserver::Active(void)
122 if(MVPClient::getNrClients() != 0) return tr("VOMP client(s) connected");
128 VDRPLUGINCREATOR(cPluginVompserver); // Don't touch this!
130 #else //VOMPSTANDALONE
132 int main(int argc, char **argv) {
137 std::cout << "Vompserver starting Version " << VERSION << " " << DESCRIPTION << std::endl;
139 if ( server.run(cdir) != 1) {
140 std::cerr << "unable to start vompserver" << std::endl;
147 #endif //VOMPSTANDALONE