1
0
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:
Rolf Ahrenberg 2015-03-17 21:25:15 +02:00
parent fe010ab72c
commit 8b43cdc634
6 changed files with 41 additions and 9 deletions

View File

@ -17,6 +17,7 @@ cSatipConfig::cSatipConfig(void)
ciExtensionM(0), ciExtensionM(0),
eitScanM(1), eitScanM(1),
useBytesM(1), useBytesM(1),
detachedModeM(false),
disableServerQuirksM(false), disableServerQuirksM(false),
useSingleModelServersM(false) useSingleModelServersM(false)
{ {

View File

@ -19,6 +19,7 @@ private:
unsigned int ciExtensionM; unsigned int ciExtensionM;
unsigned int eitScanM; unsigned int eitScanM;
unsigned int useBytesM; unsigned int useBytesM;
bool detachedModeM;
bool disableServerQuirksM; bool disableServerQuirksM;
bool useSingleModelServersM; bool useSingleModelServersM;
int cicamsM[MAX_CICAM_COUNT]; int cicamsM[MAX_CICAM_COUNT];
@ -66,6 +67,7 @@ public:
int GetCICAM(unsigned int indexP) const; int GetCICAM(unsigned int indexP) const;
unsigned int GetEITScan(void) const { return eitScanM; } unsigned int GetEITScan(void) const { return eitScanM; }
unsigned int GetUseBytes(void) const { return useBytesM; } unsigned int GetUseBytes(void) const { return useBytesM; }
bool GetDetachedMode(void) const { return detachedModeM; }
bool GetDisableServerQuirks(void) const { return disableServerQuirksM; } bool GetDisableServerQuirks(void) const { return disableServerQuirksM; }
bool GetUseSingleModelServers(void) const { return useSingleModelServersM; } bool GetUseSingleModelServers(void) const { return useSingleModelServersM; }
unsigned int GetDisabledSourcesCount(void) const; unsigned int GetDisabledSourcesCount(void) const;
@ -79,6 +81,7 @@ public:
void SetCICAM(unsigned int indexP, int cicamP); void SetCICAM(unsigned int indexP, int cicamP);
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; } void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; } void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetDetachedMode(bool onOffP) { detachedModeM = onOffP; }
void SetDisableServerQuirks(bool onOffP) { disableServerQuirksM = onOffP; } void SetDisableServerQuirks(bool onOffP) { disableServerQuirksM = onOffP; }
void SetUseSingleModelServers(bool onOffP) { useSingleModelServersM = onOffP; } void SetUseSingleModelServers(bool onOffP) { useSingleModelServersM = onOffP; }
void SetDisabledSources(unsigned int indexP, int sourceP); void SetDisabledSources(unsigned int indexP, int sourceP);

View File

@ -219,6 +219,8 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
{ {
cSource *s = Sources.Get(sourceP); cSource *s = Sources.Get(sourceP);
debug9("%s (%c) desc='%s' [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), s ? s->Description() : "", deviceIndexM); 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 // source descriptions starting with '0' are disabled
if (s && s->Description() && (*(s->Description()) == '0')) if (s && s->Description() && (*(s->Description()) == '0'))
return false; return false;
@ -501,6 +503,8 @@ void cSatipDevice::SkipData(int countP)
bool cSatipDevice::GetTSPacket(uchar *&dataP) bool cSatipDevice::GetTSPacket(uchar *&dataP)
{ {
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
if (SatipConfig.GetDetachedMode())
return false;
if (tsBufferM) { if (tsBufferM) {
if (cCamSlot *cs = CamSlot()) { if (cCamSlot *cs = CamSlot()) {
if (cs->WantsTsData()) { if (cs->WantsTsData()) {

21
satip.c
View File

@ -85,6 +85,7 @@ const char *cPluginSatip::CommandLineHelp(void)
" -t <mode>, --trace=<mode> set the tracing mode\n" " -t <mode>, --trace=<mode> set the tracing mode\n"
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n" " -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
" define hard-coded SAT>IP server(s)\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" " -S, --single set the single model server mode on\n"
" -n, --noquirks disable all the server quirks\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' }, { "devices", required_argument, NULL, 'd' },
{ "trace", required_argument, NULL, 't' }, { "trace", required_argument, NULL, 't' },
{ "server", required_argument, NULL, 's' }, { "server", required_argument, NULL, 's' },
{ "detach", no_argument, NULL, 'D' },
{ "single", no_argument, NULL, 'S' }, { "single", no_argument, NULL, 'S' },
{ "noquirks", no_argument, NULL, 'n' }, { "noquirks", no_argument, NULL, 'n' },
{ NULL, no_argument, NULL, 0 } { NULL, no_argument, NULL, 0 }
@ -104,7 +106,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
cString server; cString server;
int c; 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) { switch (c) {
case 'd': case 'd':
deviceCountM = strtol(optarg, NULL, 0); deviceCountM = strtol(optarg, NULL, 0);
@ -115,6 +117,9 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
case 's': case 's':
server = optarg; server = optarg;
break; break;
case 'D':
SatipConfig.SetDetachedMode(true);
break;
case 'S': case 'S':
SatipConfig.SetUseSingleModelServers(true); SatipConfig.SetUseSingleModelServers(true);
break; break;
@ -368,6 +373,10 @@ const char **cPluginSatip::SVDRPHelpPages(void)
" Shows SAT>IP device count.\n", " Shows SAT>IP device count.\n",
"OPER [ off | low | normal | high ]\n" "OPER [ off | low | normal | high ]\n"
" Gets and(or sets operating mode of SAT>IP devices.\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" "TRAC [ <mode> ]\n"
" Gets and/or sets used tracing mode.\n", " Gets and/or sets used tracing mode.\n",
NULL NULL
@ -465,6 +474,16 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in
} }
return cString::sprintf("SATIP operating mode: %s\n", *mode); 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) { else if (strcasecmp(commandP, "TRAC") == 0) {
if (optionP && *optionP) if (optionP && *optionP)
SatipConfig.SetTraceMode(strtol(optionP, NULL, 0)); SatipConfig.SetTraceMode(strtol(optionP, NULL, 0));

20
setup.c
View File

@ -330,7 +330,8 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP)
// --- cSatipPluginSetup ------------------------------------------------------ // --- cSatipPluginSetup ------------------------------------------------------
cSatipPluginSetup::cSatipPluginSetup() cSatipPluginSetup::cSatipPluginSetup()
: deviceCountM(0), : detachedModeM(SatipConfig.GetDetachedMode()),
deviceCountM(0),
operatingModeM(SatipConfig.GetOperatingMode()), operatingModeM(SatipConfig.GetOperatingMode()),
ciExtensionM(SatipConfig.GetCIExtension()), ciExtensionM(SatipConfig.GetCIExtension()),
eitScanM(SatipConfig.GetEITScan()), eitScanM(SatipConfig.GetEITScan()),
@ -402,12 +403,15 @@ void cSatipPluginSetup::Setup(void)
Add(new cOsdItem(tr("Active SAT>IP servers:"), osUnknown, false)); Add(new cOsdItem(tr("Active SAT>IP servers:"), osUnknown, false));
helpM.Append(""); helpM.Append("");
cSatipServers *servers = cSatipDiscover::GetInstance()->GetServers(); detachedModeM = SatipConfig.GetDetachedMode();
deviceCountM = servers->Count(); if (!detachedModeM) {
for (cSatipServer *s = servers->First(); s; s = servers->Next(s)) { cSatipServers *servers = cSatipDiscover::GetInstance()->GetServers();
Add(new cSatipServerItem(s)); deviceCountM = servers->Count();
helpM.Append(""); for (cSatipServer *s = servers->First(); s; s = servers->Next(s)) {
} Add(new cSatipServerItem(s));
helpM.Append("");
}
}
SetCurrent(Get(current)); SetCurrent(Get(current));
Display(); Display();
@ -480,7 +484,7 @@ eOSState cSatipPluginSetup::ProcessKey(eKeys keyP)
if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM)) if ((keyP == kNone) && (cSatipDiscover::GetInstance()->GetServers()->Count() != deviceCountM))
Setup(); 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)) while ((numDisabledSourcesM < oldNumDisabledSources) && (oldNumDisabledSources > 0))
disabledSourcesM[--oldNumDisabledSources] = cSource::stNone; disabledSourcesM[--oldNumDisabledSources] = cSource::stNone;
while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0)) while ((numDisabledFiltersM < oldNumDisabledFilters) && (oldNumDisabledFilters > 0))

View File

@ -15,6 +15,7 @@
class cSatipPluginSetup : public cMenuSetupPage class cSatipPluginSetup : public cMenuSetupPage
{ {
private: private:
bool detachedModeM;
int deviceCountM; int deviceCountM;
int operatingModeM; int operatingModeM;
const char *operatingModeTextsM[cSatipConfig::eOperatingModeCount]; const char *operatingModeTextsM[cSatipConfig::eOperatingModeCount];