1 from Screen import Screen
2 from ServiceScan import *
3 from Components.config import config, ConfigSubsection, ConfigSelection, ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigSatlist, ConfigEnableDisable
4 from Components.ActionMap import NumberActionMap
5 from Components.ConfigList import ConfigList, ConfigListScreen
6 from Components.NimManager import nimmanager, getConfigSatlist
7 from Components.Label import Label
8 from Screens.MessageBox import MessageBox
9 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable
11 def buildTerTransponder(frequency,
12 inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
13 modulation = 2, transmission = 2, guard = 4,
16 # print "freq", frequency, "inv", inversion, "bw", bandwidth, "fech", fechigh, "fecl", feclow, "mod", modulation, "tm", transmission, "guard", guard, "hierarchy", hierarchy
18 # WARNING: normally, enums are working directly.
19 # Don't copy this (very bad)!! Instead either fix swig (good) or
20 # move this into a central place.
24 #Bw5MHz = 3 #not implemented for e1 compatibilty
36 #TM4k = 2 #not implemented for e1 compatibilty
60 parm = eDVBFrontendParametersTerrestrial()
62 parm.frequency = frequency
64 parm.inversion = [Off, On, Unknown][inversion]
65 parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported
66 parm.code_rate_HP = [f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh]
67 parm.code_rate_LP = [f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow]
68 parm.modulation = [QPSK, QAM16, QAM64, Auto][modulation]
69 parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported
70 parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard]
71 parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy]
75 def getInitialTransponderList(tlist, pos):
76 list = nimmanager.getTransponders(pos)
80 parm = eDVBFrontendParametersSatellite()
82 parm.symbol_rate = x[2]
83 parm.polarisation = x[3]
85 parm.inversion = 2 # AUTO
86 parm.orbital_position = pos
88 parm.modulation = x[6]
91 def getInitialCableTransponderList(tlist, cable):
92 list = nimmanager.getTranspondersCable(cable)
94 symbolrates = [6900000, 6875000]
95 modulations = [3, 5, 1, 2, 4] # QAM 64, 256, 16, 32, 128
99 for symbolrate in symbolrates:
100 for modulation in modulations:
101 parm = eDVBFrontendParametersCable()
102 parm.frequency = x[1]
103 parm.symbol_rate = symbolrate
104 parm.modulation = modulation
106 parm.inversion = 2 # AUTO
107 #print "frequency:", x[1]
108 #print "symbol_rate:", x[2]
109 #print "modulation:", x[3]
110 #print "fec_inner:", x[4]
111 #print "inversion:", 2
114 def getInitialTerrestrialTransponderList(tlist, region):
115 list = nimmanager.getTranspondersTerrestrial(region)
117 #self.transponders[self.parsedTer].append((2,freq,bw,const,crh,crl,guard,transm,hierarchy,inv))
119 #def buildTerTransponder(frequency, inversion = 2, bandwidth = 3, fechigh = 6, feclow = 6,
120 #modulation = 2, transmission = 2, guard = 4, hierarchy = 4):
123 if x[0] == 2: #TERRESTRIAL
124 parm = buildTerTransponder(x[1], x[9], x[2], x[4], x[5], x[3], x[7], x[6], x[8])
128 class ScanSetup(ConfigListScreen, Screen):
129 def __init__(self, session):
130 Screen.__init__(self, session)
133 self.service = session.nav.getCurrentService()
136 if self.service is not None:
137 self.feinfo = self.service.frontendInfo()
138 frontendData = self.feinfo and self.feinfo.getAll(True)
140 self.createConfig(frontendData)
145 self["actions"] = NumberActionMap(["SetupActions"],
148 "cancel": self.keyCancel,
151 self.statusTimer = eTimer()
152 self.statusTimer.timeout.get().append(self.updateStatus)
153 #self.statusTimer.start(5000, True)
156 ConfigListScreen.__init__(self, self.list)
159 self["introduction"] = Label(_("Press OK to start the scan"))
164 def updateSatList(self):
166 for slot in nimmanager.nim_slots:
167 if slot.isCompatible("DVB-S"):
168 self.satList.append(nimmanager.getSatListForNim(slot.slot))
170 self.satList.append(None)
172 def createSetup(self):
174 self.multiscanlist = []
175 index_to_scan = int(self.scan_nims.value)
176 print "ID: ", index_to_scan
178 self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
179 self.list.append(self.tunerEntry)
181 if self.scan_nims == [ ]:
184 self.typeOfScanEntry = None
185 self.systemEntry = None
186 nim = nimmanager.nim_slots[index_to_scan]
187 if nim.isCompatible("DVB-S"):
188 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type)
189 self.list.append(self.typeOfScanEntry)
190 elif nim.isCompatible("DVB-C"):
191 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typecable)
192 self.list.append(self.typeOfScanEntry)
193 elif nim.isCompatible("DVB-T"):
194 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial)
195 self.list.append(self.typeOfScanEntry)
197 if nim.isCompatible("DVB-S"):
198 if self.scan_type.value == "single_transponder":
200 if nim.isCompatible("DVB-S2"):
201 self.systemEntry = getConfigListEntry(_('System'), self.scan_sat.system)
202 self.list.append(self.systemEntry)
204 # downgrade to dvb-s, in case a -s2 config was active
205 self.scan_sat.system.value = "dvb-s"
206 self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[index_to_scan]))
207 self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
208 self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
209 self.list.append(getConfigListEntry(_('Symbol Rate'), self.scan_sat.symbolrate))
210 self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
211 if self.scan_sat.system.value == "dvb-s":
212 self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
213 elif self.scan_sat.system.value == "dvb-s2":
214 self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2))
215 self.list.append(getConfigListEntry(_('Modulation'), self.scan_sat.modulation))
216 elif self.scan_type.value == "single_satellite":
218 print self.scan_satselection[index_to_scan]
219 self.list.append(getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan]))
220 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
221 elif self.scan_type.value == "multisat":
224 SatList = nimmanager.getSatListForNim(index_to_scan)
225 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
227 if self.Satexists(tlist, x[0]) == 0:
229 sat = ConfigEnableDisable(default = True)
230 configEntry = getConfigListEntry(nimmanager.getSatDescription(x[0]), sat)
231 self.list.append(configEntry)
232 self.multiscanlist.append((x[0], sat))
234 # for sat in nimmanager.satList:
235 # self.list.append(getConfigListEntry(sat[1], self.scan_scansat[sat[0]]))
238 if nim.isCompatible("DVB-C"):
239 if self.scan_typecable.value == "single_transponder":
240 self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
241 self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
242 self.list.append(getConfigListEntry(_("Symbol Rate"), self.scan_cab.symbolrate))
243 self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
244 self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
245 self.list.append(getConfigListEntry(_("Network scan"), self.scan_cab.networkScan))
246 elif self.scan_typecable.value == "complete":
247 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
249 if nim.isCompatible("DVB-T"):
250 if self.scan_typeterrestrial.value == "single_transponder":
251 self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency))
252 self.list.append(getConfigListEntry(_("Network scan"), self.scan_ter.networkScan))
253 self.list.append(getConfigListEntry(_("Inversion"), self.scan_ter.inversion))
254 self.list.append(getConfigListEntry(_("Bandwidth"), self.scan_ter.bandwidth))
255 self.list.append(getConfigListEntry(_("Code rate high"), self.scan_ter.fechigh))
256 self.list.append(getConfigListEntry(_("Code rate low"), self.scan_ter.feclow))
257 self.list.append(getConfigListEntry(_("Modulation"), self.scan_ter.modulation))
258 self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
259 self.list.append(getConfigListEntry(_("Guard interval mode"), self.scan_ter.guard))
260 self.list.append(getConfigListEntry(_("Hierarchy mode"), self.scan_ter.hierarchy))
261 elif self.scan_typeterrestrial.value == "complete":
262 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
264 # if (nim.isCompatible("DVB-S") and self.scan_type.type == "single_transponder") or \
265 # (nim.isCompatbile("DVB-C") and self.scan_typecable.type == "single_transponder") or \
266 # (nim.isCompatible("DVB-T") and self.scan_typeterrestrial.type == "single_transponder"):
267 # self.configElementSNR = getConfigListEntry(_("SNR"), self.scan_snr)
268 # self.list.append(self.configElementSNR)
269 # self.configElementACG = getConfigListEntry(_("AGC"), self.scan_agc)
270 # self.list.append(self.configElementACG)
271 # self.configElementBER = getConfigListEntry(_("BER"), self.scan_ber)
272 # self.list.append(self.configElementBER)
273 # self.statusTimer.start(500, False)
275 # self.statusTimer.stop()
277 self["config"].list = self.list
278 self["config"].l.setList(self.list)
280 def Satexists(self, tlist, pos):
287 print self["config"].getCurrent()
288 if self["config"].getCurrent() == self.typeOfScanEntry:
290 elif self["config"].getCurrent() == self.tunerEntry:
292 elif self["config"].getCurrent() == self.systemEntry:
295 def createConfig(self, frontendData):
296 #("Type", frontendData["system"], TYPE_TEXT),
297 #("Modulation", frontendData["modulation"], TYPE_TEXT),
298 #("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC),
299 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
300 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
301 #("Polarization", frontendData["polarization"], TYPE_TEXT),
302 #("Inversion", frontendData["inversion"], TYPE_TEXT),
303 #("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
305 #elif frontendData["tuner_type"] == "DVB-C":
306 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
307 #("Type", frontendData["tuner_type"], TYPE_TEXT),
308 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
309 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
310 #("Modulation", frontendData["modulation"], TYPE_TEXT),
311 #("Inversion", frontendData["inversion"], TYPE_TEXT),
312 # ("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
314 #elif frontendData["tuner_type"] == "DVB-T":
315 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
316 #("Type", frontendData["tuner_type"], TYPE_TEXT),
317 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
318 #("Inversion", frontendData["inversion"], TYPE_TEXT),
319 #("Bandwidth", frontendData["bandwidth"], TYPE_VALUE_DEC),
320 #("CodeRateLP", frontendData["code_rate_lp"], TYPE_TEXT),
321 #("CodeRateHP", frontendData["code_rate_hp"], TYPE_TEXT),
322 #("Constellation", frontendData["constellation"], TYPE_TEXT),
323 #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
324 #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
325 #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
326 defaultSat = { "orbpos": 192, "system": "dvb-s", "frequency": 11836, "inversion": "auto", "symbolrate": 27500, "polarization": "horizontal", "fec": "auto", "fec_s2": "9_10", "modulation": "qpsk" }
327 defaultCab = {"frequency": 466, "inversion": "auto", "modulation": "64qam", "fec": "auto", "symbolrate": 6900}
328 if frontendData is not None:
329 ttype = frontendData.get("tuner_type", "UNKNOWN")
331 defaultSat["system"] = {"DVB-S": "dvb-s", "DVB-S2": "dvb-s2"}[frontendData.get("system", "DVB-S")]
332 defaultSat["frequency"] = int(frontendData.get("frequency", 0) / 1000)
333 defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData.get("inversion", "INVERSION_AUTO")]
334 defaultSat["symbolrate"] = int(frontendData.get("symbol_rate", 0) / 1000)
335 defaultSat["polarization"] = {"HORIZONTAL": "horizontal", "VERTICAL": "vertical", "CIRCULAR_LEFT": "circular_left", "CIRCULAR_RIGHT": "circular_right", "UNKNOWN": None}[frontendData.get("polarization", "HORIZONTAL")]
337 if frontendData.get("system", "DVB-S") == "DVB-S2":
338 defaultSat["fec_s2"] = {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"} \
339 [frontendData.get("fec_inner", "FEC_AUTO")]
341 defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"} \
342 [frontendData.get("fec_inner", "FEC_AUTO")]
344 defaultSat["modulation"] = {"QPSK": "qpsk", "8PSK": "8psk"}[frontendData.get("modulation", "QPSK")]
345 defaultSat["orbpos"] = frontendData.get("orbital_position", 0)
346 elif ttype == "DVB-C":
347 defaultCab["frequency"] = int(frontendData.get("frequency", 0) / 1000)
348 defaultCab["symbolrate"] = int(frontendData.get("symbol_rate", 0) / 1000)
349 defaultCab["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData.get("inversion", "INVERSION_AUTO")]
350 defaultCab["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_NONE": "none"}[frontendData.get("fec_inner", "FEC_AUTO")]
351 defaultCab["modulation"] = {"QAM_AUTO": "auto", "QAM_16": "16qam", "QAM_32": "32qam", "QAM_64": "64qam", "QAM_128": "128qam", "QAM_256": "256qam"}[frontendData.get("modulation", "QAM_16")]
353 self.scan_sat = ConfigSubsection()
354 self.scan_cab = ConfigSubsection()
355 self.scan_ter = ConfigSubsection()
357 self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))])
358 self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
359 self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
360 self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
363 # collect all nims which are *not* set to "nothing"
364 for n in nimmanager.nim_slots:
365 if n.config_mode != "nothing":
366 nim_list.append((str(n.slot), n.friendly_full_description))
368 self.scan_nims = ConfigSelection(choices = nim_list)
371 self.scan_snr = ConfigSlider()
372 self.scan_snr.enabled = False
373 self.scan_agc = ConfigSlider()
374 self.scan_agc.enabled = False
375 self.scan_ber = ConfigSlider()
376 self.scan_ber.enabled = False
379 self.scan_sat.system = ConfigSelection(default = defaultSat["system"], choices = [("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))])
380 self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
381 self.scan_sat.inversion = ConfigSelection(default = defaultSat["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
382 self.scan_sat.symbolrate = ConfigInteger(default = defaultSat["symbolrate"], limits = (1, 99999))
383 self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [("horizontal", _("horizontal")), ("vertical", _("vertical")), ("circular_left", _("circular left")), ("circular_right", _("circular right"))])
384 self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))])
385 self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [("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")])
386 self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [("qpsk", "QPSK"), ("8psk", "8PSK")])
389 self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999))
390 self.scan_cab.inversion = ConfigSelection(default = defaultCab["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
391 self.scan_cab.modulation = ConfigSelection(default = defaultCab["modulation"], choices = [("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM")])
392 self.scan_cab.fec = ConfigSelection(default = defaultCab["fec"], choices = [("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"))])
393 self.scan_cab.symbolrate = ConfigInteger(default = defaultCab["symbolrate"], limits = (1, 99999))
394 self.scan_cab.networkScan = ConfigYesNo(default = False)
397 self.scan_ter.frequency = ConfigInteger(default = 466000, limits = (50000, 999000))
398 self.scan_ter.inversion = ConfigSelection(default = "auto", choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
399 # WORKAROUND: we can't use BW-auto
400 self.scan_ter.bandwidth = ConfigSelection(default = "8MHz", choices = [("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")])
401 #, ("auto", _("Auto"))))
402 self.scan_ter.fechigh = ConfigSelection(default = "auto", choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))])
403 self.scan_ter.feclow = ConfigSelection(default = "auto", choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))])
404 self.scan_ter.modulation = ConfigSelection(default = "auto", choices = [("qpsk", "QPSK"), ("qam16", "QAM16"), ("qam64", "QAM64"), ("auto", _("Auto"))])
405 self.scan_ter.transmission = ConfigSelection(default = "auto", choices = [("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))])
406 self.scan_ter.guard = ConfigSelection(default = "auto", choices = [("1_32", "1/32"), ("1_16", "1/16"), ("1_8", "1/8"), ("1_4", "1/4"), ("auto", _("Auto"))])
407 self.scan_ter.hierarchy = ConfigSelection(default = "auto", choices = [("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))])
408 self.scan_ter.networkScan = ConfigYesNo(default = False)
410 self.scan_scansat = {}
411 for sat in nimmanager.satList:
413 self.scan_scansat[sat[0]] = ConfigYesNo(default = False)
415 self.scan_satselection = []
416 for slot in nimmanager.nim_slots:
417 if slot.isCompatible("DVB-S"):
418 self.scan_satselection.append(getConfigSatlist(int(defaultSat["orbpos"]), self.satList[slot.slot]))
420 self.scan_satselection.append(None)
425 ConfigListScreen.keyLeft(self)
429 ConfigListScreen.keyRight(self)
432 def updateStatus(self):
435 fecmap = { "auto": 0,
448 def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation):
449 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)
450 print "orbpos: " + str(orbital_position)
451 parm = eDVBFrontendParametersSatellite()
453 parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK
455 parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK
457 parm.frequency = frequency * 1000
458 parm.symbol_rate = symbol_rate * 1000
459 parm.polarisation = polarisation
460 parm.fec = self.fecmap[fec]
461 parm.inversion = inversion
462 parm.orbital_position = int(orbital_position)
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
471 parm.fec = self.fecmap[fec]
472 parm.inversion = inversion
475 def addTerTransponder(self, tlist, *args, **kwargs):
476 tlist.append(buildTerTransponder(*args, **kwargs))
481 index_to_scan = int(self.scan_nims.value)
483 if self.scan_nims == [ ]:
484 self.session.open(MessageBox, _("No tuner is enabled!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
487 nim = nimmanager.nim_slots[index_to_scan]
488 print "nim", nim.slot
489 if nim.isCompatible("DVB-S"):
490 print "is compatible with DVB-S"
491 if self.scan_type.value == "single_transponder":
492 print "single transponder"
494 # these lists are generated for each tuner, so this has work.
495 assert len(self.satList) > index_to_scan
496 assert len(self.scan_satselection) > index_to_scan
498 nimsats = self.satList[index_to_scan]
499 selsatidx = self.scan_satselection[index_to_scan].index
501 # however, the satList itself could be empty. in that case, "index" is 0 (for "None").
502 print "nimsats:", nimsats
504 orbpos = nimsats[selsatidx][0]
505 if self.scan_sat.system.value == "dvb-s":
506 fec = self.scan_sat.fec.value
508 fec = self.scan_sat.fec_s2.value
509 print "add sat transponder"
510 self.addSatTransponder(tlist, self.scan_sat.frequency.value,
511 self.scan_sat.symbolrate.value,
512 self.scan_sat.polarization.index,
514 self.scan_sat.inversion.index,
516 self.scan_sat.system.index,
517 self.scan_sat.modulation.index)
518 elif self.scan_type.value == "single_satellite":
519 sat = self.satList[index_to_scan][self.scan_satselection[index_to_scan].index]
520 getInitialTransponderList(tlist, sat[0])
521 flags |= eComponentScan.scanNetworkSearch
522 tmp = self.scan_clearallservices.value
524 flags |= eComponentScan.scanRemoveServices
525 elif tmp == "yes_hold_feeds":
526 flags |= eComponentScan.scanRemoveServices
527 flags |= eComponentScan.scanDontRemoveFeeds
528 elif self.scan_type.value == "multisat":
529 SatList = nimmanager.getSatListForNim(index_to_scan)
530 for x in self.multiscanlist:
532 print " " + str(x[0])
533 getInitialTransponderList(tlist, x[0])
534 flags |= eComponentScan.scanNetworkSearch
535 tmp = self.scan_clearallservices.value
537 flags |= eComponentScan.scanRemoveServices
538 elif tmp == "yes_hold_feeds":
539 flags |= eComponentScan.scanRemoveServices
540 flags |= eComponentScan.scanDontRemoveFeeds
542 elif nim.isCompatible("DVB-C"):
543 if self.scan_typecable.value == "single_transponder":
544 fec = self.scan_cab.fec.value
545 self.addCabTransponder(tlist, self.scan_cab.frequency.value,
546 self.scan_cab.symbolrate.value,
547 self.scan_cab.modulation.index + 1,
549 self.scan_cab.inversion.index)
550 if self.scan_cab.networkScan.value:
551 flags |= eComponentScan.scanNetworkSearch
552 elif self.scan_typecable.value == "complete":
553 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(index_to_scan))
554 flags |= eComponentScan.scanNetworkSearch
555 tmp = self.scan_clearallservices
557 flags |= eComponentScan.scanRemoveServices
558 elif tmp == "yes_hold_feeds":
559 flags |= eComponentScan.scanRemoveServices
560 flags |= eComponentScan.scanDontRemoveFeeds
562 elif nim.isCompatible("DVB-T"):
563 if self.scan_typeterrestrial.value == "single_transponder":
564 self.addTerTransponder(tlist,
565 self.scan_ter.frequency.value * 1000,
566 inversion = self.scan_ter.inversion.index,
567 bandwidth = self.scan_ter.bandwidth.index,
568 fechigh = self.scan_ter.fechigh.index,
569 feclow = self.scan_ter.feclow.index,
570 modulation = self.scan_ter.modulation.index,
571 transmission = self.scan_ter.transmission.index,
572 guard = self.scan_ter.guard.index,
573 hierarchy = self.scan_ter.hierarchy.index)
574 if self.scan_ter.networkScan.value:
575 flags |= eComponentScan.scanNetworkSearch
576 elif self.scan_typeterrestrial.value == "complete":
577 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan))
578 flags |= eComponentScan.scanNetworkSearch
579 tmp = self.scan_clearallservices.value
581 flags |= eComponentScan.scanRemoveServices
582 elif tmp == "yes_hold_feeds":
583 flags |= eComponentScan.scanRemoveServices
584 flags |= eComponentScan.scanDontRemoveFeeds
586 for x in self["config"].list:
591 # flags |= eComponentScan.scanSearchBAT
592 self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
594 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
600 for x in self["config"].list:
604 class ScanSimple(ConfigListScreen, Screen):
605 def getNetworksForNim(self, nim):
606 if nim.isCompatible("DVB-S"):
607 networks = nimmanager.getSatListForNim(nim.slot)
608 # the original code took "loopthrough" etc. into account. Do we need this?
609 # if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
611 # sec = eDVBSatelliteEquipmentControl.getInstance()
612 # if sec is not None:
613 # exclusive_satellites = sec.get_exclusive_satellites(0,1)
614 # if len(exclusive_satellites) == 2:
616 # idx = exclusive_satellites[0]+1
617 # exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
618 # if len(exclusive_nim_sats):
621 networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
623 # empty tuners provide no networks.
627 def __init__(self, session):
628 Screen.__init__(self, session)
630 self["actions"] = ActionMap(["SetupActions"],
633 "cancel": self.keyCancel,
642 for nim in nimmanager.nim_slots:
643 # collect networks provided by this tuner
646 networks = self.getNetworksForNim(nim)
648 print "nim %d provides" % nim.slot, networks
649 print "known:", known_networks
651 # we only need to scan on the first tuner which provides a network.
652 # this gives the first tuner for each network priority for scanning.
654 if x not in known_networks:
656 print x, "not in ", known_networks
657 known_networks.append(x)
660 nims_to_scan.append(nim)
662 # we save the config elements to use them on keyGo
663 self.nim_enable = [ ]
665 if len(nims_to_scan):
666 self.scan_clearallservices = ConfigSelection(default = "yes", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
667 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
669 for nim in nims_to_scan:
670 nimconfig = ConfigYesNo(default = True)
671 nimconfig.nim_index = nim.slot
672 self.nim_enable.append(nimconfig)
673 self.list.append(getConfigListEntry(_("Scan ") + nim.slot_name + " (" + nim.friendly_type + ")", nimconfig))
675 ConfigListScreen.__init__(self, self.list)
676 self["header"] = Label(_("Automatic Scan"))
677 self["footer"] = Label(_("Press OK to scan"))
685 known_networks = set()
687 for n in self.nim_enable:
688 if not n.value: # ignore if scanning on this nim is not enabled
691 nim = nimmanager.nim_slots[n.nim_index]
692 networks = set(self.getNetworksForNim(nim))
694 # don't scan anything twice
695 networks.discard(known_networks)
701 if nim.isCompatible("DVB-S"):
702 # get initial transponders for each satellite to be scanned
704 getInitialTransponderList(tlist, sat[0])
705 elif nim.isCompatible("DVB-C"):
706 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(nim.slot))
707 if nim.cable_trust_nit:
709 elif nim.isCompatible("DVB-T"):
710 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot))
714 flags=eComponentScan.scanNetworkSearch
716 flags |= eComponentScan.clearToScanOnFirstNIT
717 tmp = self.scan_clearallservices.value
719 flags |= eComponentScan.scanRemoveServices
720 elif tmp == "yes_hold_feeds":
721 flags |= eComponentScan.scanRemoveServices
722 flags |= eComponentScan.scanDontRemoveFeeds
723 scanList.append({"transponders": tlist, "feid": nim.slot, "flags": flags})
726 self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
728 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
736 def Satexists(self, tlist, pos):