mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Added support for defining multiple SAT>IP servers via the command-line switch.
This commit is contained in:
parent
aeb8f24474
commit
18ca0beaa7
4
HISTORY
4
HISTORY
@ -75,5 +75,5 @@ VDR Plugin 'satip' Revision History
|
|||||||
- Added support for Telestar Digibit R1
|
- Added support for Telestar Digibit R1
|
||||||
(Thanks to Dirk Wagner).
|
(Thanks to Dirk Wagner).
|
||||||
- Added a new device status menu.
|
- Added a new device status menu.
|
||||||
- Added a command-line switch for manually defining a
|
- Added a command-line switch for manually defining
|
||||||
SAT>IP server.
|
used SAT>IP servers.
|
||||||
|
2
README
2
README
@ -45,7 +45,7 @@ to one. This parameter defines how many simultaneous transponders can
|
|||||||
be received, if there are available SAT>IP tuners.
|
be received, if there are available SAT>IP tuners.
|
||||||
|
|
||||||
The plugin accepts also a "--server" (-s) command-line parameter, that
|
The plugin accepts also a "--server" (-s) command-line parameter, that
|
||||||
can be used to manually configure one SAT>IP server, if autodetection
|
can be used to manually configure static SAT>IP servers if autodetection
|
||||||
via UPnP somehow can't be used.
|
via UPnP somehow can't be used.
|
||||||
|
|
||||||
SAT>IP satellite positions (aka. signal sources) shall be defined via
|
SAT>IP satellite positions (aka. signal sources) shall be defined via
|
||||||
|
10
discover.c
10
discover.c
@ -32,12 +32,14 @@ cSatipDiscover *cSatipDiscover::GetInstance(void)
|
|||||||
return instanceS;
|
return instanceS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipDiscover::Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP)
|
bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, serverAddrP ? serverAddrP : "auto", serverDescriptionP ? serverDescriptionP : "auto", serverModelP ? serverModelP : "auto");
|
debug("cSatipDiscover::%s()", __FUNCTION__);
|
||||||
if (instanceS) {
|
if (instanceS) {
|
||||||
if (serverAddrP && serverDescriptionP && serverModelP)
|
if (serversP) {
|
||||||
instanceS->AddServer(serverAddrP, serverDescriptionP, serverModelP);
|
for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s))
|
||||||
|
instanceS->AddServer(s->IpAddress(), s->Description(), s->Model());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
instanceS->Activate();
|
instanceS->Activate();
|
||||||
}
|
}
|
||||||
|
20
discover.h
20
discover.h
@ -16,6 +16,24 @@
|
|||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
|
|
||||||
|
class cSatipDiscoverServer : public cListObject {
|
||||||
|
private:
|
||||||
|
cString ipAddressM;
|
||||||
|
cString descriptionM;
|
||||||
|
cString modelM;
|
||||||
|
public:
|
||||||
|
cSatipDiscoverServer(const char *ipAddressP, const char *descriptionP, const char *modelP)
|
||||||
|
{
|
||||||
|
ipAddressM = ipAddressP; descriptionM = descriptionP; modelM = modelP;
|
||||||
|
}
|
||||||
|
const char *IpAddress(void) { return *ipAddressM; }
|
||||||
|
const char *Description(void) { return *descriptionM; }
|
||||||
|
const char *Model(void) { return *modelM; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class cSatipDiscoverServers : public cList<cSatipDiscoverServer> {
|
||||||
|
};
|
||||||
|
|
||||||
class cSatipDiscover : public cThread {
|
class cSatipDiscover : public cThread {
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
@ -52,7 +70,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static cSatipDiscover *GetInstance(void);
|
static cSatipDiscover *GetInstance(void);
|
||||||
static bool Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP);
|
static bool Initialize(cSatipDiscoverServers *serversP);
|
||||||
static void Destroy(void);
|
static void Destroy(void);
|
||||||
virtual ~cSatipDiscover();
|
virtual ~cSatipDiscover();
|
||||||
void TriggerScan(void) { probeIntervalM.Set(0); }
|
void TriggerScan(void) { probeIntervalM.Set(0); }
|
||||||
|
41
satip.c
41
satip.c
@ -31,9 +31,7 @@ static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
|
|||||||
class cPluginSatip : public cPlugin {
|
class cPluginSatip : public cPlugin {
|
||||||
private:
|
private:
|
||||||
unsigned int deviceCountM;
|
unsigned int deviceCountM;
|
||||||
cString serverAddrM;
|
cSatipDiscoverServers *serversM;
|
||||||
cString serverDescriptionM;
|
|
||||||
cString serverModelM;
|
|
||||||
void ParseServer(const char *paramP);
|
void ParseServer(const char *paramP);
|
||||||
int ParseSources(const char *valueP, int *sourcesP);
|
int ParseSources(const char *valueP, int *sourcesP);
|
||||||
int ParseFilters(const char *valueP, int *filtersP);
|
int ParseFilters(const char *valueP, int *filtersP);
|
||||||
@ -62,9 +60,7 @@ public:
|
|||||||
|
|
||||||
cPluginSatip::cPluginSatip(void)
|
cPluginSatip::cPluginSatip(void)
|
||||||
: deviceCountM(1),
|
: deviceCountM(1),
|
||||||
serverAddrM(),
|
serversM(NULL)
|
||||||
serverDescriptionM(),
|
|
||||||
serverModelM()
|
|
||||||
{
|
{
|
||||||
//debug("cPluginSatip::%s()", __FUNCTION__);
|
//debug("cPluginSatip::%s()", __FUNCTION__);
|
||||||
// Initialize any member variables here.
|
// Initialize any member variables here.
|
||||||
@ -82,8 +78,9 @@ const char *cPluginSatip::CommandLineHelp(void)
|
|||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("cPluginSatip::%s()", __FUNCTION__);
|
||||||
// Return a string that describes all known command line options.
|
// 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> set number of devices to be created\n"
|
||||||
" -s <ipaddr>;<model>;<desc>, --server=<ipaddr>;<model>;<desc> use a hard-coded SAT>IP server\n";
|
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
|
||||||
|
" define hard-coded SAT>IP server(s)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||||
@ -119,7 +116,7 @@ bool cPluginSatip::Initialize(void)
|
|||||||
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
|
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
|
||||||
error("Unable to initialize CURL");
|
error("Unable to initialize CURL");
|
||||||
SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
|
SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
|
||||||
cSatipDiscover::GetInstance()->Initialize(*serverAddrM, *serverDescriptionM, *serverModelM);
|
cSatipDiscover::GetInstance()->Initialize(serversM);
|
||||||
return cSatipDevice::Initialize(deviceCountM);
|
return cSatipDevice::Initialize(deviceCountM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,23 +193,37 @@ void cPluginSatip::ParseServer(const char *paramP)
|
|||||||
char *r = strtok_r(p, ";", &s);
|
char *r = strtok_r(p, ";", &s);
|
||||||
while (r) {
|
while (r) {
|
||||||
r = skipspace(r);
|
r = skipspace(r);
|
||||||
//debug("cPluginSatip::%s(): serverparam[%d]=%s", __FUNCTION__, n, r);
|
//debug("cPluginSatip::%s(): server[%d]=%s", __FUNCTION__, n, r);
|
||||||
switch (n++) {
|
cString serverAddr, serverModel, serverDescription;
|
||||||
|
int n2 = 0;
|
||||||
|
char *s2, *p2 = r;
|
||||||
|
char *r2 = strtok_r(p2, "|", &s2);
|
||||||
|
while (r2) {
|
||||||
|
//debug("cPluginSatip::%s(): param[%d]=%s", __FUNCTION__, n2, r2);
|
||||||
|
switch (n2++) {
|
||||||
case 0:
|
case 0:
|
||||||
serverAddrM = r;
|
serverAddr = r2;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
serverModelM = r;
|
serverModel = r2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
serverDescriptionM = r;
|
serverDescription = r2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
r2 = strtok_r(NULL, "|", &s2);
|
||||||
|
}
|
||||||
|
if (*serverAddr && *serverModel && *serverDescription) {
|
||||||
|
debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddr, *serverModel, *serverDescription);
|
||||||
|
if (!serversM)
|
||||||
|
serversM = new cSatipDiscoverServers();
|
||||||
|
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverDescription, *serverModel));
|
||||||
|
}
|
||||||
|
++n;
|
||||||
r = strtok_r(NULL, ";", &s);
|
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)
|
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
|
||||||
|
Loading…
Reference in New Issue
Block a user