dont use and show input power measurement (for rotor running detection),
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 2 Jun 2008 14:35:58 +0000 (14:35 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 2 Jun 2008 14:35:58 +0000 (14:35 +0000)
when the hardware doesn't support it

lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/sec.h
lib/python/Components/SystemInfo.py
lib/python/Screens/Satconfig.py

index f5eadda..41c4f3c 100644 (file)
@@ -748,6 +748,15 @@ error:
        return ret;
 }
 
+bool eDVBResourceManager::canMeasureFrontendInputPower()
+{
+       for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+       {
+               return i->m_frontend->readInputpower() >= 0;
+       }
+       return false;
+}
+
 class eDVBChannelFilePush: public eFilePushThread
 {
 public:
index c71a4d1..d2148bc 100644 (file)
@@ -215,6 +215,7 @@ public:
 #ifdef SWIG
 public:
 #endif
+       bool canMeasureFrontendInputPower();
        PSignal1<void,int> frontendUseMaskChanged;
        SWIG_VOID(RESULT) allocateRawChannel(eUsePtr<iDVBChannel> &SWIG_OUTPUT, int slot_index);
        PyObject *setFrontendSlotInformations(SWIG_PYOBJECT(ePyObject) list);
index 9522426..2241e00 100644 (file)
@@ -270,6 +270,7 @@ private:
        eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
        bool m_rotorMoving;
        int m_not_linked_slot_mask;
+       bool m_canMeasureInputPower;
 #endif
 #ifdef SWIG
        eDVBSatelliteEquipmentControl();
@@ -324,6 +325,7 @@ public:
        PyObject *get_exclusive_satellites(int tu1, int tu2);
        void setRotorMoving(bool); // called from the frontend's
        bool isRotorMoving();
+       bool canMeasureInputPower() { return m_canMeasureInputPower; }
 };
 
 #endif
index 844c954..c3c8ff3 100644 (file)
@@ -1,3 +1,5 @@
+from enigma import eDVBResourceManager
+
 SystemInfo = { }
 
 #FIXMEE...
@@ -9,3 +11,4 @@ def getNumVideoDecoders():
        return idx
 
 SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
+SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance().canMeasureFrontendInputPower()
index e32c45f..5415ae0 100644 (file)
@@ -1,5 +1,6 @@
 from enigma import eDVBDB
 from Screen import Screen
+from Components.SystemInfo import SystemInfo
 from Components.ActionMap import ActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.MenuList import MenuList
@@ -29,18 +30,22 @@ class NimSetup(Screen, ConfigListScreen):
                list.append(getConfigListEntry(" ", nim.longitudeOrientation))
                list.append(getConfigListEntry(_("Latitude"), nim.latitude))
                list.append(getConfigListEntry(" ", nim.latitudeOrientation))
-
-               self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement)
-               list.append(self.advancedPowerMeasurement)
-               if nim.powerMeasurement.value:
-                       list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold))
-                       self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed)
-                       list.append(self.turningSpeed)
-                       if nim.turningSpeed.value == "fast epoch":
-                               self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin)
-                               self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd)
-                               list.append(self.turnFastEpochBegin)
-                               list.append(self.turnFastEpochEnd)
+               if SystemInfo["CanMeasureFrontendInputPower"]:
+                       self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement)
+                       list.append(self.advancedPowerMeasurement)
+                       if nim.powerMeasurement.value:
+                               list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold))
+                               self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed)
+                               list.append(self.turningSpeed)
+                               if nim.turningSpeed.value == "fast epoch":
+                                       self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin)
+                                       self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd)
+                                       list.append(self.turnFastEpochBegin)
+                                       list.append(self.turnFastEpochEnd)
+               else:
+                       if nim.powerMeasurement.value:
+                               nim.powerMeasurement.value = False
+                               nim.powerMeasurement.save()
 
        def createSetup(self):
                print "Creating setup"
@@ -199,17 +204,22 @@ class NimSetup(Screen, ConfigListScreen):
                                        self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
                                        self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
                                        self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
-                                       self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement)
-                                       self.list.append(self.advancedPowerMeasurement)
-                                       if currLnb.powerMeasurement.value:
-                                               self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold))
-                                               self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed)
-                                               self.list.append(self.turningSpeed)
-                                               if currLnb.turningSpeed.value == "fast epoch":
-                                                       self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin)
-                                                       self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd)
-                                                       self.list.append(self.turnFastEpochBegin)
-                                                       self.list.append(self.turnFastEpochEnd)
+                                       if SystemInfo["CanMeasureFrontendInputPower"]:
+                                               self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement)
+                                               self.list.append(self.advancedPowerMeasurement)
+                                               if currLnb.powerMeasurement.value:
+                                                       self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold))
+                                                       self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed)
+                                                       self.list.append(self.turningSpeed)
+                                                       if currLnb.turningSpeed.value == "fast epoch":
+                                                               self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin)
+                                                               self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd)
+                                                               self.list.append(self.turnFastEpochBegin)
+                                                               self.list.append(self.turnFastEpochEnd)
+                                       else:
+                                               if currLnb.powerMeasurement.value:
+                                                       currLnb.powerMeasurement.value = False
+                                                       currLnb.powerMeasurement.save()
                        self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
                        self.list.append(self.advancedLof)
                        if currLnb.lof.value == "user_defined":