fix movieplayer
[enigma2.git] / lib / python / Components / NimManager.py
index aa9b7c456dca10854a98b758bf986cd46c04674e..0452adbe7adccbe3c2c02ab9f039dcebc7f31124 100644 (file)
@@ -28,7 +28,7 @@ def tryOpen(filename):
        return procFile
 
 class SecConfigure:
-       def addLNBSimple(self, slotid, orbpos, toneburstmode, diseqcmode, diseqcpos):
+       def addLNBSimple(self, slotid, diseqcmode, toneburstmode = 0, diseqcpos = 0, orbpos = 0, longitude = 0, latitude = 0, loDirection = 0, laDirection = 0):
                #simple defaults
                sec = eDVBSatelliteEquipmentControl.getInstance()
                sec.addLNB()
@@ -47,8 +47,25 @@ class SecConfigure:
                sec.setToneburst(toneburstmode)
                sec.setCommittedCommand(diseqcpos)
                #print "set orbpos to:" + str(orbpos)
-               sec.addSatellite(orbpos)
-               self.satList.append(orbpos)
+
+               if (0 <= diseqcmode < 3):
+                       sec.addSatellite(orbpos)
+                       self.satList.append(orbpos)
+               elif (diseqcmode == 3): # diseqc 1.2
+                       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]))
+                               sec.setVoltageMode(0)
+                               sec.setToneMode(0)
+                               self.satList.append(int(x[1]))
+                               
 
        def linkNIMs(self, nim1, nim2):
                eDVBSatelliteEquipmentControl.getInstance().setTunerLinked(nim1, nim2)
@@ -66,25 +83,25 @@ 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:
+                               if nim.configMode.value == 2:
                                        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)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 0, diseqcpos = 4)
                                        elif nim.diseqcMode.value == 1:         #Toneburst A/B
-                                               self.addLNBSimple(x, int(nim.diseqcA.vals[nim.diseqcA.value][1]), 1, 0, 4)
-                                               self.addLNBSimple(x, int(nim.diseqcB.vals[nim.diseqcB.value][1]), 1, 0, 4)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 1, diseqcmode = 0, diseqcpos = 4)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 1, diseqcmode = 0, diseqcpos = 4)
                                        elif nim.diseqcMode.value == 2:         #DiSEqC A/B
-                                               self.addLNBSimple(x, int(nim.diseqcA.vals[nim.diseqcA.value][1]), 0, 1, 0)
-                                               self.addLNBSimple(x, int(nim.diseqcB.vals[nim.diseqcB.value][1]), 0, 1, 1)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 0)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 1)
                                        elif nim.diseqcMode.value == 3:         #DiSEqC A/B/C/D
-                                               self.addLNBSimple(x, int(nim.diseqcA.vals[nim.diseqcA.value][1]), 0, 1, 0)
-                                               self.addLNBSimple(x, int(nim.diseqcB.vals[nim.diseqcB.value][1]), 0, 1, 1)
-                                               self.addLNBSimple(x, int(nim.diseqcC.vals[nim.diseqcC.value][1]), 0, 1, 2)
-                                               self.addLNBSimple(x, int(nim.diseqcD.vals[nim.diseqcD.value][1]), 0, 1, 3)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 0)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 1)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 2)
+                                               self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 3)
                                        elif nim.diseqcMode.value == 4:         #Positioner
-                                               print "FIXME: positioner suppport"
+                                               self.addLNBSimple(slotid = x, diseqcmode = 3, longitude = float(str(nim.longitude.value[0]) + "." + str(nim.longitude.value[1])), loDirection = nim.longitudeOrientation.value - 2, latitude = float(str(nim.latitude.value[0]) + "." + str(nim.latitude.value[1])), laDirection = nim.latitudeOrientation.value)
                                        pass
                                else:                                                                                                                                   #advanced config
                                        print "FIXME add support for advanced config"
@@ -110,7 +127,9 @@ class NimManager:
                def startElement(self, name, attrs):
                        if (name == "sat"):
                                #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
-                               tpos = attrs.get('position',"")
+                               tpos = int(attrs.get('position',""))
+                               if tpos < 0:
+                                       tpos = 3600 + tpos
                                tname = attrs.get('name',"")
                                self.satellites[tpos] = tname
                                self.satList.append( (tname, tpos) )
@@ -149,7 +168,7 @@ class NimManager:
                                else:
                                        self.transponders[self.parsedCab] = [ ]
 
-                               self.transponders[self.parsedCab].append((0, freq, sr, mod, fec))
+                               self.transponders[self.parsedCab].append((1, freq, sr, mod, fec))
 
        class parseTerrestrials(ContentHandler):
                def __init__(self, terrestrialsList, transponders):
@@ -180,7 +199,7 @@ class NimManager:
                                else:
                                        self.transponders[self.parsedTer] = [ ]
 
-                               self.transponders[self.parsedTer].append((0, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
+                               self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
 
        def getTransponders(self, pos):
                return self.transponders[pos]
@@ -189,7 +208,7 @@ class NimManager:
                return self.sec.getSatList()
 
        def getSatDescription(self, pos):
-               return self.satellites[str(pos)]
+               return self.satellites[pos]
 
        def readSatsfromFile(self):
                self.satellites = { }
@@ -326,14 +345,17 @@ class NimManager:
                        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)
                return list
 
        #callbacks for c++ config
        def nimConfigModeChanged(self, slotid, mode):
-               if (mode != 1): # not linked
+               if (mode != 2): # not linked
                        print "Unlinking slot " + str(slotid)
                        # TODO call c++ to unlink nim in slot slotid
-               if (mode == 1): # linked
+               if (mode == 2): # linked
                        pass
                        #FIXME!!!
                        #if (len(self.getNimListOfType(self.nimType["DVB-S"], slotid)) > 0):
@@ -386,10 +408,10 @@ def InitNimManager(nimmgr):
                nim = config.Nims[x]
                
                if slot.nimType == nimmgr.nimType["DVB-S"]:
-                       nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Loopthrough to Socket A"))) # "Advanced"));
+                       nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Nothing connected"), _("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 nim.configMode.value == 2: #linked
                                if x == 0:                                                                              #first one can never be linked to anything
                                        nim.configMode.value = 0                #reset to simple
                                        nim.configMode.save()
@@ -401,7 +423,7 @@ def InitNimManager(nimmgr):
                                                                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.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);