1 from config import config #global config instance
3 from config import configElement
4 from config import ConfigSubsection
5 from config import ConfigSlider
6 from config import configSelection
7 from config import currentConfigSelectionElement
8 from config import getConfigSelectionElement
9 from config import configSequence
10 from config import configsequencearg
11 from config import configSatlist
13 from enigma import eDVBSatelliteEquipmentControl, \
14 eDVBSatelliteLNBParameters as lnbParam, \
15 eDVBSatelliteDiseqcParameters as diseqcParam, \
16 eDVBSatelliteSwitchParameters as switchParam, \
17 eDVBSatelliteRotorParameters as rotorParam
19 import xml.dom.minidom
20 from xml.dom import EMPTY_NAMESPACE
21 from skin import elementsWithTag
22 from Tools import XMLTools
24 from xml.sax import make_parser
25 from xml.sax.handler import ContentHandler
27 from Tools.BoundFunction import boundFunction
29 def tryOpen(filename):
31 procFile = open(filename)
37 def addLNBSimple(self, sec, slotid, diseqcmode, toneburstmode = 0, diseqcpos = 0, orbpos = 0, longitude = 0, latitude = 0, loDirection = 0, laDirection = 0):
40 tunermask = 1 << slotid
41 if self.linked.has_key(slotid):
42 tunermask |= (1 << self.linked[slotid])
43 sec.setLNBTunerMask(tunermask)
44 sec.setLNBLOFL(9750000)
45 sec.setLNBLOFH(10600000)
46 sec.setLNBThreshold(11750000)
50 sec.setVoltageMode(switchParam.HV)
51 sec.setToneMode(switchParam.HILO)
52 sec.setCommandOrder(0)
54 sec.setDiSEqCMode(diseqcmode)
55 sec.setToneburst(toneburstmode)
56 sec.setCommittedCommand(diseqcpos)
57 #print "set orbpos to:" + str(orbpos)
59 if (0 <= diseqcmode < 3):
60 sec.addSatellite(orbpos)
61 self.satList.append(orbpos)
62 elif (diseqcmode == 3): # diseqc 1.2
63 sec.setLatitude(latitude)
64 sec.setLaDirection(laDirection)
65 sec.setLongitude(longitude)
66 sec.setLoDirection(loDirection)
67 sec.setUseInputpower(True)
68 sec.setInputpowerDelta(50)
70 for x in self.NimManager.satList:
71 print "Add sat " + str(x[1])
72 sec.addSatellite(int(x[1]))
75 self.satList.append(int(x[1]))
77 def linkNIMs(self, sec, nim1, nim2):
78 print "link", nim1, "to", nim2
79 sec.setTunerLinked(nim1, nim2)
85 sec = eDVBSatelliteEquipmentControl.getInstance()
90 for slot in self.NimManager.nimslots:
93 if slot.nimType == self.NimManager.nimType["DVB-S"]:
94 if currentConfigSelectionElement(nim.configMode) == "loopthrough":
95 self.linkNIMs(sec, x, nim.linkedTo.value)
96 self.linked[nim.linkedTo.value]=x
98 for slot in self.NimManager.nimslots:
101 if slot.nimType == self.NimManager.nimType["DVB-S"]:
102 print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
103 if currentConfigSelectionElement(nim.configMode) == "loopthrough":
105 elif currentConfigSelectionElement(nim.configMode) == "simple": #simple config
106 if currentConfigSelectionElement(nim.diseqcMode) == "single": #single
107 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
108 elif currentConfigSelectionElement(nim.diseqcMode) == "toneburst_a_b": #Toneburst A/B
109 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
110 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
111 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b": #DiSEqC A/B
112 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
113 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
114 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b_c_d": #DiSEqC A/B/C/D
115 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
116 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
117 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA)
118 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB)
119 elif currentConfigSelectionElement(nim.diseqcMode) == "positioner": #Positioner
120 if currentConfigSelectionElement(nim.latitudeOrientation) == "north":
121 laValue = rotorParam.NORTH
123 laValue = rotorParam.SOUTH
124 if currentConfigSelectionElement(nim.longitudeOrientation) == "east":
125 loValue = rotorParam.EAST
127 loValue = rotorParam.WEST
128 self.addLNBSimple(sec, slotid = x, diseqcmode = 3,
129 longitude = float(str(nim.longitude.value[0]) + "." + str(nim.longitude.value[1])),
130 loDirection = loValue,
131 latitude = float(str(nim.latitude.value[0]) + "." + str(nim.latitude.value[1])),
132 laDirection = laValue)
134 elif currentConfigSelectionElement(nim.configMode) == "nothing":
136 else: #advanced config
137 self.updateAdvanced(sec, x)
139 def updateAdvanced(self, sec, slotid):
141 for x in range(1,33):
143 for x in self.NimManager.satList:
144 lnb = config.Nims[slotid].advanced.sat[x[1]].lnb.value
146 print "add", x[1], "to", lnb
147 lnbSat[lnb].append(x[1])
148 for x in range(1,33):
149 if len(lnbSat[x]) > 0:
150 currLnb = config.Nims[slotid].advanced.lnb[x]
153 tunermask = 1 << slotid
154 if self.linked.has_key(slotid):
155 tunermask |= (1 << self.linked[slotid])
156 sec.setLNBTunerMask(tunermask)
158 if currentConfigSelectionElement(currLnb.lof) == "universal_lnb":
159 sec.setLNBLOFL(9750000)
160 sec.setLNBLOFH(10600000)
161 sec.setLNBThreshold(11750000)
162 elif currentConfigSelectionElement(currLnb.lof) == "c_band":
163 sec.setLNBLOFL(5150000)
164 sec.setLNBLOFH(5150000)
165 sec.setLNBThreshold(5150000)
166 elif currentConfigSelectionElement(currLnb.lof) == "user_defined":
167 sec.setLNBLOFL(currLnb.lofl.value[0] * 1000)
168 sec.setLNBLOFH(currLnb.lofh.value[0] * 1000)
169 sec.setLNBThreshold(currLnb.threshold.value[0] * 1000)
171 if currentConfigSelectionElement(currLnb.output_12v) == "0V":
172 pass # nyi in drivers
173 elif currentConfigSelectionElement(currLnb.output_12v) == "12V":
174 pass # nyi in drivers
176 if currentConfigSelectionElement(currLnb.increased_voltage) == "yes":
177 sec.setLNBIncreasedVoltage(lnbParam.ON)
179 sec.setLNBIncreasedVoltage(lnbParam.OFF)
181 if currentConfigSelectionElement(currLnb.diseqcMode) == "none":
182 sec.setDiSEqCMode(diseqcParam.NONE)
183 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
184 sec.setDiSEqCMode(diseqcParam.V1_0)
185 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_1":
186 sec.setDiSEqCMode(diseqcParam.V1_1)
187 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
188 sec.setDiSEqCMode(diseqcParam.V1_2)
190 if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
191 if currentConfigSelectionElement(currLnb.toneburst) == "none":
192 sec.setToneburst(diseqcParam.NO)
193 elif currentConfigSelectionElement(currLnb.toneburst) == "A":
194 sec.setToneburst(diseqcParam.A)
195 elif currentConfigSelectionElement(currLnb.toneburst) == "B":
196 sec.setToneburst(diseqcParam.B)
198 if currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "none":
199 sec.setCommittedCommand(diseqcParam.SENDNO)
200 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AA":
201 sec.setCommittedCommand(diseqcParam.AA)
202 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AB":
203 sec.setCommittedCommand(diseqcParam.AB)
204 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BA":
205 sec.setCommittedCommand(diseqcParam.BA)
206 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BB":
207 sec.setCommittedCommand(diseqcParam.BB)
209 if currentConfigSelectionElement(currLnb.fastDiseqc) == "yes":
210 sec.setFastDiSEqC(True)
212 sec.setFastDiSEqC(False)
214 if currentConfigSelectionElement(currLnb.sequenceRepeat) == "yes":
215 sec.setSeqRepeat(True)
217 sec.setSeqRepeat(False)
219 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
220 currCO = currLnb.commandOrder1_0.value
222 currCO = currLnb.commandOrder.value
224 if currLnb.uncommittedDiseqcCommand.value > 0:
225 sec.setUncommittedCommand(0xF0|(currLnb.uncommittedDiseqcCommand.value-1))
227 sec.setUncommittedCommand(0) # SENDNO
229 if currentConfigSelectionElement(currLnb.diseqcRepeats) == "none":
231 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "One":
233 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Two":
235 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Three":
238 setCommandOrder=False
239 if currCO == 0: # committed, toneburst
241 elif currCO == 1: # toneburst, committed
243 elif currCO == 2: # committed, uncommitted, toneburst
245 elif currCO == 3: # toneburst, committed, uncommitted
247 elif currCO == 4: # uncommitted, committed, toneburst
249 elif currCO == 5: # toneburst, uncommitted, commmitted
252 sec.setCommandOrder(currCO)
254 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
255 sec.setLatitude(float(str(currLnb.latitude.value[0]) + "." + str(currLnb.latitude.value[1])))
256 sec.setLongitude(float(str(currLnb.longitude.value[0]) + "." + str(currLnb.longitude.value[1])))
257 if currentConfigSelectionElement(currLnb.latitudeOrientation) == "north":
258 sec.setLaDirection(rotorParam.NORTH)
260 sec.setLaDirection(rotorParam.SOUTH)
261 if currentConfigSelectionElement(currLnb.longitudeOrientation) == "east":
262 sec.setLoDirection(rotorParam.EAST)
264 sec.setLoDirection(rotorParam.WEST)
266 if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
267 sec.setUseInputpower(True)
268 sec.setInputpowerDelta(currLnb.powerThreshold.value[0])
270 sec.setUseInputpower(False)
272 # finally add the orbital positions
275 currSat = config.Nims[slotid].advanced.sat[y]
276 if currentConfigSelectionElement(currSat.voltage) == "polarization":
277 sec.setVoltageMode(switchParam.HV)
278 elif currentConfigSelectionElement(currSat.voltage) == "13V":
279 sec.setVoltageMode(switchParam._14V)
280 elif currentConfigSelectionElement(currSat.voltage) == "18V":
281 sec.setVoltageMode(switchParam._18V)
283 if currentConfigSelectionElement(currSat.tonemode) == "band":
284 sec.setToneMode(switchParam.HILO)
285 elif currentConfigSelectionElement(currSat.tonemode) == "on":
286 sec.setToneMode(switchParam.ON)
287 elif currentConfigSelectionElement(currSat.tonemode) == "off":
288 sec.setToneMode(switchParam.OFF)
290 if currentConfigSelectionElement(currSat.usals) == "no":
291 sec.setRotorPosNum(currSat.rotorposition.value)
293 sec.setRotorPosNum(0) #USALS
295 def __init__(self, nimmgr):
296 self.NimManager = nimmgr
300 def __init__(self, slotid, nimtype, name):
302 self.nimType = nimtype
306 class parseSats(ContentHandler):
307 def __init__(self, satList, satellites, transponders):
308 self.isPointsElement, self.isReboundsElement = 0, 0
309 self.satList = satList
310 self.satellites = satellites
311 self.transponders = transponders
313 def startElement(self, name, attrs):
315 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
316 tpos = int(attrs.get('position',""))
319 tname = attrs.get('name',"")
320 self.satellites[tpos] = tname
321 self.satList.append( (tname, tpos) )
322 self.parsedSat = int(tpos)
323 elif (name == "transponder"):
324 freq = int(attrs.get('frequency',""))
325 sr = int(attrs.get('symbol_rate',""))
326 pol = int(attrs.get('polarization',""))
327 fec = int(attrs.get('fec_inner',""))
328 if self.parsedSat in self.transponders:
331 self.transponders[self.parsedSat] = [ ]
333 self.transponders[self.parsedSat].append((0, freq, sr, pol, fec))
335 class parseCables(ContentHandler):
336 def __init__(self, cablesList, transponders):
337 self.isPointsElement, self.isReboundsElement = 0, 0
338 self.cablesList = cablesList
339 self.transponders = transponders
341 def startElement(self, name, attrs):
342 if (name == "cable"):
343 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
344 tname = attrs.get('name',"")
345 self.cablesList.append(str(tname))
346 self.parsedCab = str(tname)
347 elif (name == "transponder"):
348 freq = int(attrs.get('frequency',""))
349 sr = int(attrs.get('symbol_rate',""))
350 mod = int(attrs.get('modulation',""))
351 fec = int(attrs.get('fec_inner',""))
352 if self.parsedCab in self.transponders:
355 self.transponders[self.parsedCab] = [ ]
357 self.transponders[self.parsedCab].append((1, freq, sr, mod, fec))
359 class parseTerrestrials(ContentHandler):
360 def __init__(self, terrestrialsList, transponders):
361 self.isPointsElement, self.isReboundsElement = 0, 0
362 self.terrestrialsList = terrestrialsList
363 self.transponders = transponders
365 def startElement(self, name, attrs):
366 if (name == "terrestrial"):
367 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
368 tname = attrs.get('name',"")
369 tflags = attrs.get('flags',"")
370 self.terrestrialsList.append((tname, tflags))
371 self.parsedTer = str(tname)
372 elif (name == "transponder"):
374 freq = int(attrs.get('centre_frequency',""))
375 bw = int(attrs.get('bandwidth',""))
376 const = int(attrs.get('constellation',""))
377 crh = int(attrs.get('code_rate_hp',""))
378 crl = int(attrs.get('code_rate_lp',""))
379 guard = int(attrs.get('guard_interval',""))
380 transm = int(attrs.get('transmission_mode',""))
381 hierarchy = int(attrs.get('hierarchy_information',""))
382 inv = int(attrs.get('inversion',""))
383 if self.parsedTer in self.transponders:
386 self.transponders[self.parsedTer] = [ ]
388 self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
390 def getTransponders(self, pos):
391 return self.transponders[pos]
393 def getConfiguredSats(self):
394 return self.sec.getSatList()
396 def getSatDescription(self, pos):
397 return self.satellites[pos]
399 def readSatsfromFile(self):
400 self.satellites = { }
401 self.transponders = { }
402 self.transponderscable = { }
403 self.transpondersterrestrial = { }
405 parser = make_parser()
406 if (self.hasNimType(self.nimType["DVB-S"])):
407 print "Reading satellites.xml"
408 satHandler = self.parseSats(self.satList, self.satellites, self.transponders)
409 parser.setContentHandler(satHandler)
410 parser.parse('/etc/tuxbox/satellites.xml')
411 if (self.hasNimType(self.nimType["DVB-C"])):
412 print "Reading cables.xml"
413 cabHandler = self.parseCables(self.cablesList, self.transponderscable)
414 parser.setContentHandler(cabHandler)
415 parser.parse('/etc/tuxbox/cables.xml')
417 if (self.hasNimType(self.nimType["DVB-T"])):
418 print "Reading terrestrial.xml"
419 terHandler = self.parseTerrestrials(self.terrestrialsList, self.transpondersterrestrial)
420 parser.setContentHandler(terHandler)
421 parser.parse('/etc/tuxbox/terrestrial.xml')
426 self.nimSocketCount = 0
427 nimfile = tryOpen("/proc/bus/nim_sockets")
430 return self.nimType["empty/unknown"]
435 line = nimfile.readline()
438 if line.strip().startswith("NIM Socket"):
439 parts = line.strip().split(" ")
440 id = int(parts[2][:1])
442 self.nimSocketCount += 1
443 elif line.strip().startswith("Type:"):
444 self.nimTypes[lastsocket] = str(line.strip()[6:])
445 elif line.strip().startswith("Name:"):
446 self.nimNames[lastsocket] = str(line.strip()[6:])
447 elif line.strip().startswith("empty"):
448 self.nimNames[lastsocket] = _("N/A")
449 self.nimTypes[lastsocket] = "empty/unknown"
453 def getNimType(self, slotID):
454 if slotID >= self.nimCount:
455 return "empty/unknown"
457 return self.nimType[self.nimTypes[slotID]]
459 def getNimName(self, slotID):
460 return self.nimNames[slotID]
462 def getNimSocketCount(self):
463 return self.nimSocketCount
465 def hasNimType(self, chktype):
466 for id, type in self.nimTypes.items():
467 if (chktype == self.nimType[str(type)]):
471 def getNimListOfType(self, type, exception = -1):
473 for x in self.nimslots:
474 if ((x.nimType == type) and (x.slotid != exception)):
475 list.append(x.slotid)
478 def getConfigPrefix(self, slotid):
479 return "config.Nim" + ("A","B","C","D")[slotid] + "."
483 self.nimType = { "empty/unknown": -1,
489 self.terrestrialsList = []
493 self.readSatsfromFile()
495 self.nimCount = self.getNimSocketCount()
499 while x < self.nimCount:
500 tType = self.getNimType(x)
501 tName = self.getNimName(x)
502 tNim = nimSlot(x, tType, tName)
503 self.nimslots.append(tNim)
506 InitNimManager(self) #init config stuff
510 for slot in self.nimslots:
511 nimText = _("Socket ") + ("A", "B", "C", "D")[slot.slotid] + ": "
512 if slot.nimType == -1:
513 nimText += _("empty/unknown")
515 nimText += slot.name + " ("
516 nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
517 list.append((nimText, slot))
520 def getSatListForNim(self, slotid):
522 if (self.getNimType(slotid) != self.nimType["empty/unknown"]):
523 #print "slotid:", slotid
525 #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
526 #print "diseqcA:", config.Nims[slotid].diseqcA.value
527 if (config.Nims[slotid].diseqcMode.value <= 3):
528 list.append(self.satList[config.Nims[slotid].diseqcA.value])
529 if (0 < config.Nims[slotid].diseqcMode.value <= 3):
530 list.append(self.satList[config.Nims[slotid].diseqcB.value])
531 if (config.Nims[slotid].diseqcMode.value == 3):
532 list.append(self.satList[config.Nims[slotid].diseqcC.value])
533 list.append(self.satList[config.Nims[slotid].diseqcD.value])
534 if (config.Nims[slotid].diseqcMode.value == 4):
535 for x in self.satList:
539 #callbacks for c++ config
540 def nimConfigModeChanged(self, slotid, mode):
541 if (mode != 2): # not linked
542 print "Unlinking slot " + str(slotid)
543 # TODO call c++ to unlink nim in slot slotid
544 if (mode == 2): # linked
547 #if (len(self.getNimListOfType(self.nimType["DVB-S"], slotid)) > 0):
548 # print "Linking slot " + str(slotid) + " to " + str(nimmgr.getConfigPrefix(slotid).value)
549 # TODO call c++ to link nim in slot slotid with nim in slot nimmgr.getConfigPrefix(slotid).value
550 def nimLinkedToChanged(self, slotid, val):
551 print "Linking slot " + str(slotid) + " to " + str(val)
553 def nimDiseqcModeChanged(self, slotid, mode):
554 #print "nimDiseqcModeChanged set to " + str(mode)
556 def nimPortAChanged(self, slotid, val):
557 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
559 def nimPortBChanged(self, slotid, val):
560 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
561 #print "nimDiseqcB set to " + str(val)
563 def nimPortCChanged(self, slotid, val):
564 #print "nimDiseqcC set to " + str(val)
566 def nimPortDChanged(self, slotid, val):
567 #print "nimDiseqcD set to " + str(val)
570 def InitNimManager(nimmgr):
572 for x in range(nimmgr.nimCount):
573 config.Nims.append(ConfigSubsection())
575 def nimConfigModeChanged(slotid, configElement):
576 nimmgr.nimConfigModeChanged(slotid, configElement.value)
577 def nimLinkedToChanged(slotid, configElement):
578 nimmgr.nimLinkedToChanged(slotid, configElement.value)
579 def nimDiseqcModeChanged(slotid, configElement):
580 nimmgr.nimDiseqcModeChanged(slotid, configElement.value)
582 def nimPortAChanged(slotid, configElement):
583 nimmgr.nimPortAChanged(slotid, configElement.vals[configElement.value][1])
584 def nimPortBChanged(slotid, configElement):
585 nimmgr.nimPortBChanged(slotid, configElement.vals[configElement.value][1])
586 def nimPortCChanged(slotid, configElement):
587 nimmgr.nimPortCChanged(slotid, configElement.vals[configElement.value][1])
588 def nimPortDChanged(slotid, configElement):
589 nimmgr.nimPortDChanged(slotid, configElement.vals[configElement.value][1])
591 for slot in nimmgr.nimslots:
593 cname = nimmgr.getConfigPrefix(x)
596 if slot.nimType == nimmgr.nimType["DVB-S"]:
598 nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("advanced", _("Advanced"))))
600 nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("nothing", _("Nothing connected")), ("loopthrough", _("Loopthrough to Socket A")), ("advanced", _("Advanced"))))
602 #important - check if just the 2nd one is LT only and the first one is DVB-S
603 if currentConfigSelectionElement(nim.configMode) == "loopthrough": #linked
604 if x == 0: #first one can never be linked to anything
605 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
606 nim.configMode.save()
608 #FIXME: make it better
609 for y in nimmgr.nimslots:
611 if y.nimType != nimmgr.nimType["DVB-S"]:
612 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
613 nim.configMode.save()
615 nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (("single", _("Single")), ("toneburst_a_b", _("Toneburst A/B")), ("diseqc_a_b", _("DiSEqC A/B")), ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")), ("positioner", _("Positioner"))));
616 nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList);
617 nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList);
618 nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList);
619 nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList);
620 nim.positionerMode = configElement(cname + "positionerMode", configSelection, 0, (("usals", _("USALS")), ("manual", _("manual"))));
621 nim.longitude = configElement(cname + "longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
622 nim.longitudeOrientation = configElement(cname + "longitudeOrientation", configSelection, 0, (("east",_("East")), ("west", _("West"))))
623 nim.latitude = configElement(cname + "latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
624 nim.latitudeOrientation = configElement(cname + "latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))))
625 satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid)
628 satNimListNames.append((("Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)), _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)))
629 nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames);
631 #perhaps the instance of the slot is more useful?
632 nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
633 nim.diseqcMode.addNotifier(boundFunction(nimDiseqcModeChanged,x))
634 nim.diseqcA.addNotifier(boundFunction(nimPortAChanged,int(x)))
635 nim.diseqcB.addNotifier(boundFunction(nimPortBChanged,x))
636 nim.diseqcC.addNotifier(boundFunction(nimPortCChanged,x))
637 nim.diseqcD.addNotifier(boundFunction(nimPortDChanged,x))
638 nim.linkedTo.addNotifier(boundFunction(nimLinkedToChanged,x))
641 nim.advanced = ConfigSubsection()
642 nim.advanced.sats = configElement(cname + "advanced.sats", configSatlist, 192, nimmgr.satList);
643 nim.advanced.sat = {}
644 lnbs = ["not available"]
645 for y in range(1, 33):
646 lnbs.append("LNB " + str(y))
647 for x in nimmgr.satList:
648 nim.advanced.sat[x[1]] = ConfigSubsection()
649 nim.advanced.sat[x[1]].voltage = configElement(cname + "advanced.sat" + str(x[1]) + ".voltage", configSelection, 0, (("polarization", _("Polarization")), ("13V", _("13 V")), ("18V", _("18 V"))))
650 nim.advanced.sat[x[1]].tonemode = configElement(cname + "advanced.sat" + str(x[1]) + ".tonemode", configSelection, 0, (("band", _("Band")), ("on", _("On")), ("off", _("Off"))))
651 nim.advanced.sat[x[1]].usals = configElement(cname + "advanced.sat" + str(x[1]) + ".usals", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))))
652 nim.advanced.sat[x[1]].rotorposition = configElement(cname + "advanced.sat" + str(x[1]) + ".rotorposition", configSequence, [1], configsequencearg.get("INTEGER", (1, 255)))
653 nim.advanced.sat[x[1]].lnb = configElement(cname + "advanced.sat" + str(x[1]) + ".lnb", configSelection, 0, lnbs)
655 nim.advanced.lnb = [0]
656 for x in range(1, 33):
657 nim.advanced.lnb.append(ConfigSubsection())
658 nim.advanced.lnb[x].lof = configElement(cname + "advanced.lnb" + str(x) + ".lof", configSelection, 0, (("universal_lnb", _("Universal LNB")), ("c_band", _("C-Band")), ("user_defined", _("User defined"))))
659 nim.advanced.lnb[x].lofl = configElement(cname + "advanced.lnb" + str(x) + ".lofl", configSequence, [9750], configsequencearg.get("INTEGER", (0, 99999)))
660 nim.advanced.lnb[x].lofh = configElement(cname + "advanced.lnb" + str(x) + ".lofh", configSequence, [10600], configsequencearg.get("INTEGER", (0, 99999)))
661 nim.advanced.lnb[x].threshold = configElement(cname + "advanced.lnb" + str(x) + ".threshold", configSequence, [11750], configsequencearg.get("INTEGER", (0, 99999)))
662 nim.advanced.lnb[x].output_12v = configElement(cname + "advanced.lnb" + str(x) + ".output_12v", configSelection, 0, (("0V", _("0 V")), ("12V", _("12 V"))))
663 nim.advanced.lnb[x].increased_voltage = configElement(cname + "advanced.lnb" + str(x) + ".increased_voltage", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
664 nim.advanced.lnb[x].toneburst = configElement(cname + "advanced.lnb" + str(x) + ".toneburst", configSelection, 0, (("none", _("None")), ("A", _("A")), ("B", _("B"))))
665 nim.advanced.lnb[x].diseqcMode = configElement(cname + "advanced.lnb" + str(x) + ".diseqcMode", configSelection, 0, (("none", _("None")), ("1_0", _("1.0")), ("1_1", _("1.1")), ("1_2", _("1.2"))))
666 nim.advanced.lnb[x].commitedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".commitedDiseqcCommand", configSelection, 0, (("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))))
667 nim.advanced.lnb[x].fastDiseqc = configElement(cname + "advanced.lnb" + str(x) + ".fastDiseqc", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
668 nim.advanced.lnb[x].sequenceRepeat = configElement(cname + "advanced.lnb" + str(x) + ".sequenceRepeat", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
669 nim.advanced.lnb[x].commandOrder1_0 = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder1_0", configSelection, 0, ("committed, toneburst", "toneburst, committed"))
670 nim.advanced.lnb[x].commandOrder = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder", configSelection, 0, ("committed, toneburst", "toneburst, committed", "committed, uncommitted, toneburst", "toneburst, committed, uncommitted", "uncommitted, committed, toneburst", "toneburst, uncommitted, commmitted"))
672 for y in range(1, 17):
673 disCmd.append("Input " + str(y))
674 nim.advanced.lnb[x].uncommittedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".uncommittedDiseqcCommand", configSelection, 0, disCmd)
675 nim.advanced.lnb[x].diseqcRepeats = configElement(cname + "advanced.lnb" + str(x) + ".diseqcRepeats", configSelection, 0, (("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))))
676 nim.advanced.lnb[x].longitude = configElement(cname + "advanced.lnb" + str(x) + ".longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
677 nim.advanced.lnb[x].longitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".longitudeOrientation", configSelection, 0, (_("East"), _("West")))
678 nim.advanced.lnb[x].latitude = configElement(cname + "advanced.lnb" + str(x) + ".latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
679 nim.advanced.lnb[x].latitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))))
680 nim.advanced.lnb[x].powerMeasurement = configElement(cname + "advanced.lnb" + str(x) + ".powerMeasurement", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))))
681 nim.advanced.lnb[x].powerThreshold = configElement(cname + "advanced.lnb" + str(x) + ".powerThreshold", configSequence, [50], configsequencearg.get("INTEGER", (0, 100)))
682 elif slot.nimType == nimmgr.nimType["DVB-C"]:
683 nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList);
684 elif slot.nimType == nimmgr.nimType["DVB-T"]:
685 nim.cable = configElement(cname + "terrestrial", configSelection, 0, nimmgr.terrestrialsList);
687 print "pls add support for this frontend type!"
689 nimmgr.sec = SecConfigure(nimmgr)
691 nimmanager = NimManager()