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 tuner", nim1, "to tuner", nim2
79 sec.setTunerLinked(nim1, nim2)
85 sec = eDVBSatelliteEquipmentControl.getInstance()
86 sec.clear() ## this do unlinking NIMs too !!
87 print "sec config cleared"
91 for slot in self.NimManager.nimslots:
94 if slot.nimType == self.NimManager.nimType["DVB-S"]:
95 if currentConfigSelectionElement(nim.configMode) == "loopthrough":
96 self.linkNIMs(sec, x, nim.linkedTo.value)
97 self.linked[nim.linkedTo.value]=x
99 for slot in self.NimManager.nimslots:
102 if slot.nimType == self.NimManager.nimType["DVB-S"]:
103 print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
104 if currentConfigSelectionElement(nim.configMode) == "loopthrough":
106 elif currentConfigSelectionElement(nim.configMode) == "simple": #simple config
107 if currentConfigSelectionElement(nim.diseqcMode) == "single": #single
108 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
109 elif currentConfigSelectionElement(nim.diseqcMode) == "toneburst_a_b": #Toneburst A/B
110 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
111 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
112 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b": #DiSEqC A/B
113 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
114 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
115 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b_c_d": #DiSEqC A/B/C/D
116 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
117 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
118 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA)
119 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB)
120 elif currentConfigSelectionElement(nim.diseqcMode) == "positioner": #Positioner
121 if currentConfigSelectionElement(nim.latitudeOrientation) == "north":
122 laValue = rotorParam.NORTH
124 laValue = rotorParam.SOUTH
125 if currentConfigSelectionElement(nim.longitudeOrientation) == "east":
126 loValue = rotorParam.EAST
128 loValue = rotorParam.WEST
129 self.addLNBSimple(sec, slotid = x, diseqcmode = 3,
130 longitude = configsequencearg.getFloat(nim.longitude),
131 loDirection = loValue,
132 latitude = configsequencearg.getFloat(nim.latitude),
133 laDirection = laValue)
135 elif currentConfigSelectionElement(nim.configMode) == "nothing":
137 else: #advanced config
138 self.updateAdvanced(sec, x)
139 print "sec config completed"
141 def updateAdvanced(self, sec, slotid):
143 for x in range(1,33):
145 for x in self.NimManager.satList:
146 lnb = config.Nims[slotid].advanced.sat[x[1]].lnb.value
148 print "add", x[1], "to", lnb
149 lnbSat[lnb].append(x[1])
150 for x in range(1,33):
151 if len(lnbSat[x]) > 0:
152 currLnb = config.Nims[slotid].advanced.lnb[x]
155 tunermask = 1 << slotid
156 if self.linked.has_key(slotid):
157 tunermask |= (1 << self.linked[slotid])
158 sec.setLNBTunerMask(tunermask)
160 if currentConfigSelectionElement(currLnb.lof) == "universal_lnb":
161 sec.setLNBLOFL(9750000)
162 sec.setLNBLOFH(10600000)
163 sec.setLNBThreshold(11750000)
164 elif currentConfigSelectionElement(currLnb.lof) == "c_band":
165 sec.setLNBLOFL(5150000)
166 sec.setLNBLOFH(5150000)
167 sec.setLNBThreshold(5150000)
168 elif currentConfigSelectionElement(currLnb.lof) == "user_defined":
169 sec.setLNBLOFL(currLnb.lofl.value[0] * 1000)
170 sec.setLNBLOFH(currLnb.lofh.value[0] * 1000)
171 sec.setLNBThreshold(currLnb.threshold.value[0] * 1000)
173 if currentConfigSelectionElement(currLnb.output_12v) == "0V":
174 pass # nyi in drivers
175 elif currentConfigSelectionElement(currLnb.output_12v) == "12V":
176 pass # nyi in drivers
178 if currentConfigSelectionElement(currLnb.increased_voltage) == "yes":
179 sec.setLNBIncreasedVoltage(lnbParam.ON)
181 sec.setLNBIncreasedVoltage(lnbParam.OFF)
183 if currentConfigSelectionElement(currLnb.diseqcMode) == "none":
184 sec.setDiSEqCMode(diseqcParam.NONE)
185 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
186 sec.setDiSEqCMode(diseqcParam.V1_0)
187 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_1":
188 sec.setDiSEqCMode(diseqcParam.V1_1)
189 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
190 sec.setDiSEqCMode(diseqcParam.V1_2)
192 if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
193 if currentConfigSelectionElement(currLnb.toneburst) == "none":
194 sec.setToneburst(diseqcParam.NO)
195 elif currentConfigSelectionElement(currLnb.toneburst) == "A":
196 sec.setToneburst(diseqcParam.A)
197 elif currentConfigSelectionElement(currLnb.toneburst) == "B":
198 sec.setToneburst(diseqcParam.B)
200 if currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "none":
201 sec.setCommittedCommand(diseqcParam.SENDNO)
202 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AA":
203 sec.setCommittedCommand(diseqcParam.AA)
204 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AB":
205 sec.setCommittedCommand(diseqcParam.AB)
206 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BA":
207 sec.setCommittedCommand(diseqcParam.BA)
208 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BB":
209 sec.setCommittedCommand(diseqcParam.BB)
211 if currentConfigSelectionElement(currLnb.fastDiseqc) == "yes":
212 sec.setFastDiSEqC(True)
214 sec.setFastDiSEqC(False)
216 if currentConfigSelectionElement(currLnb.sequenceRepeat) == "yes":
217 sec.setSeqRepeat(True)
219 sec.setSeqRepeat(False)
221 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
222 currCO = currLnb.commandOrder1_0.value
224 currCO = currLnb.commandOrder.value
226 if currLnb.uncommittedDiseqcCommand.value > 0:
227 sec.setUncommittedCommand(0xF0|(currLnb.uncommittedDiseqcCommand.value-1))
229 sec.setUncommittedCommand(0) # SENDNO
231 if currentConfigSelectionElement(currLnb.diseqcRepeats) == "none":
233 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "One":
235 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Two":
237 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Three":
240 setCommandOrder=False
241 if currCO == 0: # committed, toneburst
243 elif currCO == 1: # toneburst, committed
245 elif currCO == 2: # committed, uncommitted, toneburst
247 elif currCO == 3: # toneburst, committed, uncommitted
249 elif currCO == 4: # uncommitted, committed, toneburst
251 elif currCO == 5: # toneburst, uncommitted, commmitted
254 sec.setCommandOrder(currCO)
256 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
257 latitude = configsequencearg.getFloat(currLnb.latitude)
258 sec.setLatitude(latitude)
259 longitude = configsequencearg.getFloat(currLnb.longitude)
260 sec.setLongitude(longitude)
261 if currentConfigSelectionElement(currLnb.latitudeOrientation) == "north":
262 sec.setLaDirection(rotorParam.NORTH)
264 sec.setLaDirection(rotorParam.SOUTH)
265 if currentConfigSelectionElement(currLnb.longitudeOrientation) == "east":
266 sec.setLoDirection(rotorParam.EAST)
268 sec.setLoDirection(rotorParam.WEST)
270 if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
271 sec.setUseInputpower(True)
272 sec.setInputpowerDelta(currLnb.powerThreshold.value[0])
274 sec.setUseInputpower(False)
276 # finally add the orbital positions
279 currSat = config.Nims[slotid].advanced.sat[y]
280 if currentConfigSelectionElement(currSat.voltage) == "polarization":
281 sec.setVoltageMode(switchParam.HV)
282 elif currentConfigSelectionElement(currSat.voltage) == "13V":
283 sec.setVoltageMode(switchParam._14V)
284 elif currentConfigSelectionElement(currSat.voltage) == "18V":
285 sec.setVoltageMode(switchParam._18V)
287 if currentConfigSelectionElement(currSat.tonemode) == "band":
288 sec.setToneMode(switchParam.HILO)
289 elif currentConfigSelectionElement(currSat.tonemode) == "on":
290 sec.setToneMode(switchParam.ON)
291 elif currentConfigSelectionElement(currSat.tonemode) == "off":
292 sec.setToneMode(switchParam.OFF)
294 if currentConfigSelectionElement(currSat.usals) == "no":
295 sec.setRotorPosNum(currSat.rotorposition.value[0])
297 sec.setRotorPosNum(0) #USALS
299 def __init__(self, nimmgr):
300 self.NimManager = nimmgr
304 def __init__(self, slotid, nimtype, name):
306 self.nimType = nimtype
310 class parseSats(ContentHandler):
311 def __init__(self, satList, satellites, transponders):
312 self.isPointsElement, self.isReboundsElement = 0, 0
313 self.satList = satList
314 self.satellites = satellites
315 self.transponders = transponders
317 def startElement(self, name, attrs):
319 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
320 tpos = int(attrs.get('position',""))
323 tname = attrs.get('name',"")
324 self.satellites[tpos] = tname
325 self.satList.append( (tname, tpos) )
326 self.parsedSat = int(tpos)
327 elif (name == "transponder"):
328 freq = int(attrs.get('frequency',""))
329 sr = int(attrs.get('symbol_rate',""))
330 pol = int(attrs.get('polarization',""))
331 fec = int(attrs.get('fec_inner',""))
332 if self.parsedSat in self.transponders:
335 self.transponders[self.parsedSat] = [ ]
337 self.transponders[self.parsedSat].append((0, freq, sr, pol, fec))
339 class parseCables(ContentHandler):
340 def __init__(self, cablesList, transponders):
341 self.isPointsElement, self.isReboundsElement = 0, 0
342 self.cablesList = cablesList
343 self.transponders = transponders
345 def startElement(self, name, attrs):
346 if (name == "cable"):
347 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
348 tname = attrs.get('name',"")
349 self.cablesList.append(str(tname))
350 self.parsedCab = str(tname)
351 elif (name == "transponder"):
352 freq = int(attrs.get('frequency',""))
353 sr = int(attrs.get('symbol_rate',""))
354 mod = int(attrs.get('modulation',""))
355 fec = int(attrs.get('fec_inner',""))
356 if self.parsedCab in self.transponders:
359 self.transponders[self.parsedCab] = [ ]
361 self.transponders[self.parsedCab].append((1, freq, sr, mod, fec))
363 class parseTerrestrials(ContentHandler):
364 def __init__(self, terrestrialsList, transponders):
365 self.isPointsElement, self.isReboundsElement = 0, 0
366 self.terrestrialsList = terrestrialsList
367 self.transponders = transponders
369 def startElement(self, name, attrs):
370 if (name == "terrestrial"):
371 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
372 tname = attrs.get('name',"")
373 tflags = attrs.get('flags',"")
374 self.terrestrialsList.append((tname, tflags))
375 self.parsedTer = str(tname)
376 elif (name == "transponder"):
378 freq = int(attrs.get('centre_frequency',""))
379 bw = int(attrs.get('bandwidth',""))
380 const = int(attrs.get('constellation',""))
381 crh = int(attrs.get('code_rate_hp',""))
382 crl = int(attrs.get('code_rate_lp',""))
383 guard = int(attrs.get('guard_interval',""))
384 transm = int(attrs.get('transmission_mode',""))
385 hierarchy = int(attrs.get('hierarchy_information',""))
386 inv = int(attrs.get('inversion',""))
387 if self.parsedTer in self.transponders:
390 self.transponders[self.parsedTer] = [ ]
392 self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
394 def getTransponders(self, pos):
395 return self.transponders[pos]
397 def getConfiguredSats(self):
398 return self.sec.getSatList()
400 def getSatDescription(self, pos):
401 return self.satellites[pos]
403 def readSatsfromFile(self):
404 self.satellites = { }
405 self.transponders = { }
406 self.transponderscable = { }
407 self.transpondersterrestrial = { }
409 parser = make_parser()
410 if (self.hasNimType(self.nimType["DVB-S"])):
411 print "Reading satellites.xml"
412 satHandler = self.parseSats(self.satList, self.satellites, self.transponders)
413 parser.setContentHandler(satHandler)
414 parser.parse('/etc/tuxbox/satellites.xml')
415 if (self.hasNimType(self.nimType["DVB-C"])):
416 print "Reading cables.xml"
417 cabHandler = self.parseCables(self.cablesList, self.transponderscable)
418 parser.setContentHandler(cabHandler)
419 parser.parse('/etc/tuxbox/cables.xml')
421 if (self.hasNimType(self.nimType["DVB-T"])):
422 print "Reading terrestrial.xml"
423 terHandler = self.parseTerrestrials(self.terrestrialsList, self.transpondersterrestrial)
424 parser.setContentHandler(terHandler)
425 parser.parse('/etc/tuxbox/terrestrial.xml')
430 self.nimSocketCount = 0
431 nimfile = tryOpen("/proc/bus/nim_sockets")
434 return self.nimType["empty/unknown"]
439 line = nimfile.readline()
442 if line.strip().startswith("NIM Socket"):
443 parts = line.strip().split(" ")
444 id = int(parts[2][:1])
446 self.nimSocketCount += 1
447 elif line.strip().startswith("Type:"):
448 self.nimTypes[lastsocket] = str(line.strip()[6:])
449 elif line.strip().startswith("Name:"):
450 self.nimNames[lastsocket] = str(line.strip()[6:])
451 elif line.strip().startswith("empty"):
452 self.nimNames[lastsocket] = _("N/A")
453 self.nimTypes[lastsocket] = "empty/unknown"
457 def getNimType(self, slotID):
458 if slotID >= self.nimCount:
459 return "empty/unknown"
461 return self.nimType[self.nimTypes[slotID]]
463 def getNimName(self, slotID):
464 return self.nimNames[slotID]
466 def getNimSocketCount(self):
467 return self.nimSocketCount
469 def hasNimType(self, chktype):
470 for id, type in self.nimTypes.items():
471 if (chktype == self.nimType[str(type)]):
475 def getNimListOfType(self, type, exception = -1):
477 for x in self.nimslots:
478 if ((x.nimType == type) and (x.slotid != exception)):
479 list.append(x.slotid)
482 def getConfigPrefix(self, slotid):
483 return "config.Nim" + ("A","B","C","D")[slotid] + "."
487 self.nimType = { "empty/unknown": -1,
493 self.terrestrialsList = []
497 self.readSatsfromFile()
499 self.nimCount = self.getNimSocketCount()
503 while x < self.nimCount:
504 tType = self.getNimType(x)
505 tName = self.getNimName(x)
506 tNim = nimSlot(x, tType, tName)
507 self.nimslots.append(tNim)
510 InitNimManager(self) #init config stuff
514 for slot in self.nimslots:
515 nimText = _("Socket ") + ("A", "B", "C", "D")[slot.slotid] + ": "
516 if slot.nimType == -1:
517 nimText += _("empty/unknown")
519 nimText += slot.name + " ("
520 nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
521 list.append((nimText, slot))
524 def getSatListForNim(self, slotid):
526 if (self.getNimType(slotid) != self.nimType["empty/unknown"]):
527 #print "slotid:", slotid
529 #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
530 #print "diseqcA:", config.Nims[slotid].diseqcA.value
531 if (config.Nims[slotid].diseqcMode.value <= 3):
532 list.append(self.satList[config.Nims[slotid].diseqcA.value])
533 if (0 < config.Nims[slotid].diseqcMode.value <= 3):
534 list.append(self.satList[config.Nims[slotid].diseqcB.value])
535 if (config.Nims[slotid].diseqcMode.value == 3):
536 list.append(self.satList[config.Nims[slotid].diseqcC.value])
537 list.append(self.satList[config.Nims[slotid].diseqcD.value])
538 if (config.Nims[slotid].diseqcMode.value == 4):
539 for x in self.satList:
543 # #callbacks for c++ config
544 # def nimConfigModeChanged(self, slotid, mode):
545 # if (mode != 2): # not linked
546 # print "Unlinking slot " + str(slotid)
547 # # TODO call c++ to unlink nim in slot slotid
548 # if (mode == 2): # linked
551 # #if (len(self.getNimListOfType(self.nimType["DVB-S"], slotid)) > 0):
552 # # print "Linking slot " + str(slotid) + " to " + str(nimmgr.getConfigPrefix(slotid).value)
553 # # TODO call c++ to link nim in slot slotid with nim in slot nimmgr.getConfigPrefix(slotid).value
555 # def nimLinkedToChanged(self, slotid, val):
556 # print "Linking slot " + str(slotid) + " to " + str(val)
558 def nimDiseqcModeChanged(self, slotid, mode):
559 #print "nimDiseqcModeChanged set to " + str(mode)
561 def nimPortAChanged(self, slotid, val):
562 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
564 def nimPortBChanged(self, slotid, val):
565 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
566 #print "nimDiseqcB set to " + str(val)
568 def nimPortCChanged(self, slotid, val):
569 #print "nimDiseqcC set to " + str(val)
571 def nimPortDChanged(self, slotid, val):
572 #print "nimDiseqcD set to " + str(val)
575 def InitNimManager(nimmgr):
577 for x in range(nimmgr.nimCount):
578 config.Nims.append(ConfigSubsection())
580 # def nimConfigModeChanged(slotid, configElement):
581 # nimmgr.nimConfigModeChanged(slotid, configElement.value)
582 # def nimLinkedToChanged(slotid, configElement):
583 # nimmgr.nimLinkedToChanged(slotid, configElement.value)
584 def nimDiseqcModeChanged(slotid, configElement):
585 nimmgr.nimDiseqcModeChanged(slotid, configElement.value)
587 def nimPortAChanged(slotid, configElement):
588 nimmgr.nimPortAChanged(slotid, configElement.vals[configElement.value][1])
589 def nimPortBChanged(slotid, configElement):
590 nimmgr.nimPortBChanged(slotid, configElement.vals[configElement.value][1])
591 def nimPortCChanged(slotid, configElement):
592 nimmgr.nimPortCChanged(slotid, configElement.vals[configElement.value][1])
593 def nimPortDChanged(slotid, configElement):
594 nimmgr.nimPortDChanged(slotid, configElement.vals[configElement.value][1])
596 for slot in nimmgr.nimslots:
598 cname = nimmgr.getConfigPrefix(x)
601 if slot.nimType == nimmgr.nimType["DVB-S"]:
603 nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("advanced", _("Advanced"))))
605 nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("nothing", _("Nothing connected")), ("loopthrough", _("Loopthrough to Socket A")), ("advanced", _("Advanced"))))
607 #important - check if just the 2nd one is LT only and the first one is DVB-S
608 if currentConfigSelectionElement(nim.configMode) == "loopthrough": #linked
609 if x == 0: #first one can never be linked to anything
610 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
611 nim.configMode.save()
613 #FIXME: make it better
614 for y in nimmgr.nimslots:
616 if y.nimType != nimmgr.nimType["DVB-S"]:
617 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
618 nim.configMode.save()
620 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"))));
621 nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList);
622 nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList);
623 nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList);
624 nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList);
625 nim.positionerMode = configElement(cname + "positionerMode", configSelection, 0, (("usals", _("USALS")), ("manual", _("manual"))));
626 nim.longitude = configElement(cname + "longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
627 nim.longitudeOrientation = configElement(cname + "longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))))
628 nim.latitude = configElement(cname + "latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]));
629 nim.latitudeOrientation = configElement(cname + "latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))))
630 satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid)
633 satNimListNames.append((("Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)), _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)))
634 nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames);
636 #perhaps the instance of the slot is more useful?
637 # nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
638 nim.diseqcMode.addNotifier(boundFunction(nimDiseqcModeChanged,x))
639 nim.diseqcA.addNotifier(boundFunction(nimPortAChanged,int(x)))
640 nim.diseqcB.addNotifier(boundFunction(nimPortBChanged,x))
641 nim.diseqcC.addNotifier(boundFunction(nimPortCChanged,x))
642 nim.diseqcD.addNotifier(boundFunction(nimPortDChanged,x))
643 # nim.linkedTo.addNotifier(boundFunction(nimLinkedToChanged,x))
646 nim.advanced = ConfigSubsection()
647 nim.advanced.sats = configElement(cname + "advanced.sats", configSatlist, 192, nimmgr.satList);
648 nim.advanced.sat = {}
649 lnbs = ["not available"]
650 for y in range(1, 33):
651 lnbs.append("LNB " + str(y))
652 for x in nimmgr.satList:
653 nim.advanced.sat[x[1]] = ConfigSubsection()
654 nim.advanced.sat[x[1]].voltage = configElement(cname + "advanced.sat" + str(x[1]) + ".voltage", configSelection, 0, (("polarization", _("Polarization")), ("13V", _("13 V")), ("18V", _("18 V"))))
655 nim.advanced.sat[x[1]].tonemode = configElement(cname + "advanced.sat" + str(x[1]) + ".tonemode", configSelection, 0, (("band", _("Band")), ("on", _("On")), ("off", _("Off"))))
656 nim.advanced.sat[x[1]].usals = configElement(cname + "advanced.sat" + str(x[1]) + ".usals", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))))
657 nim.advanced.sat[x[1]].rotorposition = configElement(cname + "advanced.sat" + str(x[1]) + ".rotorposition", configSequence, [1], configsequencearg.get("INTEGER", (1, 255)))
658 nim.advanced.sat[x[1]].lnb = configElement(cname + "advanced.sat" + str(x[1]) + ".lnb", configSelection, 0, lnbs)
660 nim.advanced.lnb = [0]
661 for x in range(1, 33):
662 nim.advanced.lnb.append(ConfigSubsection())
663 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"))))
664 nim.advanced.lnb[x].lofl = configElement(cname + "advanced.lnb" + str(x) + ".lofl", configSequence, [9750], configsequencearg.get("INTEGER", (0, 99999)))
665 nim.advanced.lnb[x].lofh = configElement(cname + "advanced.lnb" + str(x) + ".lofh", configSequence, [10600], configsequencearg.get("INTEGER", (0, 99999)))
666 nim.advanced.lnb[x].threshold = configElement(cname + "advanced.lnb" + str(x) + ".threshold", configSequence, [11750], configsequencearg.get("INTEGER", (0, 99999)))
667 nim.advanced.lnb[x].output_12v = configElement(cname + "advanced.lnb" + str(x) + ".output_12v", configSelection, 0, (("0V", _("0 V")), ("12V", _("12 V"))))
668 nim.advanced.lnb[x].increased_voltage = configElement(cname + "advanced.lnb" + str(x) + ".increased_voltage", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
669 nim.advanced.lnb[x].toneburst = configElement(cname + "advanced.lnb" + str(x) + ".toneburst", configSelection, 0, (("none", _("None")), ("A", _("A")), ("B", _("B"))))
670 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"))))
671 nim.advanced.lnb[x].commitedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".commitedDiseqcCommand", configSelection, 0, (("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))))
672 nim.advanced.lnb[x].fastDiseqc = configElement(cname + "advanced.lnb" + str(x) + ".fastDiseqc", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
673 nim.advanced.lnb[x].sequenceRepeat = configElement(cname + "advanced.lnb" + str(x) + ".sequenceRepeat", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))))
674 nim.advanced.lnb[x].commandOrder1_0 = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder1_0", configSelection, 0, ("committed, toneburst", "toneburst, committed"))
675 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"))
677 for y in range(1, 17):
678 disCmd.append("Input " + str(y))
679 nim.advanced.lnb[x].uncommittedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".uncommittedDiseqcCommand", configSelection, 0, disCmd)
680 nim.advanced.lnb[x].diseqcRepeats = configElement(cname + "advanced.lnb" + str(x) + ".diseqcRepeats", configSelection, 0, (("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))))
681 nim.advanced.lnb[x].longitude = configElement(cname + "advanced.lnb" + str(x) + ".longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]))
682 nim.advanced.lnb[x].longitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))))
683 nim.advanced.lnb[x].latitude = configElement(cname + "advanced.lnb" + str(x) + ".latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]))
684 nim.advanced.lnb[x].latitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))))
685 nim.advanced.lnb[x].powerMeasurement = configElement(cname + "advanced.lnb" + str(x) + ".powerMeasurement", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))))
686 nim.advanced.lnb[x].powerThreshold = configElement(cname + "advanced.lnb" + str(x) + ".powerThreshold", configSequence, [50], configsequencearg.get("INTEGER", (0, 100)))
687 elif slot.nimType == nimmgr.nimType["DVB-C"]:
688 nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList);
689 elif slot.nimType == nimmgr.nimType["DVB-T"]:
690 nim.cable = configElement(cname + "terrestrial", configSelection, 0, nimmgr.terrestrialsList);
692 print "pls add support for this frontend type!"
694 nimmgr.sec = SecConfigure(nimmgr)
696 nimmanager = NimManager()