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.equal.has_key(slotid):
42 tunermask |= (1 << self.equal[slotid])
43 elif self.linked.has_key(slotid):
44 tunermask |= (1 << self.linked[slotid])
45 sec.setLNBTunerMask(tunermask)
46 sec.setLNBLOFL(9750000)
47 sec.setLNBLOFH(10600000)
48 sec.setLNBThreshold(11750000)
49 sec.setLNBIncreasedVoltage(lnbParam.OFF)
53 sec.setVoltageMode(switchParam.HV)
54 sec.setToneMode(switchParam.HILO)
55 sec.setCommandOrder(0)
58 sec.setDiSEqCMode(diseqcmode)
59 sec.setToneburst(toneburstmode)
60 sec.setCommittedCommand(diseqcpos)
61 #print "set orbpos to:" + str(orbpos)
63 if (0 <= diseqcmode < 3):
64 sec.addSatellite(orbpos)
65 self.satList.append(orbpos)
66 elif (diseqcmode == 3): # diseqc 1.2
67 if self.satposdepends.has_key(slotid):
68 tunermask |= (1 << self.satposdepends[slotid])
69 sec.setLNBTunerMask(tunermask)
70 sec.setLatitude(latitude)
71 sec.setLaDirection(laDirection)
72 sec.setLongitude(longitude)
73 sec.setLoDirection(loDirection)
74 sec.setUseInputpower(True)
75 sec.setInputpowerDelta(50)
77 for x in self.NimManager.satList:
78 print "Add sat " + str(x[1])
79 sec.addSatellite(int(x[1]))
82 sec.setRotorPosNum(0) # USALS
83 self.satList.append(int(x[1]))
85 def setSatposDepends(self, sec, nim1, nim2):
86 print "tuner", nim1, "depends on satpos of", nim2
87 sec.setTunerDepends(nim1, nim2)
89 def linkNIMs(self, sec, nim1, nim2):
90 print "link tuner", nim1, "to tuner", nim2
91 sec.setTunerLinked(nim1, nim2)
97 sec = eDVBSatelliteEquipmentControl.getInstance()
98 sec.clear() ## this do unlinking NIMs too !!
99 print "sec config cleared"
103 self.satposdepends = { }
105 for slot in self.NimManager.nimslots:
108 if slot.nimType == self.NimManager.nimType["DVB-S"]:
109 if currentConfigSelectionElement(nim.configMode) == "equal":
110 self.equal[nim.equalTo.value]=x
111 if currentConfigSelectionElement(nim.configMode) == "loopthrough":
112 self.linkNIMs(sec, x, nim.linkedTo.value)
113 self.linked[nim.linkedTo.value]=x
114 elif currentConfigSelectionElement(nim.configMode) == "satposdepends":
115 self.setSatposDepends(sec, x, nim.satposDependsTo.value)
116 self.satposdepends[nim.satposDependsTo.value]=x
118 for slot in self.NimManager.nimslots:
121 if slot.nimType == self.NimManager.nimType["DVB-S"]:
122 print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
123 if currentConfigSelectionElement(nim.configMode) in [ "loopthrough", "satposdepends", "equal", "nothing" ]:
125 elif currentConfigSelectionElement(nim.configMode) == "simple": #simple config
126 if currentConfigSelectionElement(nim.diseqcMode) == "single": #single
127 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
128 elif currentConfigSelectionElement(nim.diseqcMode) == "toneburst_a_b": #Toneburst A/B
129 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
130 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
131 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b": #DiSEqC A/B
132 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
133 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
134 elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b_c_d": #DiSEqC A/B/C/D
135 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
136 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
137 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA)
138 self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB)
139 elif currentConfigSelectionElement(nim.diseqcMode) == "positioner": #Positioner
140 if currentConfigSelectionElement(nim.latitudeOrientation) == "north":
141 laValue = rotorParam.NORTH
143 laValue = rotorParam.SOUTH
144 if currentConfigSelectionElement(nim.longitudeOrientation) == "east":
145 loValue = rotorParam.EAST
147 loValue = rotorParam.WEST
148 self.addLNBSimple(sec, slotid = x, diseqcmode = 3,
149 longitude = configsequencearg.getFloat(nim.longitude),
150 loDirection = loValue,
151 latitude = configsequencearg.getFloat(nim.latitude),
152 laDirection = laValue)
153 elif currentConfigSelectionElement(nim.configMode) == "advanced": #advanced config
154 self.updateAdvanced(sec, x)
155 print "sec config completed"
157 def updateAdvanced(self, sec, slotid):
159 for x in range(1,33):
161 for x in self.NimManager.satList:
162 lnb = config.Nims[slotid].advanced.sat[x[1]].lnb.value
164 print "add", x[1], "to", lnb
165 lnbSat[lnb].append(x[1])
166 for x in range(1,33):
167 if len(lnbSat[x]) > 0:
168 currLnb = config.Nims[slotid].advanced.lnb[x]
171 tunermask = 1 << slotid
172 if self.equal.has_key(slotid):
173 tunermask |= (1 << self.equal[slotid])
174 elif self.linked.has_key(slotid):
175 tunermask |= (1 << self.linked[slotid])
177 if currentConfigSelectionElement(currLnb.lof) == "universal_lnb":
178 sec.setLNBLOFL(9750000)
179 sec.setLNBLOFH(10600000)
180 sec.setLNBThreshold(11750000)
181 elif currentConfigSelectionElement(currLnb.lof) == "c_band":
182 sec.setLNBLOFL(5150000)
183 sec.setLNBLOFH(5150000)
184 sec.setLNBThreshold(5150000)
185 elif currentConfigSelectionElement(currLnb.lof) == "user_defined":
186 sec.setLNBLOFL(currLnb.lofl.value[0] * 1000)
187 sec.setLNBLOFH(currLnb.lofh.value[0] * 1000)
188 sec.setLNBThreshold(currLnb.threshold.value[0] * 1000)
190 if currentConfigSelectionElement(currLnb.output_12v) == "0V":
191 pass # nyi in drivers
192 elif currentConfigSelectionElement(currLnb.output_12v) == "12V":
193 pass # nyi in drivers
195 if currentConfigSelectionElement(currLnb.increased_voltage) == "yes":
196 sec.setLNBIncreasedVoltage(lnbParam.ON)
198 sec.setLNBIncreasedVoltage(lnbParam.OFF)
200 if currentConfigSelectionElement(currLnb.diseqcMode) == "none":
201 sec.setDiSEqCMode(diseqcParam.NONE)
202 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
203 sec.setDiSEqCMode(diseqcParam.V1_0)
204 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_1":
205 sec.setDiSEqCMode(diseqcParam.V1_1)
206 elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
207 sec.setDiSEqCMode(diseqcParam.V1_2)
209 if self.satposdepends.has_key(slotid): # only useable with rotors
210 tunermask |= (1 << self.satposdepends[slotid])
212 if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
213 if currentConfigSelectionElement(currLnb.toneburst) == "none":
214 sec.setToneburst(diseqcParam.NO)
215 elif currentConfigSelectionElement(currLnb.toneburst) == "A":
216 sec.setToneburst(diseqcParam.A)
217 elif currentConfigSelectionElement(currLnb.toneburst) == "B":
218 sec.setToneburst(diseqcParam.B)
220 if currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "none":
221 sec.setCommittedCommand(diseqcParam.SENDNO)
222 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AA":
223 sec.setCommittedCommand(diseqcParam.AA)
224 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AB":
225 sec.setCommittedCommand(diseqcParam.AB)
226 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BA":
227 sec.setCommittedCommand(diseqcParam.BA)
228 elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BB":
229 sec.setCommittedCommand(diseqcParam.BB)
231 if currentConfigSelectionElement(currLnb.fastDiseqc) == "yes":
232 sec.setFastDiSEqC(True)
234 sec.setFastDiSEqC(False)
236 if currentConfigSelectionElement(currLnb.sequenceRepeat) == "yes":
237 sec.setSeqRepeat(True)
239 sec.setSeqRepeat(False)
241 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
242 currCO = currLnb.commandOrder1_0.value
244 currCO = currLnb.commandOrder.value
246 if currLnb.uncommittedDiseqcCommand.value > 0:
247 sec.setUncommittedCommand(0xF0|(currLnb.uncommittedDiseqcCommand.value-1))
249 sec.setUncommittedCommand(0) # SENDNO
251 if currentConfigSelectionElement(currLnb.diseqcRepeats) == "none":
253 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "One":
255 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Two":
257 elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "Three":
260 setCommandOrder=False
261 if currCO == 0: # committed, toneburst
263 elif currCO == 1: # toneburst, committed
265 elif currCO == 2: # committed, uncommitted, toneburst
267 elif currCO == 3: # toneburst, committed, uncommitted
269 elif currCO == 4: # uncommitted, committed, toneburst
271 elif currCO == 5: # toneburst, uncommitted, commmitted
274 sec.setCommandOrder(currCO)
276 if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
277 latitude = configsequencearg.getFloat(currLnb.latitude)
278 sec.setLatitude(latitude)
279 longitude = configsequencearg.getFloat(currLnb.longitude)
280 sec.setLongitude(longitude)
281 if currentConfigSelectionElement(currLnb.latitudeOrientation) == "north":
282 sec.setLaDirection(rotorParam.NORTH)
284 sec.setLaDirection(rotorParam.SOUTH)
285 if currentConfigSelectionElement(currLnb.longitudeOrientation) == "east":
286 sec.setLoDirection(rotorParam.EAST)
288 sec.setLoDirection(rotorParam.WEST)
290 if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
291 sec.setUseInputpower(True)
292 sec.setInputpowerDelta(currLnb.powerThreshold.value[0])
294 sec.setUseInputpower(False)
296 sec.setLNBTunerMask(tunermask)
298 # finally add the orbital positions
301 currSat = config.Nims[slotid].advanced.sat[y]
302 if currentConfigSelectionElement(currSat.voltage) == "polarization":
303 sec.setVoltageMode(switchParam.HV)
304 elif currentConfigSelectionElement(currSat.voltage) == "13V":
305 sec.setVoltageMode(switchParam._14V)
306 elif currentConfigSelectionElement(currSat.voltage) == "18V":
307 sec.setVoltageMode(switchParam._18V)
309 if currentConfigSelectionElement(currSat.tonemode) == "band":
310 sec.setToneMode(switchParam.HILO)
311 elif currentConfigSelectionElement(currSat.tonemode) == "on":
312 sec.setToneMode(switchParam.ON)
313 elif currentConfigSelectionElement(currSat.tonemode) == "off":
314 sec.setToneMode(switchParam.OFF)
316 if currentConfigSelectionElement(currSat.usals) == "no":
317 sec.setRotorPosNum(currSat.rotorposition.value[0])
319 sec.setRotorPosNum(0) #USALS
321 def __init__(self, nimmgr):
322 self.NimManager = nimmgr
326 def __init__(self, slotid, nimtype, name):
328 self.nimType = nimtype
332 class parseSats(ContentHandler):
333 def __init__(self, satList, satellites, transponders):
334 self.isPointsElement, self.isReboundsElement = 0, 0
335 self.satList = satList
336 self.satellites = satellites
337 self.transponders = transponders
339 def startElement(self, name, attrs):
341 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
342 tpos = int(attrs.get('position',""))
345 tname = attrs.get('name',"")
346 self.satellites[tpos] = tname
347 self.satList.append( (tname, tpos) )
348 self.parsedSat = int(tpos)
349 elif (name == "transponder"):
350 freq = int(attrs.get('frequency',""))
351 sr = int(attrs.get('symbol_rate',""))
352 pol = int(attrs.get('polarization',""))
353 fec = int(attrs.get('fec_inner',""))
354 if self.parsedSat in self.transponders:
357 self.transponders[self.parsedSat] = [ ]
359 self.transponders[self.parsedSat].append((0, freq, sr, pol, fec))
361 class parseCables(ContentHandler):
362 def __init__(self, cablesList, transponders):
363 self.isPointsElement, self.isReboundsElement = 0, 0
364 self.cablesList = cablesList
365 self.transponders = transponders
367 def startElement(self, name, attrs):
368 if (name == "cable"):
369 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
370 tname = attrs.get('name',"")
371 self.cablesList.append(str(tname))
372 self.parsedCab = str(tname)
373 elif (name == "transponder"):
374 freq = int(attrs.get('frequency',""))
375 sr = int(attrs.get('symbol_rate',""))
376 mod = int(attrs.get('modulation',""))
377 fec = int(attrs.get('fec_inner',""))
378 if self.parsedCab in self.transponders:
381 self.transponders[self.parsedCab] = [ ]
383 self.transponders[self.parsedCab].append((1, freq, sr, mod, fec))
385 class parseTerrestrials(ContentHandler):
386 def __init__(self, terrestrialsList, transponders):
387 self.isPointsElement, self.isReboundsElement = 0, 0
388 self.terrestrialsList = terrestrialsList
389 self.transponders = transponders
391 def startElement(self, name, attrs):
392 if (name == "terrestrial"):
393 #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
394 tname = attrs.get('name',"")
395 tflags = attrs.get('flags',"")
396 self.terrestrialsList.append((tname, tflags))
397 self.parsedTer = str(tname)
398 elif (name == "transponder"):
400 freq = int(attrs.get('centre_frequency',""))
401 bw = int(attrs.get('bandwidth',""))
402 const = int(attrs.get('constellation',""))
403 crh = int(attrs.get('code_rate_hp',""))
404 crl = int(attrs.get('code_rate_lp',""))
405 guard = int(attrs.get('guard_interval',""))
406 transm = int(attrs.get('transmission_mode',""))
407 hierarchy = int(attrs.get('hierarchy_information',""))
408 inv = int(attrs.get('inversion',""))
409 if self.parsedTer in self.transponders:
412 self.transponders[self.parsedTer] = [ ]
414 self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
416 def getTransponders(self, pos):
417 return self.transponders[pos]
419 def getConfiguredSats(self):
420 return self.sec.getSatList()
422 def getSatDescription(self, pos):
423 return self.satellites[pos]
425 def readSatsfromFile(self):
426 self.satellites = { }
427 self.transponders = { }
428 self.transponderscable = { }
429 self.transpondersterrestrial = { }
431 parser = make_parser()
432 if (self.hasNimType(self.nimType["DVB-S"])):
433 print "Reading satellites.xml"
434 satHandler = self.parseSats(self.satList, self.satellites, self.transponders)
435 parser.setContentHandler(satHandler)
436 parser.parse('/etc/tuxbox/satellites.xml')
437 if (self.hasNimType(self.nimType["DVB-C"])):
438 print "Reading cables.xml"
439 cabHandler = self.parseCables(self.cablesList, self.transponderscable)
440 parser.setContentHandler(cabHandler)
441 parser.parse('/etc/tuxbox/cables.xml')
443 if (self.hasNimType(self.nimType["DVB-T"])):
444 print "Reading terrestrial.xml"
445 terHandler = self.parseTerrestrials(self.terrestrialsList, self.transpondersterrestrial)
446 parser.setContentHandler(terHandler)
447 parser.parse('/etc/tuxbox/terrestrial.xml')
452 self.nimSocketCount = 0
453 nimfile = tryOpen("/proc/bus/nim_sockets")
456 return self.nimType["empty/unknown"]
461 line = nimfile.readline()
464 if line.strip().startswith("NIM Socket"):
465 parts = line.strip().split(" ")
466 id = int(parts[2][:1])
468 self.nimSocketCount += 1
469 elif line.strip().startswith("Type:"):
470 self.nimTypes[lastsocket] = str(line.strip()[6:])
471 elif line.strip().startswith("Name:"):
472 self.nimNames[lastsocket] = str(line.strip()[6:])
473 elif line.strip().startswith("empty"):
474 self.nimNames[lastsocket] = _("N/A")
475 self.nimTypes[lastsocket] = "empty/unknown"
479 def getNimType(self, slotID):
480 if slotID >= self.nimCount:
481 return "empty/unknown"
483 return self.nimType[self.nimTypes[slotID]]
485 def getNimName(self, slotID):
486 return self.nimNames[slotID]
488 def getNimSocketCount(self):
489 return self.nimSocketCount
491 def hasNimType(self, chktype):
492 for id, type in self.nimTypes.items():
493 if (chktype == self.nimType[str(type)]):
497 def getNimListOfType(self, type, exception = -1):
499 for x in self.nimslots:
500 if ((x.nimType == type) and (x.slotid != exception)):
501 list.append(x.slotid)
504 def getConfigPrefix(self, slotid):
505 return "config.Nim" + ("A","B","C","D")[slotid] + "."
509 self.nimType = { "empty/unknown": -1,
515 self.terrestrialsList = []
519 self.readSatsfromFile()
521 self.nimCount = self.getNimSocketCount()
525 while x < self.nimCount:
526 tType = self.getNimType(x)
527 tName = self.getNimName(x)
528 tNim = nimSlot(x, tType, tName)
529 self.nimslots.append(tNim)
532 InitNimManager(self) #init config stuff
536 for slot in self.nimslots:
537 nimText = _("Socket ") + ("A", "B", "C", "D")[slot.slotid] + ": "
538 if slot.nimType == -1:
539 nimText += _("empty/unknown")
541 nimText += slot.name + " ("
542 nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
543 list.append((nimText, slot))
546 def getSatListForNim(self, slotid):
548 if (self.getNimType(slotid) == self.nimType["DVB-S"]):
549 #print "slotid:", slotid
551 #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
552 #print "diseqcA:", config.Nims[slotid].diseqcA.value
553 configMode = currentConfigSelectionElement(config.Nims[slotid].configMode)
554 if configMode == "simple":
555 if (config.Nims[slotid].diseqcMode.value <= 3):
556 list.append(self.satList[config.Nims[slotid].diseqcA.value])
557 if (0 < config.Nims[slotid].diseqcMode.value <= 3):
558 list.append(self.satList[config.Nims[slotid].diseqcB.value])
559 if (config.Nims[slotid].diseqcMode.value == 3):
560 list.append(self.satList[config.Nims[slotid].diseqcC.value])
561 list.append(self.satList[config.Nims[slotid].diseqcD.value])
562 if (config.Nims[slotid].diseqcMode.value == 4):
563 for x in self.satList:
565 elif configMode == "advanced":
566 for x in self.satList:
567 if config.Nims[slotid].advanced.sat[x[1]].lnb.value != 0:
571 def nimDiseqcModeChanged(self, slotid, mode):
572 #print "nimDiseqcModeChanged set to " + str(mode)
574 def nimPortAChanged(self, slotid, val):
575 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
577 def nimPortBChanged(self, slotid, val):
578 #print "nimDiseqcA set to " + str(slotid) + " val:" + str(val)
579 #print "nimDiseqcB set to " + str(val)
581 def nimPortCChanged(self, slotid, val):
582 #print "nimDiseqcC set to " + str(val)
584 def nimPortDChanged(self, slotid, val):
585 #print "nimDiseqcD set to " + str(val)
588 def InitNimManager(nimmgr):
590 for x in range(nimmgr.nimCount):
591 config.Nims.append(ConfigSubsection())
593 # def nimConfigModeChanged(slotid, configElement):
594 # nimmgr.nimConfigModeChanged(slotid, configElement.value)
595 def nimDiseqcModeChanged(slotid, configElement):
596 nimmgr.nimDiseqcModeChanged(slotid, configElement.value)
598 def nimPortAChanged(slotid, configElement):
599 nimmgr.nimPortAChanged(slotid, configElement.vals[configElement.value][1])
600 def nimPortBChanged(slotid, configElement):
601 nimmgr.nimPortBChanged(slotid, configElement.vals[configElement.value][1])
602 def nimPortCChanged(slotid, configElement):
603 nimmgr.nimPortCChanged(slotid, configElement.vals[configElement.value][1])
604 def nimPortDChanged(slotid, configElement):
605 nimmgr.nimPortDChanged(slotid, configElement.vals[configElement.value][1])
607 for slot in nimmgr.nimslots:
609 cname = nimmgr.getConfigPrefix(x)
612 if slot.nimType == nimmgr.nimType["DVB-S"]:
614 nim.configMode = configElement(cname + "configMode", configSelection, 0, (
615 ("simple", _("Simple")), ("advanced", _("Advanced"))), False)
617 nim.configMode = configElement(cname + "configMode", configSelection, 0, (
618 ("equal", _("Equal to Socket A")),
619 ("loopthrough", _("Loopthrough to Socket A")),
620 ("nothing", _("Nothing connected")),
621 ("satposdepends", _("Secondary cable from Rotor-LNB")),
622 ("simple", _("Simple")),
623 ("advanced", _("Advanced"))), False)
624 #important - check if just the 2nd one is LT only and the first one is DVB-S
625 if currentConfigSelectionElement(nim.configMode) in ["loopthrough", "satposdepends", "equal"]:
626 if x == 0: #first one can never be linked to anything
627 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
628 nim.configMode.save()
630 #FIXME: make it better
631 for y in nimmgr.nimslots:
633 if y.nimType != nimmgr.nimType["DVB-S"]:
634 nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
635 nim.configMode.save()
637 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"))), False);
638 nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList, False);
639 nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList, False);
640 nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList, False);
641 nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList, False);
642 nim.positionerMode = configElement(cname + "positionerMode", configSelection, 0, (("usals", _("USALS")), ("manual", _("manual"))), False);
643 nim.longitude = configElement(cname + "longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]), False);
644 nim.longitudeOrientation = configElement(cname + "longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))), False)
645 nim.latitude = configElement(cname + "latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]), False);
646 nim.latitudeOrientation = configElement(cname + "latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))), False)
647 satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid)
650 satNimListNames.append((("Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)), _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)))
651 nim.equalTo = configElement(cname + "equalTo", configSelection, 0, satNimListNames, False);
652 nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames, False);
653 nim.satposDependsTo = configElement(cname + "satposDependsTo", configSelection, 0, satNimListNames, False);
655 #perhaps the instance of the slot is more useful?
656 # nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
657 nim.diseqcMode.addNotifier(boundFunction(nimDiseqcModeChanged,x))
658 nim.diseqcA.addNotifier(boundFunction(nimPortAChanged,int(x)))
659 nim.diseqcB.addNotifier(boundFunction(nimPortBChanged,x))
660 nim.diseqcC.addNotifier(boundFunction(nimPortCChanged,x))
661 nim.diseqcD.addNotifier(boundFunction(nimPortDChanged,x))
664 nim.advanced = ConfigSubsection()
665 nim.advanced.sats = configElement(cname + "advanced.sats", configSatlist, 192, nimmgr.satList, False);
666 nim.advanced.sat = {}
667 lnbs = ["not available"]
668 for y in range(1, 33):
669 lnbs.append("LNB " + str(y))
670 for x in nimmgr.satList:
671 nim.advanced.sat[x[1]] = ConfigSubsection()
672 nim.advanced.sat[x[1]].voltage = configElement(cname + "advanced.sat" + str(x[1]) + ".voltage", configSelection, 0, (("polarization", _("Polarization")), ("13V", _("13 V")), ("18V", _("18 V"))), False)
673 nim.advanced.sat[x[1]].tonemode = configElement(cname + "advanced.sat" + str(x[1]) + ".tonemode", configSelection, 0, (("band", _("Band")), ("on", _("On")), ("off", _("Off"))), False)
674 nim.advanced.sat[x[1]].usals = configElement(cname + "advanced.sat" + str(x[1]) + ".usals", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))), False)
675 nim.advanced.sat[x[1]].rotorposition = configElement(cname + "advanced.sat" + str(x[1]) + ".rotorposition", configSequence, [1], configsequencearg.get("INTEGER", (1, 255)), False)
676 nim.advanced.sat[x[1]].lnb = configElement(cname + "advanced.sat" + str(x[1]) + ".lnb", configSelection, 0, lnbs, False)
678 nim.advanced.lnb = [0]
679 for x in range(1, 33):
680 nim.advanced.lnb.append(ConfigSubsection())
681 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"))), False)
682 nim.advanced.lnb[x].lofl = configElement(cname + "advanced.lnb" + str(x) + ".lofl", configSequence, [9750], configsequencearg.get("INTEGER", (0, 99999)), False)
683 nim.advanced.lnb[x].lofh = configElement(cname + "advanced.lnb" + str(x) + ".lofh", configSequence, [10600], configsequencearg.get("INTEGER", (0, 99999)), False)
684 nim.advanced.lnb[x].threshold = configElement(cname + "advanced.lnb" + str(x) + ".threshold", configSequence, [11750], configsequencearg.get("INTEGER", (0, 99999)), False)
685 nim.advanced.lnb[x].output_12v = configElement(cname + "advanced.lnb" + str(x) + ".output_12v", configSelection, 0, (("0V", _("0 V")), ("12V", _("12 V"))), False)
686 nim.advanced.lnb[x].increased_voltage = configElement(cname + "advanced.lnb" + str(x) + ".increased_voltage", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
687 nim.advanced.lnb[x].toneburst = configElement(cname + "advanced.lnb" + str(x) + ".toneburst", configSelection, 0, (("none", _("None")), ("A", _("A")), ("B", _("B"))), False)
688 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"))), False)
689 nim.advanced.lnb[x].commitedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".commitedDiseqcCommand", configSelection, 0, (("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))), False)
690 nim.advanced.lnb[x].fastDiseqc = configElement(cname + "advanced.lnb" + str(x) + ".fastDiseqc", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
691 nim.advanced.lnb[x].sequenceRepeat = configElement(cname + "advanced.lnb" + str(x) + ".sequenceRepeat", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
692 nim.advanced.lnb[x].commandOrder1_0 = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder1_0", configSelection, 0, ("committed, toneburst", "toneburst, committed"), False)
693 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"), False)
695 for y in range(1, 17):
696 disCmd.append("Input " + str(y))
697 nim.advanced.lnb[x].uncommittedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".uncommittedDiseqcCommand", configSelection, 0, disCmd, False)
698 nim.advanced.lnb[x].diseqcRepeats = configElement(cname + "advanced.lnb" + str(x) + ".diseqcRepeats", configSelection, 0, (("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))), False)
699 nim.advanced.lnb[x].longitude = configElement(cname + "advanced.lnb" + str(x) + ".longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)]), False)
700 nim.advanced.lnb[x].longitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))), False)
701 nim.advanced.lnb[x].latitude = configElement(cname + "advanced.lnb" + str(x) + ".latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)]), False)
702 nim.advanced.lnb[x].latitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))), False)
703 nim.advanced.lnb[x].powerMeasurement = configElement(cname + "advanced.lnb" + str(x) + ".powerMeasurement", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))), False)
704 nim.advanced.lnb[x].powerThreshold = configElement(cname + "advanced.lnb" + str(x) + ".powerThreshold", configSequence, [50], configsequencearg.get("INTEGER", (0, 100)), False)
705 elif slot.nimType == nimmgr.nimType["DVB-C"]:
706 nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList, False);
707 elif slot.nimType == nimmgr.nimType["DVB-T"]:
708 nim.cable = configElement(cname + "terrestrial", configSelection, 0, nimmgr.terrestrialsList, False);
710 print "pls add support for this frontend type!"
712 nimmgr.sec = SecConfigure(nimmgr)
714 nimmanager = NimManager()