X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2FComponents%2FNimManager.py;h=00d0609544488a78928521519d0647009b87e9c8;hb=3a4d44ac0f28fa87f1d8cde20b5e38dd644d5b37;hp=6222afeaa6e65656d31e8f78b6be0c02457fe0be;hpb=472d0fb82d59a7d7ffaa3e7041e0024c7ace0115;p=vuplus_dvbapp diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6222afe..00d0609 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -46,7 +46,7 @@ class SecConfigure: if self.equal.has_key(slotid): for slot in self.equal[slotid]: tunermask |= (1 << slot) - elif self.linked.has_key(slotid): + if self.linked.has_key(slotid): for slot in self.linked[slotid]: tunermask |= (1 << slot) sec.setLNBSatCR(-1) @@ -262,7 +262,7 @@ class SecConfigure: if self.equal.has_key(slotid): for slot in self.equal[slotid]: tunermask |= (1 << slot) - elif self.linked.has_key(slotid): + if self.linked.has_key(slotid): for slot in self.linked[slotid]: tunermask |= (1 << slot) @@ -321,9 +321,9 @@ class SecConfigure: elif dm == "1_2": sec.setDiSEqCMode(diseqcParam.V1_2) - if self.satposdepends.has_key(slotid): - for slot in self.satposdepends[slotid]: - tunermask |= (1 << slot) + if self.satposdepends.has_key(slotid): + for slot in self.satposdepends[slotid]: + tunermask |= (1 << slot) if dm != "none": if currLnb.toneburst.value == "none": @@ -554,6 +554,13 @@ class NimManager: def getSatDescription(self, pos): return self.satellites[pos] + def sortFunc(self, x): + orbpos = x[0] + if orbpos > 1800: + return orbpos - 3600 + else: + return orbpos + 1800 + def readTransponders(self): # read initial networks from file. we only read files which we are interested in, # which means only these where a compatible tuner exists. @@ -565,9 +572,10 @@ class NimManager: if self.hasNimType("DVB-S"): print "Reading satellites.xml" db.readSatellites(self.satList, self.satellites, self.transponders) -# print "SATLIST", self.satList -# print "SATS", self.satellites -# print "TRANSPONDERS", self.transponders + self.satList.sort(key = self.sortFunc) # sort by orbpos + #print "SATLIST", self.satList + #print "SATS", self.satellites + #print "TRANSPONDERS", self.transponders if self.hasNimType("DVB-C"): print "Reading cables.xml" @@ -759,6 +767,22 @@ class NimManager: def getSatList(self): return self.satList + + # returns True if something is configured to be connected to this nim + # if slotid == -1, returns if something is connected to ANY nim + def somethingConnected(self, slotid = -1): + if (slotid == -1): + connected = False + for id in range(self.getSlotCount()): + if self.somethingConnected(id): + connected = True + return connected + else: + nim = config.Nims[slotid] + configMode = nim.configMode.value + + if self.nim_slots[slotid].isCompatible("DVB-S") or self.nim_slots[slotid].isCompatible("DVB-T") or self.nim_slots[slotid].isCompatible("DVB-C"): + return not (configMode == "nothing") def getSatListForNim(self, slotid): list = [] @@ -856,7 +880,7 @@ def InitSecParams(): config.sec.delay_after_last_diseqc_command = x x = ConfigInteger(default=50, limits = (0, 9999)) - x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_TONEBURST, configElement.value), initial_call = False) + x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_TONEBURST, configElement.value)) config.sec.delay_after_toneburst = x x = ConfigInteger(default=20, limits = (0, 9999)) @@ -875,7 +899,7 @@ def InitSecParams(): x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value)) config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x - x = ConfigInteger(default=750, limits = (0, 9999)) + x = ConfigInteger(default=900, limits = (0, 9999)) x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value)) config.sec.delay_after_enable_voltage_before_motor_command = x @@ -923,7 +947,7 @@ def InitNimManager(nimmgr): lnb_choices = { "universal_lnb": _("Universal LNB"), - "unicable": _("Unicable"), +# "unicable": _("Unicable"), "c_band": _("C-Band"), "user_defined": _("User defined")} @@ -1189,10 +1213,21 @@ def InitNimManager(nimmgr): tmp.lnb = lnb nim.advanced.sat[x] = tmp + def toneAmplitudeChanged(configElement): + fe_id = configElement.fe_id + slot_id = configElement.slot_id + if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': + open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) + + empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] if slot.isCompatible("DVB-S"): + nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") + nim.toneAmplitude.fe_id = x - empty_slots + nim.toneAmplitude.slot_id = x + nim.toneAmplitude.addNotifier(toneAmplitudeChanged) nim.diseqc13V = ConfigYesNo(False) nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b") nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) @@ -1282,6 +1317,7 @@ def InitNimManager(nimmgr): nim.terrestrial = ConfigSelection(choices = list) nim.terrestrial_5V = ConfigOnOff() else: + empty_slots += 1 nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing"); if slot.type is not None: print "pls add support for this frontend type!", slot.type