X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/df21108d272341745a001f781a3b8bd628f4ace6..3df16a12b479b1d4cfddf75f9129ce652855f1b7:/lib/python/Components/NimManager.py diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index b52a2114..97c6f31c 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -38,7 +38,9 @@ class SecConfigure: #simple defaults sec.addLNB() tunermask = 1 << slotid - if self.linked.has_key(slotid): + if self.equal.has_key(slotid): + tunermask |= (1 << self.equal[slotid]) + elif self.linked.has_key(slotid): tunermask |= (1 << self.linked[slotid]) sec.setLNBTunerMask(tunermask) sec.setLNBLOFL(9750000) @@ -60,13 +62,16 @@ class SecConfigure: sec.addSatellite(orbpos) self.satList.append(orbpos) elif (diseqcmode == 3): # diseqc 1.2 + if self.satposdepends.has_key(slotid): + tunermask |= (1 << self.satposdepends[slotid]) + sec.setLNBTunerMask(tunermask) sec.setLatitude(latitude) sec.setLaDirection(laDirection) sec.setLongitude(longitude) sec.setLoDirection(loDirection) sec.setUseInputpower(True) sec.setInputpowerDelta(50) - + for x in self.NimManager.satList: print "Add sat " + str(x[1]) sec.addSatellite(int(x[1])) @@ -74,6 +79,10 @@ class SecConfigure: sec.setToneMode(0) self.satList.append(int(x[1])) + def setSatposDepends(self, sec, nim1, nim2): + print "tuner", nim1, "depends on satpos of", nim2 + sec.setTunerDepends(nim1, nim2) + def linkNIMs(self, sec, nim1, nim2): print "link tuner", nim1, "to tuner", nim2 sec.setTunerLinked(nim1, nim2) @@ -88,20 +97,27 @@ class SecConfigure: self.satList = [] self.linked = { } + self.satposdepends = { } + self.equal = { } for slot in self.NimManager.nimslots: x = slot.slotid nim = config.Nims[x] if slot.nimType == self.NimManager.nimType["DVB-S"]: + if currentConfigSelectionElement(nim.configMode) == "equal": + self.equal[nim.equalTo.value]=x if currentConfigSelectionElement(nim.configMode) == "loopthrough": self.linkNIMs(sec, x, nim.linkedTo.value) self.linked[nim.linkedTo.value]=x + elif currentConfigSelectionElement(nim.configMode) == "satposdepends": + self.setSatposDepends(sec, x, nim.satposDependsTo.value) + self.satposdepends[nim.satposDependsTo.value]=x for slot in self.NimManager.nimslots: x = slot.slotid nim = config.Nims[x] if slot.nimType == self.NimManager.nimType["DVB-S"]: print "slot: " + str(x) + " configmode: " + str(nim.configMode.value) - if currentConfigSelectionElement(nim.configMode) == "loopthrough": + if currentConfigSelectionElement(nim.configMode) in [ "loopthrough", "satposdepends", "equal", "nothing" ]: pass elif currentConfigSelectionElement(nim.configMode) == "simple": #simple config if currentConfigSelectionElement(nim.diseqcMode) == "single": #single @@ -131,10 +147,7 @@ class SecConfigure: loDirection = loValue, latitude = configsequencearg.getFloat(nim.latitude), laDirection = laValue) -# pass - elif currentConfigSelectionElement(nim.configMode) == "nothing": - pass - else: #advanced config + elif currentConfigSelectionElement(nim.configMode) == "advanced": #advanced config self.updateAdvanced(sec, x) print "sec config completed" @@ -153,9 +166,10 @@ class SecConfigure: sec.addLNB() tunermask = 1 << slotid - if self.linked.has_key(slotid): + if self.equal.has_key(slotid): + tunermask |= (1 << self.equal[slotid]) + elif self.linked.has_key(slotid): tunermask |= (1 << self.linked[slotid]) - sec.setLNBTunerMask(tunermask) if currentConfigSelectionElement(currLnb.lof) == "universal_lnb": sec.setLNBLOFL(9750000) @@ -188,6 +202,10 @@ class SecConfigure: sec.setDiSEqCMode(diseqcParam.V1_1) elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_2": sec.setDiSEqCMode(diseqcParam.V1_2) + + if self.satposdepends.has_key(slotid): # only useable with rotors + tunermask |= (1 << self.satposdepends[slotid]) + if currentConfigSelectionElement(currLnb.diseqcMode) != "none": if currentConfigSelectionElement(currLnb.toneburst) == "none": @@ -272,7 +290,9 @@ class SecConfigure: sec.setInputpowerDelta(currLnb.powerThreshold.value[0]) else: sec.setUseInputpower(False) - + + sec.setLNBTunerMask(tunermask) + # finally add the orbital positions for y in lnbSat[x]: sec.addSatellite(y) @@ -523,38 +543,29 @@ class NimManager: def getSatListForNim(self, slotid): list = [] - if (self.getNimType(slotid) != self.nimType["empty/unknown"]): + if (self.getNimType(slotid) == self.nimType["DVB-S"]): #print "slotid:", slotid #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value] #print "diseqcA:", config.Nims[slotid].diseqcA.value - if (config.Nims[slotid].diseqcMode.value <= 3): - list.append(self.satList[config.Nims[slotid].diseqcA.value]) - if (0 < config.Nims[slotid].diseqcMode.value <= 3): - list.append(self.satList[config.Nims[slotid].diseqcB.value]) - if (config.Nims[slotid].diseqcMode.value == 3): - list.append(self.satList[config.Nims[slotid].diseqcC.value]) - list.append(self.satList[config.Nims[slotid].diseqcD.value]) - if (config.Nims[slotid].diseqcMode.value == 4): + configMode = currentConfigSelectionElement(config.Nims[slotid].configMode) + if configMode == "simple": + if (config.Nims[slotid].diseqcMode.value <= 3): + list.append(self.satList[config.Nims[slotid].diseqcA.value]) + if (0 < config.Nims[slotid].diseqcMode.value <= 3): + list.append(self.satList[config.Nims[slotid].diseqcB.value]) + if (config.Nims[slotid].diseqcMode.value == 3): + list.append(self.satList[config.Nims[slotid].diseqcC.value]) + list.append(self.satList[config.Nims[slotid].diseqcD.value]) + if (config.Nims[slotid].diseqcMode.value == 4): + for x in self.satList: + list.append(x) + elif configMode == "advanced": for x in self.satList: - list.append(x) + if config.Nims[slotid].advanced.sat[x[1]].lnb.value != 0: + list.append(x) return list -# #callbacks for c++ config -# def nimConfigModeChanged(self, slotid, mode): -# if (mode != 2): # not linked -# print "Unlinking slot " + str(slotid) -# # TODO call c++ to unlink nim in slot slotid -# if (mode == 2): # linked -# pass -# #FIXME!!! -# #if (len(self.getNimListOfType(self.nimType["DVB-S"], slotid)) > 0): -# # print "Linking slot " + str(slotid) + " to " + str(nimmgr.getConfigPrefix(slotid).value) -# # TODO call c++ to link nim in slot slotid with nim in slot nimmgr.getConfigPrefix(slotid).value - -# def nimLinkedToChanged(self, slotid, val): -# print "Linking slot " + str(slotid) + " to " + str(val) - def nimDiseqcModeChanged(self, slotid, mode): #print "nimDiseqcModeChanged set to " + str(mode) pass @@ -579,8 +590,6 @@ def InitNimManager(nimmgr): # def nimConfigModeChanged(slotid, configElement): # nimmgr.nimConfigModeChanged(slotid, configElement.value) -# def nimLinkedToChanged(slotid, configElement): -# nimmgr.nimLinkedToChanged(slotid, configElement.value) def nimDiseqcModeChanged(slotid, configElement): nimmgr.nimDiseqcModeChanged(slotid, configElement.value) @@ -600,12 +609,18 @@ def InitNimManager(nimmgr): if slot.nimType == nimmgr.nimType["DVB-S"]: if slot.slotid == 0: - nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("advanced", _("Advanced")))) - else: - nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("nothing", _("Nothing connected")), ("loopthrough", _("Loopthrough to Socket A")), ("advanced", _("Advanced")))) - + nim.configMode = configElement(cname + "configMode", configSelection, 0, ( + ("simple", _("Simple")), ("advanced", _("Advanced")))) + else: + nim.configMode = configElement(cname + "configMode", configSelection, 0, ( + ("equal", _("Equal to Socket A")), + ("loopthrough", _("Loopthrough to Socket A")), + ("nothing", _("Nothing connected")), + ("satposdepends", _("Secondary cable from Rotor-LNB")), + ("simple", _("Simple")), + ("advanced", _("Advanced")))) #important - check if just the 2nd one is LT only and the first one is DVB-S - if currentConfigSelectionElement(nim.configMode) == "loopthrough": #linked + if currentConfigSelectionElement(nim.configMode) in ["loopthrough", "satposdepends", "equal"]: if x == 0: #first one can never be linked to anything nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple nim.configMode.save() @@ -631,7 +646,9 @@ def InitNimManager(nimmgr): satNimListNames = [] for x in satNimList: satNimListNames.append((("Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)), _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x))) + nim.equalTo = configElement(cname + "equalTo", configSelection, 0, satNimListNames); nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames); + nim.satposDependsTo = configElement(cname + "satposDependsTo", configSelection, 0, satNimListNames); #perhaps the instance of the slot is more useful? # nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x)) @@ -640,7 +657,6 @@ def InitNimManager(nimmgr): nim.diseqcB.addNotifier(boundFunction(nimPortBChanged,x)) nim.diseqcC.addNotifier(boundFunction(nimPortCChanged,x)) nim.diseqcD.addNotifier(boundFunction(nimPortDChanged,x)) -# nim.linkedTo.addNotifier(boundFunction(nimLinkedToChanged,x)) # advanced config: nim.advanced = ConfigSubsection()