2014-03-08 12:07:47 +01:00
|
|
|
/*
|
|
|
|
* config.c: SAT>IP plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "discover.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
cSatipConfig SatipConfig;
|
|
|
|
|
|
|
|
cSatipConfig::cSatipConfig(void)
|
2014-03-13 17:23:55 +01:00
|
|
|
: operatingModeM(eOperatingModeLow),
|
2014-12-03 18:57:23 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
logLevelM(eLogLevelMask),
|
|
|
|
#else
|
|
|
|
logLevelM(eLogLevelNormal),
|
|
|
|
#endif
|
2014-03-10 20:21:08 +01:00
|
|
|
eitScanM(1),
|
2014-03-08 12:07:47 +01:00
|
|
|
useBytesM(1)
|
|
|
|
{
|
2014-10-31 21:07:33 +01:00
|
|
|
for (unsigned int i = 0; i < ARRAY_SIZE(disabledSourcesM); ++i)
|
|
|
|
disabledSourcesM[i] = cSource::stNone;
|
2014-03-08 12:07:47 +01:00
|
|
|
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i)
|
|
|
|
disabledFiltersM[i] = -1;
|
|
|
|
memset(configDirectoryM, 0, sizeof(configDirectoryM));
|
|
|
|
}
|
|
|
|
|
2014-10-31 21:07:33 +01:00
|
|
|
unsigned int cSatipConfig::GetDisabledSourcesCount(void) const
|
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
|
|
|
while ((n < ARRAY_SIZE(disabledSourcesM) && (disabledSourcesM[n] != cSource::stNone)))
|
|
|
|
n++;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cSatipConfig::GetDisabledSources(unsigned int indexP) const
|
|
|
|
{
|
|
|
|
return (indexP < ARRAY_SIZE(disabledSourcesM)) ? disabledSourcesM[indexP] : cSource::stNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSatipConfig::SetDisabledSources(unsigned int indexP, int sourceP)
|
|
|
|
{
|
|
|
|
if (indexP < ARRAY_SIZE(disabledSourcesM))
|
|
|
|
disabledSourcesM[indexP] = sourceP;
|
|
|
|
}
|
|
|
|
|
2014-03-08 12:07:47 +01:00
|
|
|
unsigned int cSatipConfig::GetDisabledFiltersCount(void) const
|
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
|
|
|
while ((n < ARRAY_SIZE(disabledFiltersM) && (disabledFiltersM[n] != -1)))
|
|
|
|
n++;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cSatipConfig::GetDisabledFilters(unsigned int indexP) const
|
|
|
|
{
|
|
|
|
return (indexP < ARRAY_SIZE(disabledFiltersM)) ? disabledFiltersM[indexP] : -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSatipConfig::SetDisabledFilters(unsigned int indexP, int numberP)
|
|
|
|
{
|
|
|
|
if (indexP < ARRAY_SIZE(disabledFiltersM))
|
|
|
|
disabledFiltersM[indexP] = numberP;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSatipConfig::SetConfigDirectory(const char *directoryP)
|
|
|
|
{
|
|
|
|
debug("cSatipConfig::%s(%s)", __FUNCTION__, directoryP);
|
|
|
|
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
|
|
|
|
}
|