diff --git a/API.html b/API.html index 2d44f5a..0fcfe74 100644 --- a/API.html +++ b/API.html @@ -1202,7 +1202,7 @@

Retrieve the current setup of the Wirbelscan pl
  • DVBC_QAM - AUTO = 0,QAM64 = 1, QAM128 = 2, QAM256 = 3, ALL = 4
  • CountryId - the id according to country, found in country list, see wirbelscan_GetCountry
  • SatId - the id according to satellite, found in list, see wirbelscan_GetSat -
  • scanflags - bitwise flag of wanted channels: TV = (1 << 0), RADIO = (1 << 1), FTA = (1 << 2), SCRAMBLED = (1 << 4), HDTV = (1 << 5) +
  • scanflags - bitwise flag of TV=1, RADIO=2, FTA=4, SCRAMBLED=8, HDTV=16 (default 31 -> TV + Radio, SD + HDTV, FTA + Scrambled)
  • ATSC_type - VSB = 0, QAM = 1, both VSB+QAM = 2
    diff --git a/wirbelscan.cpp b/wirbelscan.cpp index 872299d..c73881a 100644 --- a/wirbelscan.cpp +++ b/wirbelscan.cpp @@ -191,59 +191,88 @@ void WirbelscanResponder::replySetSetup(ostream& out, wirbelscan->Service(getcmd.str().c_str(), &setupBuffer); // query buffer size. - if (q.hasBody("verbosity")) + // deactivated some sanity checks until it's clear which values are valid + + if (q.hasJson("verbosity")) { - setupBuffer.verbosity = q.getBodyAsInt("verbosity"); + int verbosity = q.getBodyAsInt("verbosity"); + if (verbosity >= 0 && verbosity < 6) { + setupBuffer.verbosity = verbosity; + } } - if (q.hasBody("logFile")) + if (q.hasJson("logFile")) { - setupBuffer.logFile = q.getBodyAsInt("logFile"); + int logFile = q.getBodyAsInt("logFile"); + if (logFile >= 0 && logFile < 3) { + setupBuffer.logFile = logFile; + } } - if (q.hasBody("DVB_Type")) + if (q.hasJson("DVB_Type")) { - setupBuffer.DVB_Type = q.getBodyAsInt("DVB_Type"); + int dvbType = q.getBodyAsInt("DVB_Type"); + //if ((dvbType >= 0 && dvbType < 6) || dvbType == 999) { + setupBuffer.DVB_Type = dvbType; + //} } - if (q.hasBody("DVBT_Inversion")) + if (q.hasJson("DVBT_Inversion")) { - setupBuffer.DVBT_Inversion = q.getBodyAsInt("DVBT_Inversion"); + int dvbtInversion = q.getBodyAsInt("DVBT_Inversion"); + if (dvbtInversion >= 0 && dvbtInversion < 2) { + setupBuffer.DVBT_Inversion = dvbtInversion; + } } - if (q.hasBody("DVBC_Inversion")) + if (q.hasJson("DVBC_Inversion")) { - setupBuffer.DVBC_Inversion = q.getBodyAsInt("DVBC_Inversion"); + int dvbcInversion = q.getBodyAsInt("DVBC_Inversion"); + if (dvbcInversion >= 0 && dvbcInversion < 2) { + setupBuffer.DVBC_Inversion = dvbcInversion; + } } - if (q.hasBody("DVBC_Symbolrate")) + if (q.hasJson("DVBC_Symbolrate")) { - setupBuffer.DVBC_Symbolrate = q.getBodyAsInt("DVBC_Symbolrate"); + int dvbcSymbolrate = q.getBodyAsInt("DVBC_Symbolrate"); + //if (dvbcSymbolrate >= 0 && dvbcSymbolrate < 16) { + setupBuffer.DVBC_Symbolrate = dvbcSymbolrate; + //} } - if (q.hasBody("DVBC_QAM")) + if (q.hasJson("DVBC_QAM")) { - setupBuffer.DVBC_QAM = q.getBodyAsInt("DVBC_QAM"); + int dvbcQam = q.getBodyAsInt("DVBC_QAM"); + //if (dvbcQam >= 0 && dvbcQam < 5) { + setupBuffer.DVBC_QAM = dvbcQam; + //} } - if (q.hasBody("CountryId")) + if (q.hasJson("CountryId")) { setupBuffer.CountryId = q.getBodyAsInt("CountryId"); } - if (q.hasBody("SatId")) + if (q.hasJson("SatId")) { setupBuffer.SatId = q.getBodyAsInt("SatId"); } - if (q.hasBody("scanflags")) + if (q.hasJson("scanflags")) { - setupBuffer.scanflags = q.getBodyAsInt("scanflags"); + int scanFlags = q.getBodyAsInt("scanflags"); + if (scanFlags >= 0 && scanFlags < 32) { + setupBuffer.scanflags = scanFlags; + } } - if (q.hasBody("ATSC_type")) + if (q.hasJson("ATSC_type")) { - setupBuffer.ATSC_type = q.getBodyAsInt("ATSC_type"); + int atscType = q.getBodyAsInt("ATSC_type"); + //if (atscType >= 0 && atscType < 3) { + setupBuffer.ATSC_type = atscType; + //} } std::stringstream setcmd;