add ability to select in scan what is todo with existing services (Clear before scan)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 8 May 2006 12:55:10 +0000 (12:55 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 8 May 2006 12:55:10 +0000 (12:55 +0000)
a) "yes" means remove all services and transponders for this sat position / all selected sat positions
b) "no" means hold all services and transponders for this sat position / all selected sat positions
   this resets all old new found flags (incremental scan)
c) "yes (hold feeds) means the same as a) but hold all feed services/transponders

data/skin_default.xml
lib/components/scan.h
lib/dvb/scan.cpp
lib/dvb/scan.h
lib/python/Screens/ScanSetup.py

index 6ebc95278b2fe146c126b3971f598dfac3bea881..aeaef247ad06e7cc298af50701e0204d78101ec6 100644 (file)
                <widget name="Dishpixmap" pixmap="dish.png" position="0,0" size="100,107" />
        </screen>
                <screen name="ChannelSelection" position="90,98" size="560,417" title="Channel Selection">
-               <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" />
+               <widget name="list" position="0,45" size="560,364" scrollbarMode="showOnDemand" />
                <widget name="key_red" position="0,0" size="140,40" backgroundColor="red" font="Regular;21" />
                <widget name="key_green" position="140,0" size="140,40" backgroundColor="green" font="Regular;21" />
                <widget name="key_yellow" position="280,0" size="140,40" backgroundColor="yellow" font="Regular;21" />
index 9ce6539fea2b2b8ee5af949b313d246ebbac2078..5a3ce4929aaa30ab3ebedb313cb0ab377675bb7a 100644 (file)
@@ -45,7 +45,7 @@ public:
        void addInitial(const eDVBFrontendParametersTerrestrial &p);
        
                /* please keep the flags in sync with lib/dvb/scan.h ! */
-       enum { scanNetworkSearch=1 };
+       enum { scanNetworkSearch=1, scanRemoveServices=4, scanDontRemoveFeeds=8 };
        int start(int feid, int flags=0);
 };
 
index e722b3c59e4a029759f75b8184a4b011518219c7..01b3cd321bf610f54adc124686ddd8a379300980 100644 (file)
@@ -15,6 +15,7 @@
 #include <lib/base/eerror.h>
 #include <lib/base/estring.h>
 #include <errno.h>
+#include <set>
 
 #define SCAN_eDebug(x...) eDebug(x)
 #define SCAN_eDebugNoNewLine(x...) eDebugNoNewLine(x)
@@ -422,6 +423,86 @@ void eDVBScan::start(const eSmartPtrList<iDVBFrontendParameters> &known_transpon
 
 void eDVBScan::insertInto(iDVBChannelList *db)
 {
+       if (m_flags & scanRemoveServices)
+       {
+               bool clearTerrestrial=false;
+               bool clearCable=false;
+               std::set<unsigned int> scanned_sat_positions;
+               
+               std::list<ePtr<iDVBFrontendParameters> >::iterator it(m_ch_scanned.begin());
+               for (;it != m_ch_scanned.end(); ++it)
+               {
+                       int system;
+                       (*it)->getSystem(system);
+                       switch(system)
+                       {
+                               case iDVBFrontend::feSatellite:
+                               {
+                                       eDVBFrontendParametersSatellite sat_parm;
+                                       (*it)->getDVBS(sat_parm);
+                                       scanned_sat_positions.insert(sat_parm.orbital_position);
+                                       break;
+                               }
+                               case iDVBFrontend::feTerrestrial:
+                               {
+                                       clearTerrestrial=true;
+                                       break;
+                               }
+                               case iDVBFrontend::feCable:
+                               {
+                                       clearCable=true;
+                                       break;
+                               }
+                       }
+               }
+
+               for (it=m_ch_unavailable.begin();it != m_ch_unavailable.end(); ++it)
+               {
+                       int system;
+                       (*it)->getSystem(system);
+                       switch(system)
+                       {
+                               case iDVBFrontend::feSatellite:
+                               {
+                                       eDVBFrontendParametersSatellite sat_parm;
+                                       (*it)->getDVBS(sat_parm);
+                                       scanned_sat_positions.insert(sat_parm.orbital_position);
+                                       break;
+                               }
+                               case iDVBFrontend::feTerrestrial:
+                               {
+                                       clearTerrestrial=true;
+                                       break;
+                               }
+                               case iDVBFrontend::feCable:
+                               {
+                                       clearCable=true;
+                                       break;
+                               }
+                       }
+               }
+
+               if (clearTerrestrial)
+               {
+                       eDVBChannelID chid;
+                       chid.dvbnamespace=0xEEEE0000;
+                       db->removeServices(chid);
+               }
+               if (clearCable)
+               {
+                       eDVBChannelID chid;
+                       chid.dvbnamespace=0xFFFF0000;
+                       db->removeServices(chid);
+               }
+               for (std::set<unsigned int>::iterator x(scanned_sat_positions.begin()); x != scanned_sat_positions.end(); ++x)
+               {
+                       eDVBChannelID chid;
+                       if (m_flags & scanDontRemoveFeed)
+                               chid.dvbnamespace = eDVBNamespace((*it)<<16));
+                       db->removeServices(chid, *it);
+               }
+       }
+
        for (std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> >::const_iterator 
                        ch(m_new_channels.begin()); ch != m_new_channels.end(); ++ch)
                db->addChannelToList(ch->first, ch->second);
index 2756fb1257a545e072bb2606df649867a74cb871..0a7c6ada2a723e190ac5c50fbe1e2b23fe25a7ac 100644 (file)
@@ -68,7 +68,7 @@ public:
        eDVBScan(iDVBChannel *channel);
        ~eDVBScan();
        
-       enum { scanNetworkSearch = 1, scanSearchBAT = 2 };
+       enum { scanNetworkSearch = 1, scanSearchBAT = 2, scanRemoveServices = 4, scanDontRemoveFeeds=8 };
        void start(const eSmartPtrList<iDVBFrontendParameters> &known_transponders, int flags);
 
        enum { evtUpdate, evtNewService, evtFinish, evtFail };
index f007f6f20d899c7df63e29187ab519c55127cbab..ff76d0205a64633d0cc9e3dd054cc4ca71ec269a 100644 (file)
@@ -202,11 +202,12 @@ class ScanSetup(Screen):
                                self.updateSatList()
                                print config.scan.satselection[config.scan.nims.value]
                                self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value]))
+                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
                        elif currentConfigSelectionElement(config.scan.type) == "multisat":
                                # if (norotor)
                                tlist = []
                                SatList = nimmanager.getSatListForNim(config.scan.nims.value)
-       
+                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
                                for x in SatList:
                                        if self.Satexists(tlist, x[1]) == 0:
                                                tlist.append(x[1])
@@ -228,7 +229,7 @@ class ScanSetup(Screen):
                                self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec))
                                self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan))
                        elif currentConfigSelectionElement(config.scan.typecable) == "complete":
-                               pass
+                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
                                
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
                        if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
@@ -243,7 +244,7 @@ class ScanSetup(Screen):
                                self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard))
                                self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy))
                        elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
-                               pass
+                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
 
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \
                        (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \
@@ -283,6 +284,7 @@ class ScanSetup(Screen):
                        config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))))
                        config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
                        config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
+                       config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)"))))
 
                        nimList = [ ]
                        for nim in nimmanager.nimList():
@@ -362,7 +364,7 @@ class ScanSetup(Screen):
                parm = eDVBFrontendParametersSatellite()
                parm.frequency = frequency * 1000
                parm.symbol_rate = symbol_rate * 1000
-               parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti   
+               parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti
                parm.fec = fec                  # eDVBFrontendParametersSatellite.FEC.f3_4;
                #parm.fec = 6                                   # AUTO
                parm.inversion = inversion      #eDVBFrontendParametersSatellite.Inversion.Off;
@@ -376,7 +378,7 @@ class ScanSetup(Screen):
                parm = eDVBFrontendParametersCable()
                parm.frequency = frequency * 1000
                parm.symbol_rate = symbol_rate * 1000
-               parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti  
+               parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti
                parm.fec = fec                  # eDVBFrontendParametersSatellite.FEC.f3_4;
                #parm.fec = 6                                   # AUTO
                parm.inversion = inversion      #eDVBFrontendParametersSatellite.Inversion.Off;
@@ -407,8 +409,15 @@ class ScanSetup(Screen):
                                                                                config.scan.sat.inversion.value,
                                                                                orbpos)
                        elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
-                               getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1]))
+                               sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value]
+                               getInitialTransponderList(tlist, int(sat[1]))
                                flags |= eComponentScan.scanNetworkSearch
+                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               if tmp == "yes":
+                                       flags |= eComponentScan.scanRemoveServices
+                               elif tmp == "yes_hold_feeds":
+                                       flags |= eComponentScan.scanRemoveServices
+                                       flags |= eComponentScan.scanDontRemoveFeeds
                        elif currentConfigSelectionElement(config.scan.type) == "multisat":
                                SatList = nimmanager.getSatListForNim(config.scan.nims.value)
                                for x in self.multiscanlist:
@@ -416,6 +425,12 @@ class ScanSetup(Screen):
                                                print "   " + str(x[1].parent.configPath)
                                                getInitialTransponderList(tlist, x[1].parent.configPath)
                                flags |= eComponentScan.scanNetworkSearch
+                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               if tmp == "yes":
+                                       flags |= eComponentScan.scanRemoveServices
+                               elif tmp == "yes_hold_feeds":
+                                       flags |= eComponentScan.scanRemoveServices
+                                       flags |= eComponentScan.scanDontRemoveFeeds
 
                elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
                        if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
@@ -429,10 +444,16 @@ class ScanSetup(Screen):
                        elif currentConfigSelectionElement(config.scan.typecable) == "complete":
                                getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value))
                                flags |= eComponentScan.scanNetworkSearch
+                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               if tmp == "yes":
+                                       flags |= eComponentScan.scanRemoveServices
+                               elif tmp == "yes_hold_feeds":
+                                       flags |= eComponentScan.scanRemoveServices
+                                       flags |= eComponentScan.scanDontRemoveFeeds
 
                elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
                        if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
-                               self.addTerTransponder(tlist, 
+                               self.addTerTransponder(tlist,
                                                config.scan.ter.frequency.value[0] * 1000000,
                                                inversion = config.scan.ter.inversion.value,
                                                bandwidth = config.scan.ter.bandwidth.value,
@@ -447,6 +468,12 @@ class ScanSetup(Screen):
                        elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
                                getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value))
                                flags |= eComponentScan.scanNetworkSearch
+                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               if tmp == "yes":
+                                       flags |= eComponentScan.scanRemoveServices
+                               elif tmp == "yes_hold_feeds":
+                                       flags |= eComponentScan.scanRemoveServices
+                                       flags |= eComponentScan.scanDontRemoveFeeds
 
                for x in self["config"].list:
                        x[1].save()
@@ -510,7 +537,14 @@ class ScanSimple(Screen):
                                        scanPossible = True
                                        getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
                                if scanPossible:
-                                       scanList.append({"transponders": tlist, "feid": slotid, "flags": eComponentScan.scanNetworkSearch})
+                                       flags=eComponentScan.scanNetworkSearch
+                                       tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                                       if tmp == "yes":
+                                               flags |= eComponentScan.scanRemoveServices
+                                       elif tmp == "yes_hold_feeds":
+                                               flags |= eComponentScan.scanRemoveServices
+                                               flags |= eComponentScan.scanDontRemoveFeeds
+                                       scanList.append({"transponders": tlist, "feid": slotid, "flags": flags})
                if len(scanList):
                        self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
                else:
@@ -518,7 +552,7 @@ class ScanSimple(Screen):
 
        def doNothing(self):
                pass
-       
+
        def keyCancel(self):
                self.close()
 
@@ -567,7 +601,10 @@ class ScanSimple(Screen):
 
                nimcount = nimmanager.getNimSocketCount()
                if nimcount > 0:
-                       nim = configElement_nonSave(0, configSelection, 0,(("yes", _("yes")),("no", _("no"))))
+                       config.scan = ConfigSubsection()
+                       config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)"))))
+                       self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
+                       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"))))