Added a command-line switch for manually defining a SAT>IP server.

This commit is contained in:
Rolf Ahrenberg 2014-11-03 23:57:08 +02:00
parent 30e8040f99
commit bde88d78b1
9 changed files with 66 additions and 21 deletions

View File

@ -65,7 +65,7 @@ VDR Plugin 'satip' Revision History
- Added a validity check for the session member.
- Added a session id quirk for Triax TSS 400.
2014-11-01: Version 0.3.4
2014-11-11: Version 0.3.4
- Fixed the cable only device detection.
- Added support for blacklisted sources.
@ -73,3 +73,5 @@ VDR Plugin 'satip' Revision History
- Added a preliminary support for Fritz!WLAN Repeater DVB-C
(Thanks to Christian Wick).
- Added a new device status menu.
- Added a command-line switch for manually defining a
SAT>IP server.

4
README
View File

@ -44,6 +44,10 @@ The plugin accepts a "--devices" (-d) command-line parameter defaulting
to one. This parameter defines how many simultaneous transponders can
be received, if there are available SAT>IP tuners.
The plugin accepts also a "--server" (-s) command-line parameter, that
can be used to manually configure one SAT>IP server, if autodetection
via UPnP somehow can't be used.
SAT>IP satellite positions (aka. signal sources) shall be defined via
sources.conf. If the source description begins with a number, it's used
as SAT>IP signal source selection parameter. Otherwise, the default

View File

@ -32,11 +32,15 @@ cSatipDiscover *cSatipDiscover::GetInstance(void)
return instanceS;
}
bool cSatipDiscover::Initialize(void)
bool cSatipDiscover::Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP)
{
debug("cSatipDiscover::%s()", __FUNCTION__);
if (instanceS)
instanceS->Activate();
debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, serverAddrP ? serverAddrP : "auto", serverDescriptionP ? serverDescriptionP : "auto", serverModelP ? serverModelP : "auto");
if (instanceS) {
if (serverAddrP && serverDescriptionP && serverModelP)
instanceS->AddServer(serverAddrP, serverDescriptionP, serverModelP);
else
instanceS->Activate();
}
return true;
}
@ -98,8 +102,6 @@ cSatipDiscover::cSatipDiscover()
serversM(new cSatipServers())
{
debug("cSatipDiscover::%s()", __FUNCTION__);
// Start the thread
Start();
}
cSatipDiscover::~cSatipDiscover()

View File

@ -52,7 +52,7 @@ protected:
public:
static cSatipDiscover *GetInstance(void);
static bool Initialize(void);
static bool Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP);
static void Destroy(void);
virtual ~cSatipDiscover();
void TriggerScan(void) { probeIntervalM.Set(0); }

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n"
"POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Catalan <vdr@linuxtv.org>\n"
"Language: ca\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n"
"POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n"
"POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Spanish <vdr@linuxtv.org>\n"
"Language: es\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n"
"POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"

47
satip.c
View File

@ -31,7 +31,10 @@ static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin {
private:
unsigned int deviceCountM;
cSatipDiscover *discoverM;
cString serverAddrM;
cString serverDescriptionM;
cString serverModelM;
void ParseServer(const char *paramP);
int ParseSources(const char *valueP, int *sourcesP);
int ParseFilters(const char *valueP, int *filtersP);
public:
@ -59,7 +62,9 @@ public:
cPluginSatip::cPluginSatip(void)
: deviceCountM(1),
discoverM(NULL)
serverAddrM(),
serverDescriptionM(),
serverModelM()
{
//debug("cPluginSatip::%s()", __FUNCTION__);
// Initialize any member variables here.
@ -77,7 +82,8 @@ const char *cPluginSatip::CommandLineHelp(void)
{
debug("cPluginSatip::%s()", __FUNCTION__);
// Return a string that describes all known command line options.
return " -d <num>, --devices=<number> number of devices to be created\n";
return " -d <num>, --devices=<number> number of devices to be created\n"
" -s <ipaddr>;<model>;<desc>, --server=<ipaddr>;<model>;<desc> use a hard-coded SAT>IP server\n";
}
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
@ -86,15 +92,19 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
// Implement command line argument processing here if applicable.
static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' },
{ "server", required_argument, NULL, 's' },
{ NULL, no_argument, NULL, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "d:s:", long_options, NULL)) != -1) {
switch (c) {
case 'd':
deviceCountM = atoi(optarg);
break;
case 's':
ParseServer(optarg);
break;
default:
return false;
}
@ -109,7 +119,7 @@ bool cPluginSatip::Initialize(void)
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
error("Unable to initialize CURL");
SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
cSatipDiscover::GetInstance()->Initialize();
cSatipDiscover::GetInstance()->Initialize(*serverAddrM, *serverDescriptionM, *serverModelM);
return cSatipDevice::Initialize(deviceCountM);
}
@ -178,6 +188,33 @@ cMenuSetupPage *cPluginSatip::SetupMenu(void)
return new cSatipPluginSetup();
}
void cPluginSatip::ParseServer(const char *paramP)
{
debug("cPluginSatip::%s(%s)", __FUNCTION__, paramP);
int n = 0;
char *s, *p = (char *)paramP;
char *r = strtok_r(p, ";", &s);
while (r) {
r = skipspace(r);
//debug("cPluginSatip::%s(): serverparam[%d]=%s", __FUNCTION__, n, r);
switch (n++) {
case 0:
serverAddrM = r;
break;
case 1:
serverModelM = r;
break;
case 2:
serverDescriptionM = r;
break;
default:
break;
}
r = strtok_r(NULL, ";", &s);
}
//debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddrM, *serverModelM, *serverDescriptionM);
}
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
{
debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP);