1 from Screen import Screen
2 from ServiceScan import *
3 from Components.config import *
4 from Components.ActionMap import NumberActionMap
5 from Components.ConfigList import ConfigList
6 from Components.NimManager import nimmanager
7 from Components.Label import Label
8 from Screens.MessageBox import MessageBox
9 from enigma import eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial
11 def buildTerTransponder(frequency,
12 inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
13 modulation = 2, transmission = 2, guard = 4,
15 # WARNING: normally, enums are working directly.
16 # Don't copy this (very bad)!! Instead either fix swig (good) or
17 # move this into a central place.
57 parm = eDVBFrontendParametersTerrestrial()
59 parm.frequency = frequency
61 parm.inversion = [Off, On, Unknown][inversion]
62 parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported
63 parm.code_rate_HP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh]
64 parm.code_rate_LP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow]
65 parm.modulation = [QPSK, QAM16, Auto][modulation] # QAM64 unsupported
66 parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported
67 parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard]
68 parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy]
72 def getInitialTransponderList(tlist, pos):
73 list = nimmanager.getTransponders(pos)
77 parm = eDVBFrontendParametersSatellite()
79 parm.symbol_rate = x[2]
80 parm.polarisation = x[3]#lookup_sat_polarisation[x[3]] # eDVBFrontendParametersSatellite.Polarisation.Vertical
81 parm.fec = x[4] # eDVBFrontendParametersSatellite.FEC.f3_4;
83 #parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off;
84 parm.inversion = 2 #AUTO
85 parm.orbital_position = pos
86 parm.system = x[5] #DVB-S or DVB-S2
87 parm.modulation = x[6]
90 def getInitialCableTransponderList(tlist, cable):
91 list = nimmanager.getTranspondersCable(cable)
95 parm = eDVBFrontendParametersCable()
97 parm.symbol_rate = x[2]
98 parm.modulation = x[3] # AUTO
99 parm.fec_inner = x[4] # AUTO
100 parm.inversion = 2 # AUTO
103 def getInitialTerrestrialTransponderList(tlist, region):
104 list = nimmanager.getTranspondersTerrestrial(region)
107 # inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
108 # modulation = 2, transmission = 2, guard = 4,
112 #self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
113 if x[0] == 2: #TERRESTRIAL
114 # FIXME: we need to convert the other parameters...
116 # convert terrestrial.xml bandwidth to our enum
118 # bandwidth = [1, 0][x[2]]
120 # bandwidth = 3 # auto
122 #parm = buildTerTransponder(x[1], bandwidth = [1, 0][x[2]])
123 parm = buildTerTransponder(x[1], inversion = x[9], bandwidth = x[2])
127 class ScanSetup(Screen):
128 def __init__(self, session):
129 Screen.__init__(self, session)
132 self.service = session.nav.getCurrentService()
135 if self.service is not None:
136 self.feinfo = self.service.frontendInfo()
137 frontendData = self.feinfo and self.feinfo.getFrontendData(True)
138 self.createConfig(frontendData)
143 self["actions"] = NumberActionMap(["SetupActions"],
146 "cancel": self.keyCancel,
147 "left": self.keyLeft,
148 "right": self.keyRight,
149 "1": self.keyNumberGlobal,
150 "2": self.keyNumberGlobal,
151 "3": self.keyNumberGlobal,
152 "4": self.keyNumberGlobal,
153 "5": self.keyNumberGlobal,
154 "6": self.keyNumberGlobal,
155 "7": self.keyNumberGlobal,
156 "8": self.keyNumberGlobal,
157 "9": self.keyNumberGlobal,
158 "0": self.keyNumberGlobal
161 self.statusTimer = eTimer()
162 self.statusTimer.timeout.get().append(self.updateStatus)
163 #self.statusTimer.start(5000, True)
166 self["config"] = ConfigList(self.list)
169 self["introduction"] = Label(_("Press OK to start the scan"))
174 def updateSatList(self):
176 for slot in nimmanager.nimslots:
177 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
178 self.satList.append(nimmanager.getSatListForNim(slot.slotid))
180 self.satList.append(None)
182 def createSetup(self):
184 self.multiscanlist = []
185 print "ID: " + str(config.scan.nims.value)
187 self.tunerEntry = getConfigListEntry(_("Tuner"), config.scan.nims)
188 self.list.append(self.tunerEntry)
190 self.typeOfScanEntry = None
191 self.systemEntry = None
192 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
193 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.type)
194 self.list.append(self.typeOfScanEntry)
195 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
196 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typecable)
197 self.list.append(self.typeOfScanEntry)
198 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
199 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typeterrestrial)
200 self.list.append(self.typeOfScanEntry)
203 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
205 if currentConfigSelectionElement(config.scan.type) == "single_transponder":
206 self.systemEntry = getConfigListEntry(_('Transpondertype'), config.scan.sat.system)
207 self.list.append(self.systemEntry)
208 self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value]))
209 self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
210 self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
211 self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
212 self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
213 if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
214 self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
215 elif currentConfigSelectionElement(config.scan.sat.system) == "dvb-s2":
216 self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec_s2))
217 self.list.append(getConfigListEntry(_('Modulation'), config.scan.sat.modulation))
218 elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
220 print config.scan.satselection[config.scan.nims.value]
221 self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value]))
222 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
223 elif currentConfigSelectionElement(config.scan.type) == "multisat":
226 SatList = nimmanager.getSatListForNim(config.scan.nims.value)
227 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
229 if self.Satexists(tlist, x[1]) == 0:
231 sat = configElement_nonSave(x[1], configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))))
232 configEntry = getConfigListEntry(nimmanager.getSatDescription(x[1]), sat)
233 self.list.append(configEntry)
234 self.multiscanlist.append(configEntry)
236 # for sat in nimmanager.satList:
237 # self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
240 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
241 if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
242 self.list.append(getConfigListEntry(_("Frequency"), config.scan.cab.frequency))
243 self.list.append(getConfigListEntry(_("Inversion"), config.scan.cab.inversion))
244 self.list.append(getConfigListEntry(_("Symbol Rate"), config.scan.cab.symbolrate))
245 self.list.append(getConfigListEntry(_("Modulation"), config.scan.cab.modulation))
246 self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec))
247 self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan))
248 elif currentConfigSelectionElement(config.scan.typecable) == "complete":
249 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
251 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
252 if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
253 self.list.append(getConfigListEntry(_("Frequency"), config.scan.ter.frequency))
254 self.list.append(getConfigListEntry(_("Network scan"), config.scan.ter.networkScan))
255 self.list.append(getConfigListEntry(_("Inversion"), config.scan.ter.inversion))
256 self.list.append(getConfigListEntry(_("Bandwidth"), config.scan.ter.bandwidth))
257 self.list.append(getConfigListEntry(_("Code rate high"), config.scan.ter.fechigh))
258 self.list.append(getConfigListEntry(_("Code rate low"), config.scan.ter.feclow))
259 self.list.append(getConfigListEntry(_("Modulation"), config.scan.ter.modulation))
260 self.list.append(getConfigListEntry(_("Transmission mode"), config.scan.ter.transmission))
261 self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard))
262 self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy))
263 elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
264 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
266 # if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \
267 # (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \
268 # (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"):
269 # self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr)
270 # self.list.append(self.configElementSNR)
271 # self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc)
272 # self.list.append(self.configElementACG)
273 # self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber)
274 # self.list.append(self.configElementBER)
275 # self.statusTimer.start(500, False)
277 # self.statusTimer.stop()
279 self["config"].list = self.list
280 self["config"].l.setList(self.list)
282 def Satexists(self, tlist, pos):
289 print self["config"].getCurrent()
290 if self["config"].getCurrent() == self.typeOfScanEntry:
292 elif self["config"].getCurrent() == self.tunerEntry:
294 elif self["config"].getCurrent() == self.systemEntry:
297 def createConfig(self, frontendData):
298 #("Type", frontendData["system"], TYPE_TEXT),
299 #("Modulation", frontendData["modulation"], TYPE_TEXT),
300 #("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC),
301 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
302 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
303 #("Polarization", frontendData["polarization"], TYPE_TEXT),
304 #("Inversion", frontendData["inversion"], TYPE_TEXT),
305 #("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
307 #elif frontendData["tuner_type"] == "DVB-C":
308 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
309 #("Type", frontendData["tuner_type"], TYPE_TEXT),
310 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
311 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
312 #("Modulation", frontendData["modulation"], TYPE_TEXT),
313 #("Inversion", frontendData["inversion"], TYPE_TEXT),
314 # ("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
316 #elif frontendData["tuner_type"] == "DVB-T":
317 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
318 #("Type", frontendData["tuner_type"], TYPE_TEXT),
319 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
320 #("Inversion", frontendData["inversion"], TYPE_TEXT),
321 #("Bandwidth", frontendData["bandwidth"], TYPE_VALUE_DEC),
322 #("CodeRateLP", frontendData["code_rate_lp"], TYPE_TEXT),
323 #("CodeRateHP", frontendData["code_rate_hp"], TYPE_TEXT),
324 #("Constellation", frontendData["constellation"], TYPE_TEXT),
325 #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
326 #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
327 #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
328 defaultSat = { "orbpos": 192, "system": 0, "frequency": [11836], "inversion": 2, "symbolrate": [27500], "polarization": 0, "fec": 0, "fec_s2": 8, "modulation": 0 }
329 defaultCab = {"frequency": [466], "inversion": 2, "modulation": 2, "fec": 0, "symbolrate": [6900]}
330 if frontendData is not None:
331 if frontendData["tuner_type"] == "DVB-S":
332 defaultSat["system"] = {"DVB-S": 0, "DVB-S2": 1}[frontendData["system"]]
333 defaultSat["frequency"] = [int(frontendData["frequency"] / 1000)]
334 defaultSat["inversion"] = {"INVERSION_OFF": 0, "INVERSION_ON": 1, "INVERSION_AUTO": 2}[frontendData["inversion"]]
335 defaultSat["symbolrate"] = [int(frontendData["symbol_rate"] / 1000)]
336 defaultSat["polarization"] = {"HORIZONTAL": 0, "VERTICAL": 1, "CIRCULAR_LEFT": 2, "CIRCULAR_RIGHT": 3, "UNKNOWN": 0}[frontendData["polarization"]]
337 defaultSat["fec"] = {"DVB-S": {"FEC_AUTO": 0, "FEC_1_2": 1, "FEC_2_3": 2, "FEC_3_4": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_NONE": 6}, "DVB-S2": {"FEC_1_2": 0, "FEC_2_3": 1, "FEC_3_4": 2, "FEC_4_5": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_8_9": 6, "FEC_9_10": 7}}[frontendData["system"]][frontendData["fec_inner"]]
338 defaultSat["modulation"] = {"QPSK": 0, "8PSK": 1}[frontendData["modulation"]]
339 defaultSat["orbpos"] = frontendData["orbital_position"]
340 elif frontendData["tuner_type"] == "DVB-C":
341 defaultCab["frequency"] = [int(frontendData["frequency"] / 1000)]
342 defaultCab["symbolrate"] = [int(frontendData["symbol_rate"] / 1000)]
343 defaultSat["inversion"] = {"INVERSION_OFF": 0, "INVERSION_ON": 1, "INVERSION_AUTO": 2}[frontendData["inversion"]]
344 defaultSat["fec"] = {"FEC_AUTO": 0, "FEC_1_2": 1, "FEC_2_3": 2, "FEC_3_4": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_8_9": 6, "FEC_NONE": 7}[frontendData["fec_inner"]]
345 defaultSat["modulation"] = {"QAM_AUTO": 0, "QAM_16": 1, "QAM_16": 2, "QAM_32": 3, "QAM_64": 4, "QAM_128": 5, "QAM_256": 6}[frontendData["modulation"]]
347 config.scan = ConfigSubsection()
348 config.scan.sat = ConfigSubsection()
349 config.scan.cab = ConfigSubsection()
350 config.scan.ter = ConfigSubsection()
352 config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))))
353 config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
354 config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
355 config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))))
358 for nim in nimmanager.nimList():
359 nimList.append(nim[0])
360 #nimList.append("all")
361 config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
364 config.scan.snr = configElement_nonSave("config.scan.snr", configSlider, 0, (1, 100))
365 config.scan.snr.enabled = False
366 config.scan.agc = configElement_nonSave("config.scan.agc", configSlider, 0, (1, 100))
367 config.scan.agc.enabled = False
368 config.scan.ber = configElement_nonSave("config.scan.ber", configSlider, 0, (1, 100))
369 config.scan.ber.enabled = False
372 config.scan.sat.system = configElement_nonSave("config.scan.sat.system", configSelection, defaultSat["system"], (("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))))
373 config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, defaultSat["frequency"], configsequencearg.get("INTEGER", (1, 99999)))
374 config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, defaultSat["inversion"], (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
375 config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, defaultSat["symbolrate"], configsequencearg.get("INTEGER", (1, 99999)))
376 config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, defaultSat["polarization"], (("horizontal", _("horizontal")), ("vertical", _("vertical")), ("circular_left", _("circular left")), ("circular_right", _("circular right"))))
377 config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, defaultSat["fec"], (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))))
378 config.scan.sat.fec_s2 = configElement_nonSave("config.scan.sat.fec_s2", configSelection, defaultSat["fec_s2"], (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10")))
379 config.scan.sat.modulation = configElement_nonSave("config.scan.sat.modulation", configSelection, defaultSat["modulation"], (("qpsk", "QPSK"), ("8psk", "8PSK")))
382 config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, defaultCab["frequency"], configsequencearg.get("INTEGER", (50, 999)))
383 config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, defaultCab["inversion"], (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
384 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")))
385 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"))))
386 config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, defaultCab["symbolrate"], configsequencearg.get("INTEGER", (1, 9999)))
387 config.scan.cab.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
390 config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (100, 900)))
391 config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
392 # WORKAROUND: we can't use BW-auto
393 config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")))
394 #, ("auto", _("Auto"))))
395 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")))
396 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"))))
397 config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("auto", _("Auto"))))
398 config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, (("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))))
399 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"))))
400 config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, (("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))))
401 config.scan.ter.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
403 config.scan.scansat = {}
404 for sat in nimmanager.satList:
406 config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
408 config.scan.satselection = []
410 for slot in nimmanager.nimslots:
411 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
412 print str(slot.slotid) + " : " + str(self.satList)
413 config.scan.satselection.append(configElement_nonSave("config.scan.satselection[" + str(slot.slotid) + "]", configSatlist, defaultSat["orbpos"], self.satList[slot.slotid]))
415 config.scan.satselection.append(None)
417 self["config"].handleKey(config.key["prevElement"])
421 self["config"].handleKey(config.key["nextElement"])
424 def updateStatus(self):
427 def keyNumberGlobal(self, number):
428 print "You pressed number " + str(number)
429 if (self["config"].getCurrent()[1].parent.enabled == True):
430 self["config"].handleKey(config.key[str(number)])
432 fecmap = { "auto": 0,
445 def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation):
446 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)
447 print "orbpos: " + str(orbital_position)
448 parm = eDVBFrontendParametersSatellite()
450 parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK
452 parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK
454 parm.frequency = frequency * 1000
455 parm.symbol_rate = symbol_rate * 1000
456 parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti
457 parm.fec = self.fecmap[fec] # eDVBFrontendParametersSatellite.FEC.f3_4;
459 parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off;
460 #parm.inversion = 2 #AUTO
461 parm.orbital_position = int(orbital_position)
464 # FIXME use correct parameters
465 def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion):
466 print "Add Cab: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(modulation) + " fec: " + str(fec) + " inversion: " + str(inversion)
467 parm = eDVBFrontendParametersCable()
468 parm.frequency = frequency * 1000
469 parm.symbol_rate = symbol_rate * 1000
470 parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti
471 parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4;
473 parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off;
474 #parm.inversion = 2 #AUTO
477 def addTerTransponder(self, tlist, *args, **kwargs):
478 tlist.append(buildTerTransponder(*args, **kwargs))
483 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
484 if currentConfigSelectionElement(config.scan.type) == "single_transponder":
485 l = len(self.satList)
486 if l and l > config.scan.nims.value:
487 nimsats=self.satList[config.scan.nims.value]
488 l = len(config.scan.satselection)
489 if l and l > config.scan.nims.value:
490 selsatidx=config.scan.satselection[config.scan.nims.value].value
492 if l and l > selsatidx:
493 orbpos=nimsats[selsatidx][1]
494 if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
495 fec = currentConfigSelectionElement(config.scan.sat.fec)
497 fec = currentConfigSelectionElement(config.scan.sat.fec_s2)
498 self.addSatTransponder(tlist, config.scan.sat.frequency.value[0],
499 config.scan.sat.symbolrate.value[0],
500 config.scan.sat.polarization.value,
502 config.scan.sat.inversion.value,
504 config.scan.sat.system.value,
505 config.scan.sat.modulation.value)
506 elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
507 sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value]
508 getInitialTransponderList(tlist, int(sat[1]))
509 flags |= eComponentScan.scanNetworkSearch
510 tmp = currentConfigSelectionElement(config.scan.clearallservices)
512 flags |= eComponentScan.scanRemoveServices
513 elif tmp == "yes_hold_feeds":
514 flags |= eComponentScan.scanRemoveServices
515 flags |= eComponentScan.scanDontRemoveFeeds
516 elif currentConfigSelectionElement(config.scan.type) == "multisat":
517 SatList = nimmanager.getSatListForNim(config.scan.nims.value)
518 for x in self.multiscanlist:
519 if x[1].parent.value == 0:
520 print " " + str(x[1].parent.configPath)
521 getInitialTransponderList(tlist, x[1].parent.configPath)
522 flags |= eComponentScan.scanNetworkSearch
523 tmp = currentConfigSelectionElement(config.scan.clearallservices)
525 flags |= eComponentScan.scanRemoveServices
526 elif tmp == "yes_hold_feeds":
527 flags |= eComponentScan.scanRemoveServices
528 flags |= eComponentScan.scanDontRemoveFeeds
530 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
531 if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
532 self.addCabTransponder(tlist, config.scan.cab.frequency.value[0],
533 config.scan.cab.symbolrate.value[0],
534 config.scan.cab.modulation.value + 1,
535 config.scan.cab.fec.value,
536 config.scan.cab.inversion.value)
537 if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes":
538 flags |= eComponentScan.scanNetworkSearch
539 elif currentConfigSelectionElement(config.scan.typecable) == "complete":
540 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value))
541 flags |= eComponentScan.scanNetworkSearch
542 tmp = currentConfigSelectionElement(config.scan.clearallservices)
544 flags |= eComponentScan.scanRemoveServices
545 elif tmp == "yes_hold_feeds":
546 flags |= eComponentScan.scanRemoveServices
547 flags |= eComponentScan.scanDontRemoveFeeds
549 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
550 if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
551 self.addTerTransponder(tlist,
552 config.scan.ter.frequency.value[0] * 1000000,
553 inversion = config.scan.ter.inversion.value,
554 bandwidth = config.scan.ter.bandwidth.value,
555 fechigh = config.scan.ter.fechigh.value,
556 feclow = config.scan.ter.feclow.value,
557 modulation = config.scan.ter.modulation.value,
558 transmission = config.scan.ter.transmission.value,
559 guard = config.scan.ter.guard.value,
560 hierarchy = config.scan.ter.hierarchy.value)
561 if currentConfigSelectionElement(config.scan.ter.networkScan) == "yes":
562 flags |= eComponentScan.scanNetworkSearch
563 elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
564 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value))
565 flags |= eComponentScan.scanNetworkSearch
566 tmp = currentConfigSelectionElement(config.scan.clearallservices)
568 flags |= eComponentScan.scanRemoveServices
569 elif tmp == "yes_hold_feeds":
570 flags |= eComponentScan.scanRemoveServices
571 flags |= eComponentScan.scanDontRemoveFeeds
573 for x in self["config"].list:
577 feid = config.scan.nims.value
578 # flags |= eComponentScan.scanSearchBAT
579 self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
581 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
587 for x in self["config"].list:
591 class ScanSimple(Screen):
597 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"] and nimmanager.getNimType(0) == nimmanager.getNimType(1):
598 sec = eDVBSatelliteEquipmentControl.getInstance()
600 exclusive_satellites = sec.get_exclusive_satellites(0,1)
602 exclusive_satellites = [0,0]
603 print "exclusive satellites", exclusive_satellites
604 two_sat_tuners = True
606 two_sat_tuners = False
609 slotid = x[1].parent.configPath
610 print "Scan Tuner", slotid, "-", currentConfigSelectionElement(x[1].parent)
611 if currentConfigSelectionElement(x[1].parent) == "yes":
614 if nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-S"]:
617 idx = exclusive_satellites[0]+1
620 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
621 print "exclusive_nim_sats", exclusive_nim_sats
622 SatList = nimmanager.getSatListForNim(slotid)
624 if not two_sat_tuners or (sat[1] in exclusive_nim_sats or slotid == 0):
627 getInitialTransponderList(tlist, sat[1])
628 elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-C"]:
630 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
631 elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-T"]:
633 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
635 flags=eComponentScan.scanNetworkSearch
636 tmp = currentConfigSelectionElement(config.scan.clearallservices)
638 flags |= eComponentScan.scanRemoveServices
639 elif tmp == "yes_hold_feeds":
640 flags |= eComponentScan.scanRemoveServices
641 flags |= eComponentScan.scanDontRemoveFeeds
642 scanList.append({"transponders": tlist, "feid": slotid, "flags": flags})
644 self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
646 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
655 self["config"].handleKey(config.key["prevElement"])
658 self["config"].handleKey(config.key["nextElement"])
660 def Satexists(self, tlist, pos):
666 def ScanNimTwoNeeded(self):
667 if nimmanager.getNimType(0) != nimmanager.getNimType(1):
669 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"]: #two dvb-s nims
670 if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
672 sec = eDVBSatelliteEquipmentControl.getInstance()
674 exclusive_satellites = sec.get_exclusive_satellites(0,1)
675 if len(exclusive_satellites) == 2:
677 idx = exclusive_satellites[0]+1
678 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
679 if len(exclusive_nim_sats):
681 return False # two -C or two -T tuners
683 def __init__(self, session):
684 Screen.__init__(self, session)
686 self["actions"] = ActionMap(["SetupActions"],
689 "cancel": self.keyCancel,
690 "left": self.keyLeft,
691 "right": self.keyRight,
697 nimcount = nimmanager.getNimSocketCount()
699 nimtype = nimmanager.getNimType(0)
701 config.scan = ConfigSubsection()
702 config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))))
703 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
704 nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
705 if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
708 self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
710 if nimcount > 1 and self.ScanNimTwoNeeded():
711 nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
712 self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
714 self["config"] = ConfigList(self.list)
715 self["header"] = Label(_("Automatic Scan"))
716 self["footer"] = Label(_("Press OK to scan"))