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.getFrontendData(True)
139 self.createConfig(frontendData)
143 self["actions"] = NumberActionMap(["SetupActions"],
146 "cancel": self.keyCancel,
149 self.statusTimer = eTimer()
150 self.statusTimer.timeout.get().append(self.updateStatus)
151 #self.statusTimer.start(5000, True)
154 ConfigListScreen.__init__(self, self.list)
157 self["introduction"] = Label(_("Press OK to start the scan"))
162 def updateSatList(self):
164 for slot in nimmanager.nimslots:
165 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
166 self.satList.append(nimmanager.getSatListForNim(slot.slotid))
168 self.satList.append(None)
170 def createSetup(self):
172 self.multiscanlist = []
173 print "ID: ", self.scan_nims.index
175 self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
176 self.list.append(self.tunerEntry)
178 self.typeOfScanEntry = None
179 self.systemEntry = None
180 if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
181 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type)
182 self.list.append(self.typeOfScanEntry)
183 elif nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]:
184 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typecable)
185 self.list.append(self.typeOfScanEntry)
186 elif nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]:
187 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial)
188 self.list.append(self.typeOfScanEntry)
190 if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
191 if self.scan_type.value == "single_transponder":
192 if nimmanager.getNimName(self.scan_nims.index).find("DVB-S2") != -1:
193 self.systemEntry = getConfigListEntry(_('Transpondertype'), self.scan_sat.system)
194 self.list.append(self.systemEntry)
195 self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[self.scan_nims.index]))
196 self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
197 self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
198 self.list.append(getConfigListEntry(_('Symbol Rate'), self.scan_sat.symbolrate))
199 self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
200 if self.scan_sat.system.value == "dvb-s":
201 self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
202 elif self.scan_sat.system.value == "dvb-s2":
203 self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2))
204 self.list.append(getConfigListEntry(_('Modulation'), self.scan_sat.modulation))
205 elif self.scan_type.value == "single_satellite":
207 print self.scan_satselection[self.scan_nims.index]
208 self.list.append(getConfigListEntry(_("Satellite"), self.scan_satselection[self.scan_nims.index]))
209 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
210 elif self.scan_type.value == "multisat":
213 SatList = nimmanager.getSatListForNim(self.scan_nims.index)
214 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
216 if self.Satexists(tlist, x[0]) == 0:
218 sat = ConfigEnableDisable(default = True)
219 configEntry = getConfigListEntry(nimmanager.getSatDescription(x[0]), sat)
220 self.list.append(configEntry)
221 self.multiscanlist.append((x[0], sat))
223 # for sat in nimmanager.satList:
224 # self.list.append(getConfigListEntry(sat[1], self.scan_scansat[sat[0]]))
227 if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]:
228 if self.scan_typecable.value == "single_transponder":
229 self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
230 self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
231 self.list.append(getConfigListEntry(_("Symbol Rate"), self.scan_cab.symbolrate))
232 self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
233 self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
234 self.list.append(getConfigListEntry(_("Network scan"), self.scan_cab.networkScan))
235 elif self.scan_typecable.value == "complete":
236 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
238 if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]:
239 if self.scan_typeterrestrial.value == "single_transponder":
240 self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency))
241 self.list.append(getConfigListEntry(_("Network scan"), self.scan_ter.networkScan))
242 self.list.append(getConfigListEntry(_("Inversion"), self.scan_ter.inversion))
243 self.list.append(getConfigListEntry(_("Bandwidth"), self.scan_ter.bandwidth))
244 self.list.append(getConfigListEntry(_("Code rate high"), self.scan_ter.fechigh))
245 self.list.append(getConfigListEntry(_("Code rate low"), self.scan_ter.feclow))
246 self.list.append(getConfigListEntry(_("Modulation"), self.scan_ter.modulation))
247 self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
248 self.list.append(getConfigListEntry(_("Guard interval mode"), self.scan_ter.guard))
249 self.list.append(getConfigListEntry(_("Hierarchy mode"), self.scan_ter.hierarchy))
250 elif self.scan_typeterrestrial.value == "complete":
251 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
253 # if (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"] and self.scan_type.type == "single_transponder") or \
254 # (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"] and self.scan_typecable.type == "single_transponder") or \
255 # (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"] and self.scan_typeterrestrial.type == "single_transponder"):
256 # self.configElementSNR = getConfigListEntry(_("SNR"), self.scan_snr)
257 # self.list.append(self.configElementSNR)
258 # self.configElementACG = getConfigListEntry(_("AGC"), self.scan_agc)
259 # self.list.append(self.configElementACG)
260 # self.configElementBER = getConfigListEntry(_("BER"), self.scan_ber)
261 # self.list.append(self.configElementBER)
262 # self.statusTimer.start(500, False)
264 # self.statusTimer.stop()
266 self["config"].list = self.list
267 self["config"].l.setList(self.list)
269 def Satexists(self, tlist, pos):
276 print self["config"].getCurrent()
277 if self["config"].getCurrent() == self.typeOfScanEntry:
279 elif self["config"].getCurrent() == self.tunerEntry:
281 elif self["config"].getCurrent() == self.systemEntry:
284 def createConfig(self, frontendData):
285 #("Type", frontendData["system"], TYPE_TEXT),
286 #("Modulation", frontendData["modulation"], TYPE_TEXT),
287 #("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC),
288 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
289 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
290 #("Polarization", frontendData["polarization"], TYPE_TEXT),
291 #("Inversion", frontendData["inversion"], TYPE_TEXT),
292 #("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
294 #elif frontendData["tuner_type"] == "DVB-C":
295 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
296 #("Type", frontendData["tuner_type"], TYPE_TEXT),
297 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
298 #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
299 #("Modulation", frontendData["modulation"], TYPE_TEXT),
300 #("Inversion", frontendData["inversion"], TYPE_TEXT),
301 # ("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
303 #elif frontendData["tuner_type"] == "DVB-T":
304 #return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
305 #("Type", frontendData["tuner_type"], TYPE_TEXT),
306 #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
307 #("Inversion", frontendData["inversion"], TYPE_TEXT),
308 #("Bandwidth", frontendData["bandwidth"], TYPE_VALUE_DEC),
309 #("CodeRateLP", frontendData["code_rate_lp"], TYPE_TEXT),
310 #("CodeRateHP", frontendData["code_rate_hp"], TYPE_TEXT),
311 #("Constellation", frontendData["constellation"], TYPE_TEXT),
312 #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
313 #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
314 #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
315 defaultSat = { "orbpos": 192, "system": "dvb-s", "frequency": 11836, "inversion": "auto", "symbolrate": 27500, "polarization": "horizontal", "fec": "auto", "fec_s2": "9_10", "modulation": "qpsk" }
316 defaultCab = {"frequency": 466, "inversion": "auto", "modulation": "64qam", "fec": "auto", "symbolrate": 6900}
317 if frontendData is not None:
318 if frontendData["tuner_type"] == "DVB-S":
319 defaultSat["system"] = {"DVB-S": "dvb-s", "DVB-S2": "dvb-s2"}[frontendData["system"]]
320 defaultSat["frequency"] = int(frontendData["frequency"] / 1000)
321 defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
322 defaultSat["symbolrate"] = int(frontendData["symbol_rate"] / 1000)
323 defaultSat["polarization"] = {"HORIZONTAL": "horizontal", "VERTICAL": "vertical", "CIRCULAR_LEFT": "circular_left", "CIRCULAR_RIGHT": "circular_right", "UNKNOWN": None}[frontendData["polarization"]]
324 defaultSat["fec"] = {"DVB-S": {"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"}, "DVB-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"}}[frontendData["system"]][frontendData["fec_inner"]]
325 defaultSat["modulation"] = {"QPSK": "qpsk", "8PSK": "8psk"}[frontendData["modulation"]]
326 defaultSat["orbpos"] = frontendData["orbital_position"]
327 elif frontendData["tuner_type"] == "DVB-C":
328 defaultCab["frequency"] = int(frontendData["frequency"] / 1000)
329 defaultCab["symbolrate"] = int(frontendData["symbol_rate"] / 1000)
330 defaultCab["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
331 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["fec_inner"]]
332 defaultCab["modulation"] = {"QAM_AUTO": "auto", "QAM_16": "16qam", "QAM_32": "32qam", "QAM_64": "64qam", "QAM_128": "128qam", "QAM_256": "256qam"}[frontendData["modulation"]]
334 self.scan_sat = ConfigSubsection()
335 self.scan_cab = ConfigSubsection()
336 self.scan_ter = ConfigSubsection()
338 self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))])
339 self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
340 self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
341 self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
344 for nim in nimmanager.nimList():
345 nimList.append(nim[0])
346 #nimList.append("all")
347 self.scan_nims = ConfigSelection(choices = nimList)
350 self.scan_snr = ConfigSlider()
351 self.scan_snr.enabled = False
352 self.scan_agc = ConfigSlider()
353 self.scan_agc.enabled = False
354 self.scan_ber = ConfigSlider()
355 self.scan_ber.enabled = False
358 self.scan_sat.system = ConfigSelection(default = defaultSat["system"], choices = [("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))])
359 self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
360 self.scan_sat.inversion = ConfigSelection(default = defaultSat["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
361 self.scan_sat.symbolrate = ConfigInteger(default = defaultSat["symbolrate"], limits = (1, 99999))
362 self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [("horizontal", _("horizontal")), ("vertical", _("vertical")), ("circular_left", _("circular left")), ("circular_right", _("circular right"))])
363 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"))])
364 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")])
365 self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [("qpsk", "QPSK"), ("8psk", "8PSK")])
368 self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999))
369 self.scan_cab.inversion = ConfigSelection(default = defaultCab["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
370 self.scan_cab.modulation = ConfigSelection(default = defaultCab["modulation"], choices = [("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM")])
371 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"))])
372 self.scan_cab.symbolrate = ConfigInteger(default = defaultCab["symbolrate"], limits = (1, 99999))
373 self.scan_cab.networkScan = ConfigYesNo(default = False)
376 self.scan_ter.frequency = ConfigInteger(default = 466, limits = (100, 999))
377 self.scan_ter.inversion = ConfigSelection(default = "auto", choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
378 # WORKAROUND: we can't use BW-auto
379 self.scan_ter.bandwidth = ConfigSelection(default = "8MHz", choices = [("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")])
380 #, ("auto", _("Auto"))))
381 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"))])
382 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"))])
383 self.scan_ter.modulation = ConfigSelection(default = "auto", choices = [("qpsk", "QPSK"), ("qam16", "QAM16"), ("qam64", "QAM64"), ("auto", _("Auto"))])
384 self.scan_ter.transmission = ConfigSelection(default = "auto", choices = [("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))])
385 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"))])
386 self.scan_ter.hierarchy = ConfigSelection(default = "auto", choices = [("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))])
387 self.scan_ter.networkScan = ConfigYesNo(default = False)
389 self.scan_scansat = {}
390 for sat in nimmanager.satList:
392 self.scan_scansat[sat[0]] = ConfigYesNo(default = False)
394 self.scan_satselection = []
396 for slot in nimmanager.nimslots:
397 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
398 print str(slot.slotid) + " : " + str(self.satList)
399 self.scan_satselection.append(getConfigSatlist(int(defaultSat["orbpos"]), self.satList[slot.slotid]))
401 self.scan_satselection.append(None)
404 ConfigListScreen.keyLeft(self)
408 ConfigListScreen.keyRight(self)
411 def updateStatus(self):
414 fecmap = { "auto": 0,
427 def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation):
428 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)
429 print "orbpos: " + str(orbital_position)
430 parm = eDVBFrontendParametersSatellite()
432 parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK
434 parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK
436 parm.frequency = frequency * 1000
437 parm.symbol_rate = symbol_rate * 1000
438 parm.polarisation = polarisation
439 parm.fec = self.fecmap[fec]
440 parm.inversion = inversion
441 parm.orbital_position = int(orbital_position)
444 def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion):
445 print "Add Cab: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(modulation) + " fec: " + str(fec) + " inversion: " + str(inversion)
446 parm = eDVBFrontendParametersCable()
447 parm.frequency = frequency * 1000
448 parm.symbol_rate = symbol_rate * 1000
449 parm.modulation = modulation
450 parm.fec = self.fecmap[fec]
451 parm.inversion = inversion
454 def addTerTransponder(self, tlist, *args, **kwargs):
455 tlist.append(buildTerTransponder(*args, **kwargs))
460 if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
461 if self.scan_type.value == "single_transponder":
462 l = len(self.satList)
463 if l and l > self.scan_nims.index:
464 nimsats=self.satList[self.scan_nims.index]
465 l = len(self.scan_satselection)
466 if l and l > self.scan_nims.index:
467 selsatidx=self.scan_satselection[self.scan_nims.index].index
469 if l and l > selsatidx:
470 orbpos=nimsats[selsatidx][0]
471 if self.scan_sat.system.value == "dvb-s":
472 fec = self.scan_sat.fec.value
474 fec = self.scan_sat.fec_s2.value
475 self.addSatTransponder(tlist, self.scan_sat.frequency.value,
476 self.scan_sat.symbolrate.value,
477 self.scan_sat.polarization.index,
479 self.scan_sat.inversion.index,
481 self.scan_sat.system.index,
482 self.scan_sat.modulation.index)
483 elif self.scan_type.value == "single_satellite":
484 sat = self.satList[self.scan_nims.index][self.scan_satselection[self.scan_nims.index].index]
485 getInitialTransponderList(tlist, sat[0])
486 flags |= eComponentScan.scanNetworkSearch
487 tmp = self.scan_clearallservices.value
489 flags |= eComponentScan.scanRemoveServices
490 elif tmp == "yes_hold_feeds":
491 flags |= eComponentScan.scanRemoveServices
492 flags |= eComponentScan.scanDontRemoveFeeds
493 elif self.scan_type.value == "multisat":
494 SatList = nimmanager.getSatListForNim(self.scan_nims.index)
495 for x in self.multiscanlist:
497 print " " + str(x[0])
498 getInitialTransponderList(tlist, x[0])
499 flags |= eComponentScan.scanNetworkSearch
500 tmp = self.scan_clearallservices.value
502 flags |= eComponentScan.scanRemoveServices
503 elif tmp == "yes_hold_feeds":
504 flags |= eComponentScan.scanRemoveServices
505 flags |= eComponentScan.scanDontRemoveFeeds
507 elif (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]):
508 if self.scan_typecable.value == "single_transponder":
509 fec = self.scan_cab.fec.value
510 self.addCabTransponder(tlist, self.scan_cab.frequency.value,
511 self.scan_cab.symbolrate.value,
512 self.scan_cab.modulation.index + 1,
514 self.scan_cab.inversion.index)
515 if self.scan_cab.networkScan.value:
516 flags |= eComponentScan.scanNetworkSearch
517 elif self.scan_typecable.value == "complete":
518 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(self.scan_nims.index))
519 flags |= eComponentScan.scanNetworkSearch
520 tmp = self.scan_clearallservices
522 flags |= eComponentScan.scanRemoveServices
523 elif tmp == "yes_hold_feeds":
524 flags |= eComponentScan.scanRemoveServices
525 flags |= eComponentScan.scanDontRemoveFeeds
527 elif (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]):
528 if self.scan_typeterrestrial.value == "single_transponder":
529 self.addTerTransponder(tlist,
530 self.scan_ter.frequency.value * 1000000,
531 inversion = self.scan_ter.inversion.index,
532 bandwidth = self.scan_ter.bandwidth.index,
533 fechigh = self.scan_ter.fechigh.index,
534 feclow = self.scan_ter.feclow.index,
535 modulation = self.scan_ter.modulation.index,
536 transmission = self.scan_ter.transmission.index,
537 guard = self.scan_ter.guard.index,
538 hierarchy = self.scan_ter.hierarchy.index)
539 if self.scan_ter.networkScan.value:
540 flags |= eComponentScan.scanNetworkSearch
541 elif self.scan_typeterrestrial.value == "complete":
542 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(self.scan_nims.index))
543 flags |= eComponentScan.scanNetworkSearch
544 tmp = self.scan_clearallservices.value
546 flags |= eComponentScan.scanRemoveServices
547 elif tmp == "yes_hold_feeds":
548 flags |= eComponentScan.scanRemoveServices
549 flags |= eComponentScan.scanDontRemoveFeeds
551 for x in self["config"].list:
555 feid = self.scan_nims.index
556 # flags |= eComponentScan.scanSearchBAT
557 self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
559 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
565 for x in self["config"].list:
569 class ScanSimple(ConfigListScreen, Screen):
570 def __init__(self, session):
571 Screen.__init__(self, session)
573 self["actions"] = ActionMap(["SetupActions"],
576 "cancel": self.keyCancel,
582 nimcount = nimmanager.getNimSocketCount()
584 nimtype = nimmanager.getNimType(0)
586 self.scan_clearallservices = ConfigSelection(default = "yes", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
587 self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
588 nim = ConfigYesNo(default = True)
590 if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
592 if nimtype == nimmanager.nimType["empty/unknown"]:
593 scan_possible = False
595 self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
597 if nimcount > 1 and self.ScanNimTwoNeeded():
598 nim = ConfigYesNo(default = True)
600 self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
602 ConfigListScreen.__init__(self, self.list)
603 self["header"] = Label(_("Automatic Scan"))
604 self["footer"] = Label(_("Press OK to scan"))
611 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"] and nimmanager.getNimType(0) == nimmanager.getNimType(1):
612 sec = eDVBSatelliteEquipmentControl.getInstance()
614 exclusive_satellites = sec.get_exclusive_satellites(0,1)
616 exclusive_satellites = [0,0]
617 print "exclusive satellites", exclusive_satellites
618 two_sat_tuners = True
620 two_sat_tuners = False
622 for (x, c) in self.list[1:]:
624 print "Scan Tuner", slotid, "-", c.value
629 if nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-S"]:
633 idx = exclusive_satellites[0]+1
636 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
637 print "exclusive_nim_sats", exclusive_nim_sats
638 SatList = nimmanager.getSatListForNim(slotid)
640 if not two_sat_tuners or (sat[0] in exclusive_nim_sats or slotid == 0):
643 getInitialTransponderList(tlist, sat[0])
644 elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-C"]:
646 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
647 if nimmanager.getCableTrustNit(slotid):
649 elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-T"]:
651 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
656 flags=eComponentScan.scanNetworkSearch
658 flags |= eComponentScan.clearToScanOnFirstNIT
659 tmp = self.scan_clearallservices.value
661 flags |= eComponentScan.scanRemoveServices
662 elif tmp == "yes_hold_feeds":
663 flags |= eComponentScan.scanRemoveServices
664 flags |= eComponentScan.scanDontRemoveFeeds
665 scanList.append({"transponders": tlist, "feid": slotid, "flags": flags})
667 self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
669 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
677 def Satexists(self, tlist, pos):
683 def ScanNimTwoNeeded(self):
684 if nimmanager.getNimType(1) == nimmanager.nimType["empty/unknown"]:
686 if nimmanager.getNimType(0) != nimmanager.getNimType(1):
688 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"]: #two dvb-s nims
689 if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
691 sec = eDVBSatelliteEquipmentControl.getInstance()
693 exclusive_satellites = sec.get_exclusive_satellites(0,1)
694 if len(exclusive_satellites) == 2:
696 idx = exclusive_satellites[0]+1
697 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
698 if len(exclusive_nim_sats):
700 return False # two -C or two -T tuners