mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Added initial support for detaching and attaching SAT>IP servers.
This commit is contained in:
parent
fe010ab72c
commit
8b43cdc634
1
config.c
1
config.c
@ -17,6 +17,7 @@ cSatipConfig::cSatipConfig(void)
|
||||
ciExtensionM(0),
|
||||
eitScanM(1),
|
||||
useBytesM(1),
|
||||
detachedModeM(false),
|
||||
disableServerQuirksM(false),
|
||||
useSingleModelServersM(false)
|
||||
{
|
||||
|
3
config.h
3
config.h
@ -19,6 +19,7 @@ private:
|
||||
unsigned int ciExtensionM;
|
||||
unsigned int eitScanM;
|
||||
unsigned int useBytesM;
|
||||
bool detachedModeM;
|
||||
bool disableServerQuirksM;
|
||||
bool useSingleModelServersM;
|
||||
int cicamsM[MAX_CICAM_COUNT];
|
||||
@ -66,6 +67,7 @@ public:
|
||||
int GetCICAM(unsigned int indexP) const;
|
||||
unsigned int GetEITScan(void) const { return eitScanM; }
|
||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||
bool GetDetachedMode(void) const { return detachedModeM; }
|
||||
bool GetDisableServerQuirks(void) const { return disableServerQuirksM; }
|
||||
bool GetUseSingleModelServers(void) const { return useSingleModelServersM; }
|
||||
unsigned int GetDisabledSourcesCount(void) const;
|
||||
@ -79,6 +81,7 @@ public:
|
||||
void SetCICAM(unsigned int indexP, int cicamP);
|
||||
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
|
||||
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
||||
void SetDetachedMode(bool onOffP) { detachedModeM = onOffP; }
|
||||
void SetDisableServerQuirks(bool onOffP) { disableServerQuirksM = onOffP; }
|
||||
void SetUseSingleModelServers(bool onOffP) { useSingleModelServersM = onOffP; }
|
||||
void SetDisabledSources(unsigned int indexP, int sourceP);
|
||||
|
4
device.c
4
device.c
@ -219,6 +219,8 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
|
||||
{
|
||||
cSource *s = Sources.Get(sourceP);
|
||||
debug9("%s (%c) desc='%s' [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), s ? s->Description() : "", deviceIndexM);
|
||||
if (SatipConfig.GetDetachedMode())
|
||||
return false;
|
||||
// source descriptions starting with '0' are disabled
|
||||
if (s && s->Description() && (*(s->Description()) == '0'))
|
||||
return false;
|
||||
@ -501,6 +503,8 @@ void cSatipDevice::SkipData(int countP)
|
||||
bool cSatipDevice::GetTSPacket(uchar *&dataP)
|
||||
{
|
||||
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
if (SatipConfig.GetDetachedMode())
|
||||
return false;
|
||||
if (tsBufferM) {
|
||||
if (cCamSlot *cs = CamSlot()) {
|
||||
if (cs->WantsTsData()) {
|
||||
|
21
satip.c
21
satip.c
@ -85,6 +85,7 @@ const char *cPluginSatip::CommandLineHelp(void)
|
||||
" -t <mode>, --trace=<mode> set the tracing mode\n"
|
||||
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
|
||||
" define hard-coded SAT>IP server(s)\n"
|
||||
" -D, --detach set the detached mode on\n"
|
||||
" -S, --single set the single model server mode on\n"
|
||||
" -n, --noquirks disable all the server quirks\n";
|
||||
}
|
||||
@ -97,6 +98,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||
{ "devices", required_argument, NULL, 'd' },
|
||||
{ "trace", required_argument, NULL, 't' },
|
||||
{ "server", required_argument, NULL, 's' },
|
||||
{ "detach", no_argument, NULL, 'D' },
|
||||
{ "single", no_argument, NULL, 'S' },
|
||||
{ "noquirks", no_argument, NULL, 'n' },
|
||||
{ NULL, no_argument, NULL, 0 }
|
||||
@ -104,7 +106,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||
|
||||
cString server;
|
||||
int c;
|
||||
while ((c = getopt_long(argc, argv, "d:t:s:Sn", long_options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "d:t:s:DSn", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'd':
|
||||
deviceCountM = strtol(optarg, NULL, 0);
|
||||
@ -115,6 +117,9 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||
case 's':
|
||||
server = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
SatipConfig.SetDetachedMode(true);
|
||||
break;
|
||||
case 'S':
|
||||
SatipConfig.SetUseSingleModelServers(true);
|
||||
break;
|
||||
@ -368,6 +373,10 @@ const char **cPluginSatip::SVDRPHelpPages(void)
|
||||
" Shows SAT>IP device count.\n",
|
||||
"OPER [ off | low | normal | high ]\n"
|
||||
" Gets and(or sets operating mode of SAT>IP devices.\n",
|
||||
"ATTA\n"
|
||||
" Attach active SAT>IP servers.\n",
|
||||
"DETA\n"
|
||||
" Detachs active SAT>IP servers.\n",
|
||||
"TRAC [ <mode> ]\n"
|
||||
" Gets and/or sets used tracing mode.\n",
|
||||
NULL
|
||||
@ -465,6 +474,16 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in
|
||||
}
|
||||
return cString::sprintf("SATIP operating mode: %s\n", *mode);
|
||||
}
|
||||
else if (strcasecmp(commandP, "ATTA") == 0) {
|
||||
SatipConfig.SetDetachedMode(false);
|
||||
info("SATIP servers attached");
|
||||
return cString("SATIP servers attached");
|
||||
}
|
||||
else if (strcasecmp(commandP, "DETA") == 0) {
|
||||
SatipConfig.SetDetachedMode(true);
|
||||
info("SATIP servers detached");
|
||||
return cString("SATIP servers detached");
|
||||
}
|
||||
else if (strcasecmp(commandP, "TRAC") == 0) {
|
||||
if (optionP && *optionP)
|
||||
SatipConfig.SetTraceMode(strtol(optionP, NULL, 0));
|
||||
|
20
setup.c
20
setup.c
@ -330,7 +330,8 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP)
|
||||
// --- cSatipPluginSetup ------------------------------------------------------
|
||||
|
||||
cSatipPluginSetup::cSatipPluginSetup()
|
||||
: deviceCountM(0),
|
||||
: detachedModeM(SatipConfig.GetDetachedMode()),
|
||||
deviceCountM(0),
|
||||
operatingModeM(SatipConfig.GetOperatingMode()),
|
||||
ciExtensionM(SatipConfig.GetCIExtension()),
|
||||
eitScanM(SatipConfig.GetEITScan()),
|
||||
@ -402,12 +403,15 @@ void cSatipPluginSetup::Setup(void)
|
||||
Add(new cOsdItem(tr("Active SAT>IP servers:"), osUnknown, false));
|
||||
helpM.Append("");
|
||||
|
||||
cSatipServers *servers = cSatipDiscover::GetInstance()->GetServers();
|
||||
deviceCountM = servers->Count();
|
||||
for (cSatipServer *s = servers->First(); s; s = servers->Next(s)) {
|
||||
Add(new cSatipServerItem(s));
|
||||
helpM.Append("");
|
||||
}
|
||||
detachedModeM = SatipConfig.GetDetachedMode();
|
||||
if (!detachedModeM) {
|
||||
cSatipServers *servers = cSatipDiscover::GetInstance()->GetServers();
|
||||
deviceCountM = servers->Count();
|
||||
for (cSatipServer *s = servers->First(); s; s = servers->Next(s)) {
|
||||
Add(new cSatipServerItem(s));
|
||||
helpM.Append("");
|
||||
}
|
||||
}
|
||||
|
||||
SetCurrent(Get(current));
|
||||
Display();
|
||||
@ -480,7 +484,7 @@ eOSState cSatipPluginSetup::ProcessKey(eKeys keyP)
|
||||
if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM))
|
||||
Setup();
|
||||
|
||||
if ((keyP != kNone) && ((numDisabledSourcesM != oldNumDisabledSources) || (numDisabledFiltersM != oldNumDisabledFilters) || (operatingModeM != oldOperatingMode) || (ciExtensionM != oldCiExtension))) {
|
||||
if ((keyP != kNone) && ((numDisabledSourcesM != oldNumDisabledSources) || (numDisabledFiltersM != oldNumDisabledFilters) || (operatingModeM != oldOperatingMode) || (ciExtensionM != oldCiExtension) || (detachedModeM != SatipConfig.GetDetachedMode()))) {
|
||||
while ((numDisabledSourcesM < oldNumDisabledSources) && (oldNumDisabledSources > 0))
|
||||
disabledSourcesM[--oldNumDisabledSources] = cSource::stNone;
|
||||
while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0))
|
||||
|
Loading…
Reference in New Issue
Block a user