X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ecfd1ddb49626d2a0f42c9b774fd9f0e147b204b..cffee89d7b3567ee92901f6963108c33ea3ac469:/lib/python/Screens/ScanSetup.py diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 4eb7b8cd..5c30ef2c 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -12,14 +12,17 @@ def buildTerTransponder(frequency, inversion=2, bandwidth = 3, fechigh = 6, feclow = 6, modulation = 2, transmission = 2, guard = 4, hierarchy = 4): + +# print "freq", frequency, "inv", inversion, "bw", bandwidth, "fech", fechigh, "fecl", feclow, "mod", modulation, "tm", transmission, "guard", guard, "hierarchy", hierarchy + # WARNING: normally, enums are working directly. # Don't copy this (very bad)!! Instead either fix swig (good) or # move this into a central place. Bw8MHz = 0 Bw7MHz = 1 Bw6MHz = 2 - Bw5MHz = 3 - BwAuto = 4 + #Bw5MHz = 3 #not implemented for e1 compatibilty + BwAuto = 3 f1_2 = 0 f2_3 = 1 @@ -30,8 +33,8 @@ def buildTerTransponder(frequency, TM2k = 0 TM8k = 1 - TM4k = 2 - TMAuto = 3 + #TM4k = 2 #not implemented for e1 compatibilty + TMAuto = 2 GI_1_32 = 0 GI_1_16 = 1 @@ -60,9 +63,9 @@ def buildTerTransponder(frequency, parm.inversion = [Off, On, Unknown][inversion] parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported - parm.code_rate_HP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh] - parm.code_rate_LP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow] - parm.modulation = [QPSK, QAM16, Auto][modulation] # QAM64 unsupported + parm.code_rate_HP = [f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh] + parm.code_rate_LP = [f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow] + parm.modulation = [QPSK, QAM16, QAM64, Auto][modulation] parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard] parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy] @@ -77,13 +80,11 @@ def getInitialTransponderList(tlist, pos): parm = eDVBFrontendParametersSatellite() parm.frequency = x[1] parm.symbol_rate = x[2] - parm.polarisation = x[3]#lookup_sat_polarisation[x[3]] # eDVBFrontendParametersSatellite.Polarisation.Vertical - parm.fec = x[4] # eDVBFrontendParametersSatellite.FEC.f3_4; - #parm.fec = 6 # AUTO - #parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off; - parm.inversion = 2 #AUTO + parm.polarisation = x[3] + parm.fec = x[4] + parm.inversion = 2 # AUTO parm.orbital_position = pos - parm.system = x[5] #DVB-S or DVB-S2 + parm.system = x[5] parm.modulation = x[6] tlist.append(parm) @@ -91,36 +92,26 @@ def getInitialCableTransponderList(tlist, cable): list = nimmanager.getTranspondersCable(cable) for x in list: - if x[0] == 1: #CABLE + if x[0] == 1: #CABLE parm = eDVBFrontendParametersCable() parm.frequency = x[1] parm.symbol_rate = x[2] - parm.modulation = x[3] # AUTO - parm.fec_inner = x[4] # AUTO + parm.modulation = x[3] + parm.fec_inner = x[4] parm.inversion = 2 # AUTO tlist.append(parm) def getInitialTerrestrialTransponderList(tlist, region): list = nimmanager.getTranspondersTerrestrial(region) - -# inversion=2, bandwidth = 3, fechigh = 6, feclow = 6, -# modulation = 2, transmission = 2, guard = 4, -# hierarchy = 4): + #self.transponders[self.parsedTer].append((2,freq,bw,const,crh,crl,guard,transm,hierarchy,inv)) + + #def buildTerTransponder(frequency, inversion = 2, bandwidth = 3, fechigh = 6, feclow = 6, + #modulation = 2, transmission = 2, guard = 4, hierarchy = 4): for x in list: -#self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv)) - if x[0] == 2: #TERRESTRIAL - # FIXME: we need to convert the other parameters... - - # convert terrestrial.xml bandwidth to our enum - #if x[2] in [0, 1]: - # bandwidth = [1, 0][x[2]] - #else: - # bandwidth = 3 # auto - # - #parm = buildTerTransponder(x[1], bandwidth = [1, 0][x[2]]) - parm = buildTerTransponder(x[1], inversion = x[9], bandwidth = x[2]) + if x[0] == 2: #TERRESTRIAL + parm = buildTerTransponder(x[1], x[9], x[2], x[4], x[5], x[3], x[7], x[6], x[8]) tlist.append(parm) @@ -130,11 +121,14 @@ class ScanSetup(Screen): self.updateSatList() self.service = session.nav.getCurrentService() + self.feinfo = None frontendData = None if self.service is not None: self.feinfo = self.service.frontendInfo() frontendData = self.feinfo and self.feinfo.getFrontendData(True) self.createConfig(frontendData) + del self.feinfo + del self.service self["actions"] = NumberActionMap(["SetupActions"], @@ -259,7 +253,6 @@ class ScanSetup(Screen): self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy)) elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) - self.list.append(getConfigListEntry(_("Enable 5V for active antenna"), config.terrestrial.enable_5V)) # if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \ # (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \ @@ -324,7 +317,7 @@ class ScanSetup(Screen): #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT), #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT), defaultSat = { "orbpos": 192, "system": 0, "frequency": [11836], "inversion": 2, "symbolrate": [27500], "polarization": 0, "fec": 0, "fec_s2": 8, "modulation": 0 } - defaultCab = {"frequency": [466], "inversion": 2, "modulation": 0, "fec": 0, "symbolrate": [6900]} + defaultCab = {"frequency": [466], "inversion": 2, "modulation": 2, "fec": 0, "symbolrate": [6900]} if frontendData is not None: if frontendData["tuner_type"] == "DVB-S": defaultSat["system"] = {"DVB-S": 0, "DVB-S2": 1}[frontendData["system"]] @@ -379,7 +372,7 @@ class ScanSetup(Screen): # cable config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, defaultCab["frequency"], configsequencearg.get("INTEGER", (50, 999))) config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, defaultCab["inversion"], (("off", _("off")), ("on", _("on")), ("auto", _("Auto")))) - config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, defaultCab["modulation"], (("auto", _("Auto")), ("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM"))) + config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, defaultCab["modulation"], (("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM"))) config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, defaultCab["fec"], (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("none", _("None")))) config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, defaultCab["symbolrate"], configsequencearg.get("INTEGER", (1, 9999))) config.scan.cab.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes")))) @@ -390,9 +383,9 @@ class ScanSetup(Screen): # WORKAROUND: we can't use BW-auto config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz"))) #, ("auto", _("Auto")))) - config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 6, (("none", _("None")), "1/2", "2/3", "3/4", "5/6", "7/8", _("Auto"))) - config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 6, (_("None"), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto")))) - config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("auto", _("Auto")))) + config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 5, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto")))) + config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 5, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto")))) + config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 3, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("qam64", "QAM64"), ("auto", _("Auto")))) config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, (("2k", "2K"), ("8k", "8K"), ("auto", _("Auto")))) config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 4, (("1_32", "1/32"), ("1_16", "1/16"), ("1_8", "1/8"), ("1_4", "1/4"), ("auto", _("Auto")))) config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, (("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto")))) @@ -441,7 +434,7 @@ class ScanSetup(Screen): } def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation): - print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion) + print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(self.fecmap[fec]) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) print "orbpos: " + str(orbital_position) parm = eDVBFrontendParametersSatellite() if modulation == 1: @@ -451,25 +444,20 @@ class ScanSetup(Screen): parm.system = system parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti - parm.fec = self.fecmap[fec] # eDVBFrontendParametersSatellite.FEC.f3_4; - #parm.fec = 6 # AUTO - parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; - #parm.inversion = 2 #AUTO + parm.polarisation = polarisation + parm.fec = self.fecmap[fec] + parm.inversion = inversion parm.orbital_position = int(orbital_position) tlist.append(parm) - # FIXME use correct parameters def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion): print "Add Cab: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(modulation) + " fec: " + str(fec) + " inversion: " + str(inversion) parm = eDVBFrontendParametersCable() parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti - parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4; - #parm.fec = 6 # AUTO - parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; - #parm.inversion = 2 #AUTO + parm.modulation = modulation + parm.fec = self.fecmap[fec] + parm.inversion = inversion tlist.append(parm) def addTerTransponder(self, tlist, *args, **kwargs): @@ -500,7 +488,7 @@ class ScanSetup(Screen): config.scan.sat.inversion.value, orbpos, config.scan.sat.system.value, - config.scan.sat.modulation) + config.scan.sat.modulation.value) elif currentConfigSelectionElement(config.scan.type) == "single_satellite": sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value] getInitialTransponderList(tlist, int(sat[1])) @@ -527,10 +515,11 @@ class ScanSetup(Screen): elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]): if currentConfigSelectionElement(config.scan.typecable) == "single_transponder": + fec = currentConfigSelectionElement(config.scan.cab.fec) self.addCabTransponder(tlist, config.scan.cab.frequency.value[0], config.scan.cab.symbolrate.value[0], - config.scan.cab.modulation.value, - config.scan.cab.fec.value, + config.scan.cab.modulation.value + 1, + fec, config.scan.cab.inversion.value) if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes": flags |= eComponentScan.scanNetworkSearch @@ -693,7 +682,6 @@ class ScanSimple(Screen): tlist = [] nimcount = nimmanager.getNimSocketCount() - have_terrestrial = False if nimcount > 0: nimtype = nimmanager.getNimType(0) scan_possible=True @@ -701,9 +689,7 @@ class ScanSimple(Screen): config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)")))) self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) - if nimtype == nimmanager.nimType["DVB-T"]: - have_terrestrial = True - elif nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)): + if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)): scan_possible=False if scan_possible: self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim)) @@ -711,11 +697,6 @@ class ScanSimple(Screen): if nimcount > 1 and self.ScanNimTwoNeeded(): nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim)) - if nimmanager.getNimType(1) == nimmanager.nimType["DVB-T"]: - have_terrestrial = True - - if have_terrestrial: - self.list.append(getConfigListEntry(_("Enable 5V for active antenna"), config.terrestrial.enable_5V)) self["config"] = ConfigList(self.list) self["header"] = Label(_("Automatic Scan"))