X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/9abfba44b394a64d978edebb58dc4f445cac2623..0cd4b8be7607608d8b33bf1a5c25dda8815463d3:/lib/python/Components/NimManager.py diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 437c51da..aa9b7c45 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -50,11 +50,15 @@ class SecConfigure: sec.addSatellite(orbpos) self.satList.append(orbpos) + def linkNIMs(self, nim1, nim2): + eDVBSatelliteEquipmentControl.getInstance().setTunerLinked(nim1, nim2) + def getSatList(self): return self.satList def update(self): eDVBSatelliteEquipmentControl.getInstance().clear() + self.satList = [] for slot in self.NimManager.nimslots: @@ -62,6 +66,9 @@ class SecConfigure: nim = config.Nims[x] if slot.nimType == self.NimManager.nimType["DVB-S"]: print "slot: " + str(x) + " configmode: " + str(nim.configMode.value) + if nim.configMode.value == 1: + self.linkNIMs(x, nim.linkedTo.value) + nim = config.Nims[nim.linkedTo.value] if nim.configMode.value == 0: #simple config if nim.diseqcMode.value == 0: #single self.addLNBSimple(x, int(nim.diseqcA.vals[nim.diseqcA.value][1]), 0, 0, 4) @@ -237,11 +244,13 @@ class NimManager: self.nimTypes[lastsocket] = "empty/unknown" nimfile.close() - def getNimType(self, slotID): - return self.nimType[self.nimTypes[slotID]] - + if slotID >= self.nimCount: + return "empty/unknown" + else: + return self.nimType[self.nimTypes[slotID]] + def getNimName(self, slotID): return self.nimNames[slotID] @@ -253,6 +262,13 @@ class NimManager: if (chktype == self.nimType[str(type)]): return True return False + + def getNimListOfType(self, type, exception = -1): + list = [] + for x in self.nimslots: + if ((x.nimType == type) and (x.slotid != exception)): + list.append(x.slotid) + return list def getConfigPrefix(self, slotid): return "config.Nim" + ("A","B","C","D")[slotid] + "." @@ -314,8 +330,18 @@ class NimManager: #callbacks for c++ config def nimConfigModeChanged(self, slotid, mode): - #print "nimConfigModeChanged set to " + str(mode) - pass + if (mode != 1): # not linked + print "Unlinking slot " + str(slotid) + # TODO call c++ to unlink nim in slot slotid + if (mode == 1): # 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 @@ -333,7 +359,6 @@ class NimManager: #print "nimDiseqcD set to " + str(val) pass - def InitNimManager(nimmgr): config.Nims = [] for x in range(nimmgr.nimCount): @@ -341,6 +366,8 @@ 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) @@ -359,14 +386,36 @@ def InitNimManager(nimmgr): nim = config.Nims[x] if slot.nimType == nimmgr.nimType["DVB-S"]: - nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Advanced"))); - nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (_("Single"), _("Toneburst A/B"), _("DiSEqC A/B"), _("DiSEqC A/B/C/D"), _("Positioner"))); + nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Loopthrough to Socket A"))) # "Advanced")); + + #important - check if just the 2nd one is LT only and the first one is DVB-S + if nim.configMode.value == 1: #linked + if x == 0: #first one can never be linked to anything + nim.configMode.value = 0 #reset to simple + nim.configMode.save() + else: + #FIXME: make it better + for y in nimmgr.nimslots: + if y.slotid == 0: + if y.nimType != nimmgr.nimType["DVB-S"]: + nim.configMode.value = 0 #reset to simple + nim.configMode.save() + + nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (_("Single"), _("Toneburst A/B"), _("DiSEqC A/B"), _("DiSEqC A/B/C/D")))#, _("Positioner"))); nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList); nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList); nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList); nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList); - nim.longitude = configElement(cname + "longitude", configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); - nim.latitude = configElement(cname + "latitude", configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + nim.positionerMode = configElement(cname + "positionerMode", configSelection, 0, (_("USALS"), _("manual"))); + nim.longitude = configElement(cname + "longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + nim.longitudeOrientation = configElement(cname + "longitudeOrientation", configSelection, 0, (_("East"), _("West"))) + nim.latitude = configElement(cname + "latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + nim.latitudeOrientation = configElement(cname + "latitudeOrientation", configSelection, 0, (_("North"), _("South"))) + satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid) + satNimListNames = [] + for x in satNimList: + satNimListNames.append(_("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)) + nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames); #perhaps the instance of the slot is more useful? nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x)) @@ -375,6 +424,7 @@ 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)) elif slot.nimType == nimmgr.nimType["DVB-C"]: nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList); elif slot.nimType == nimmgr.nimType["DVB-T"]: