add possibility to set manual lnb priority (only in advanced sat config)
authorghost <andreas.monzner@multimedia-labs.de>
Sat, 13 Dec 2008 00:33:05 +0000 (01:33 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Sat, 13 Dec 2008 00:33:05 +0000 (01:33 +0100)
range 0..64 to decrease priorities (this is lower as all auto given priorities)
range 14000..14064 this is higher than auto given rotor priorities
range 19000..19064 this is higher than each auto given priorities

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

index 751a545358015e1492f27074981ba23646e09ef2..1022b9556161dd698d9d190d2a6c812488379537 100644 (file)
@@ -140,7 +140,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite
        {
                bool rotor=false;
                eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
-               if ( lnb_param.slot_mask & slot_id ) // lnb for correct tuner?
+               if ( lnb_param.m_slot_mask & slot_id ) // lnb for correct tuner?
                {
                        int ret = 0;
                        eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
@@ -297,6 +297,9 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite
                                                ret=0;
                                }
 
+                               if (ret && lnb_param.m_prio != -1)
+                                       ret = lnb_param.m_prio;
+
                                eSecDebugNoSimulate("ret %d, score old %d", ret, score);
                                if (ret > score)
                                {
@@ -309,7 +312,12 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite
                }
        }
        if (score && satcount)
-               score -= (satcount-1);
+       {
+               if (score > (satcount-1))
+                       score -= (satcount-1);
+               else
+                       score = 1; // min score
+       }
        if (score && direct_connected)
                score += 5; // increase score for tuners with direct sat connection
        eSecDebugNoSimulate("final score %d", score);
@@ -963,7 +971,8 @@ RESULT eDVBSatelliteEquipmentControl::clear()
        for (int i=0; i <= m_lnbidx; ++i)
        {
                m_lnbs[i].m_satellites.clear();
-               m_lnbs[i].slot_mask = 0;
+               m_lnbs[i].m_slot_mask = 0;
+               m_lnbs[i].m_prio = -1; // auto
        }
        m_lnbidx=-1;
 
@@ -1021,7 +1030,7 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSlotMask(int slotmask)
 {
        eSecDebug("eDVBSatelliteEquipmentControl::setLNBSlotMask(%d)", slotmask);
        if ( currentLNBValid() )
-               m_lnbs[m_lnbidx].slot_mask = slotmask;
+               m_lnbs[m_lnbidx].m_slot_mask = slotmask;
        else
                return -ENOENT;
        return 0;
@@ -1067,6 +1076,17 @@ RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
        return 0;
 }
 
+RESULT eDVBSatelliteEquipmentControl::setLNBPrio(int prio)
+{
+       eSecDebug("eDVBSatelliteEquipmentControl::setLNBPrio(%d)", prio);
+       if ( currentLNBValid() )
+               m_lnbs[m_lnbidx].m_prio = prio;
+       else
+               return -ENOENT;
+       return 0;
+}
+
+
 /* DiSEqC Specific Parameters */
 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
 {
index 27dcedd50411c337bbb01e15ea3bd9d5c4a96fee..2efd0b4985462b2179ade6b750d3b73a899d6c4f 100644 (file)
@@ -231,7 +231,7 @@ public:
 #ifndef SWIG
        t_12V_relais_state m_12V_relais_state;  // 12V relais output on/off
 
-       __u8 slot_mask; // useable by slot ( 1 | 2 | 4...)
+       int m_slot_mask; // useable by slot ( 1 | 2 | 4...)
 
        unsigned int m_lof_hi,  // for 2 band universal lnb 10600 Mhz (high band offset frequency)
                                m_lof_lo,       // for 2 band universal lnb  9750 Mhz (low band offset frequency)
@@ -242,6 +242,8 @@ public:
        std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
        eDVBSatelliteDiseqcParameters m_diseqc_parameters;
        eDVBSatelliteRotorParameters m_rotor_parameters;
+
+       int m_prio; // to override automatic tuner management ... -1 is Auto
 #endif
 };
 
@@ -304,6 +306,7 @@ public:
        RESULT setLNBLOFH(int lofh);
        RESULT setLNBThreshold(int threshold);
        RESULT setLNBIncreasedVoltage(bool onoff);
+       RESULT setLNBPrio(int prio);
 /* DiSEqC Specific Parameters */
        RESULT setDiSEqCMode(int diseqcmode);
        RESULT setToneburst(int toneburst);
index edd3bbbbabb5ed500294266bef8a618e764132b5..168962e97e395585b0005989a6fbe7a5f4b79e3d 100644 (file)
@@ -381,6 +381,8 @@ class SecConfigure:
 
                                sec.setLNBSlotMask(tunermask)
 
+                               sec.setLNBPrio(int(currLnb.prio.value))
+
                                # finally add the orbital positions
                                for y in lnbSat[x]:
                                        self.addSatellite(sec, y)
@@ -1026,6 +1028,14 @@ def InitNimManager(nimmgr):
                                nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600)
                                etime = datetime(1970, 1, 1, 19, 0);
                                nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 600)
+                               prio_list = [ ("-1", _("Auto")) ]
+                               for prio in range(65):
+                                       prio_list.append((str(prio), str(prio)))
+                               for prio in range(14000,14065):
+                                       prio_list.append((str(prio), str(prio)))
+                               for prio in range(19000,19065):
+                                       prio_list.append((str(prio), str(prio)))
+                               nim.advanced.lnb[x].prio = ConfigSelection(default="-1", choices=prio_list)
                elif slot.isCompatible("DVB-C"):
                        nim.configMode = ConfigSelection(
                                choices = {
index 6489f28fe2ba5125a0bbd522ee34d726e42fb001..5628926f78c10b06d194652f3b27ec281f71014e 100644 (file)
@@ -283,6 +283,7 @@ class NimSetup(Screen, ConfigListScreen):
                                self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
 #                      self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v))
                        self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage))
+                       self.list.append(getConfigListEntry(_("Priority"), currLnb.prio))
 
        def fillAdvancedList(self):
                self.list = [ ]