dont ask for scanning second nim in automatic scan, when it is not meaningful
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 13 Mar 2006 23:22:55 +0000 (23:22 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 13 Mar 2006 23:22:55 +0000 (23:22 +0000)
lib/dvb/sec.cpp
lib/dvb/sec.h
lib/python/Components/NimManager.py
lib/python/Screens/ScanSetup.py

index b003e16df67550289d99c02090312516ddb0fd59..c13334d1236f66d3c2c1752cba3bbebbfa26cc62 100644 (file)
@@ -1032,6 +1032,51 @@ RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
        return 0;
 }
 
+PyObject *eDVBSatelliteEquipmentControl::get_different_satellites(int tu1, int tu2)
+{
+       PyObject *ret=0;
+       if (tu1 != tu2)
+       {
+               eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
+               int cnt=0;
+               for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt)
+               {
+                       if (cnt == tu1)
+                               p1 = *it;
+                       else if (cnt == tu2)
+                               p2 = *it;
+               }
+               if (p1 && p2)
+               {
+                       // check for linked tuners
+                       int tmp1, tmp2;
+                       p1->m_frontend->getData(7, tmp1);
+                       p2->m_frontend->setData(7, tmp2);
+                       if ((void*)tmp1 != p2 && (void*)tmp2 != p1)
+                       {
+                               // check for rotor dependency
+                               p1->m_frontend->getData(8, tmp1);
+                               p2->m_frontend->setData(8, tmp2);
+                               if ((void*)tmp1 != p2 && (void*)tmp2 != p1)
+                               {
+                                       // here we know the tuners are not linked and no rotor dependency exist.
+                                       // now we check all configured satellites/lnb for difference and at all difference
+                                       // to a list of tuples with first value tuner number and second value orbital position
+                                       // of satellite
+                                       ret = PyList_New(0);
+                                       // FIXMEE !! fill list (compare satellites (lofh, lofl, lof threshold, opos))
+                               }
+                       }
+               }
+       }
+       if (!ret)
+       {
+               Py_INCREF(Py_None);
+               ret = Py_None;
+       }
+       return ret;
+}
+
 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
 {
        return setDependencyPointers(tu1, tu2, 7);
index d86d96eaba184d9b7002805edd372168eff159bb..ab1f1ac32c0676e2e4b5067ae8c33fb74730c6bf 100644 (file)
@@ -290,6 +290,7 @@ public:
        RESULT setTunerLinked(int from, int to);
        RESULT setTunerDepends(int from, int to);
 
+       PyObject *get_different_satellites(int tu1, int tu2);
        void setRotorMoving(bool); // called from the frontend's
        bool isRotorMoving();
 };
index ac73c00ebcb3433b00cb0ccc6a130adcd70bd7ce..8769aae96d2a457ea139ca16645494f80eece437 100644 (file)
@@ -557,7 +557,10 @@ class NimManager:
                                nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
                        list.append((nimText, slot))
                return list
-       
+
+       def getNimConfigMode(self, slotid):
+               return currentConfigSelectionElement(config.Nims[slotid].configMode)
+
        def getSatListForNim(self, slotid):
                list = []
                if (self.getNimType(slotid) == self.nimType["DVB-S"]):
index 9541c60f33cedb74f07f0b5e16bb916eeeaf4a1e..0229d5e8758307b151c74ea7dbec48e1c9d02178 100644 (file)
@@ -5,7 +5,7 @@ from Components.ActionMap import NumberActionMap
 from Components.ConfigList import ConfigList
 from Components.NimManager import nimmanager
 from Components.Label import Label
-from enigma import eDVBFrontendParametersSatellite, eComponentScan
+from enigma import eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl
 
 def getInitialTransponderList(tlist, pos):
        list = nimmanager.getTransponders(pos)
@@ -408,6 +408,19 @@ class ScanSimple(Screen):
                                return 1
                return 0
 
+       def ScanNimTwoNeeded(self):
+               if nimmanager.getNimType(0) != nimmanager.getNimType(1):
+                       return True
+               if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"]: #two dvb-s nims
+                       if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
+                               return False
+                       sec = eDVBSatelliteEquipmentControl.getInstance()
+                       if sec is not None:
+                               different_satellites = sec.get_different_satellites(0,1)
+                               if different_satellites is None:# or not len(different_satellites):
+                                       return False
+                       return True
+
        def __init__(self, session):
                Screen.__init__(self, session)
 
@@ -422,10 +435,13 @@ class ScanSimple(Screen):
                self.list = []
                tlist = []
 
-               for slotid in range(nimmanager.getNimSocketCount()):
-                       if nimmanager.getNimType(slotid) != nimmanager.nimType["DVB-S"] or currentConfigSelectionElement(config.Nims[slotid].configMode) != "nothing":
-                               nim = configElement_nonSave(slotid, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
-                               self.list.append(getConfigListEntry(_("Scan NIM") + " " + str(slotid) + " (" + nimmanager.getNimTypeName(slotid) + ")", nim))
+               nimcount = nimmanager.getNimSocketCount()
+               if nimcount > 0:
+                       nim = configElement_nonSave(0, configSelection, 0,(("yes", _("yes")),("no", _("no"))))
+                       self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
+               if nimcount > 1 and self.ScanNimTwoNeeded():
+                       nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
+                       self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
 
                self["config"] = ConfigList(self.list)
                self["header"] = Label(_("Automatic Scan"))