show more information in service scan (needs additional changes in skin)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 15 Sep 2007 14:02:43 +0000 (14:02 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 15 Sep 2007 14:02:43 +0000 (14:02 +0000)
lib/components/scan.cpp
lib/components/scan.h
lib/dvb/frontend.h
lib/dvb/frontendparms.h
lib/dvb/idvb.h
lib/dvb/scan.cpp
lib/dvb/scan.h
lib/python/Components/ServiceScan.py
lib/python/Screens/ServiceScan.py
lib/python/enigma_python.i

index a863d92..c027fe6 100644 (file)
@@ -10,42 +10,42 @@ void eComponentScan::scanEvent(int evt)
 {
 //     eDebug("scan event %d!", evt);
        
 {
 //     eDebug("scan event %d!", evt);
        
-       if (evt == eDVBScan::evtFinish)
+       switch(evt)
        {
        {
-               m_done = 1;
-               ePtr<iDVBChannelList> db;
-               ePtr<eDVBResourceManager> res;
-               
-               int err;
-               if ((err = eDVBResourceManager::getInstance(res)) != 0)
-               {
-                       eDebug("no resource manager");
-                       m_failed = 2;
-               } else if ((err = res->getChannelList(db)) != 0)
+               case eDVBScan::evtFinish:
                {
                {
-                       m_failed = 3;
-                       eDebug("no channel list");
-               } else
-               {
-                       m_scan->insertInto(db);
-                       db->flush();
-                       eDebug("scan done!");
+                       m_done = 1;
+                       ePtr<iDVBChannelList> db;
+                       ePtr<eDVBResourceManager> res;
+                       
+                       int err;
+                       if ((err = eDVBResourceManager::getInstance(res)) != 0)
+                       {
+                               eDebug("no resource manager");
+                               m_failed = 2;
+                       } else if ((err = res->getChannelList(db)) != 0)
+                       {
+                               m_failed = 3;
+                               eDebug("no channel list");
+                       } else
+                       {
+                               m_scan->insertInto(db);
+                               db->flush();
+                               eDebug("scan done!");
+                       }
+                       break;
                }
                }
+               case eDVBScan::evtNewService:
+                       newService();
+                       return;
+               case eDVBScan::evtFail:
+                       eDebug("scan failed.");
+                       m_failed = 1;
+                       m_done = 1;
+                       break;
+               case eDVBScan::evtUpdate:
+                       break;
        }
        }
-       
-       if (evt == eDVBScan::evtNewService)
-       {
-               newService();
-               return;
-       }
-       
-       if (evt == eDVBScan::evtFail)
-       {
-               eDebug("scan failed.");
-               m_failed = 1;
-               m_done = 1;
-       }
-       
        statusChanged();
 }
 
        statusChanged();
 }
 
@@ -122,7 +122,7 @@ int eComponentScan::start(int feid, int flags)
                {
                        if (m_initial.size() > 1)
                        {
                {
                        if (m_initial.size() > 1)
                        {
-                               iDVBFrontendParameters *tp = m_initial.first();
+                               ePtr<iDVBFrontendParameters> tp = m_initial.first();
                                int type;
                                if (tp && !tp->getSystem(type))
                                {
                                int type;
                                if (tp && !tp->getSystem(type))
                                {
@@ -151,14 +151,6 @@ int eComponentScan::start(int feid, int flags)
        return 0;
 }
 
        return 0;
 }
 
-RESULT eComponentScan::getFrontend(ePtr<iDVBFrontend> &fe)
-{
-       if (m_scan)
-               return m_scan->getFrontend(fe);
-       fe = 0;
-       return -1;
-}
-
 int eComponentScan::getProgress()
 {
        if (!m_scan)
 int eComponentScan::getProgress()
 {
        if (!m_scan)
@@ -195,3 +187,20 @@ void eComponentScan::getLastServiceName(std::string &string)
                return;
        m_scan->getLastServiceName(string);
 }
                return;
        m_scan->getLastServiceName(string);
 }
+
+RESULT eComponentScan::getFrontend(ePtr<iDVBFrontend> &fe)
+{
+       if (m_scan)
+               return m_scan->getFrontend(fe);
+       fe = 0;
+       return -1;
+}
+
+RESULT eComponentScan::getCurrentTransponder(ePtr<iDVBFrontendParameters> &tp)
+{
+       if (m_scan)
+               return m_scan->getCurrentTransponder(tp);
+       tp = 0;
+       return -1;
+}
+
index e4bb41e..b5acf91 100644 (file)
@@ -48,6 +48,7 @@ public:
        enum { scanNetworkSearch=1, scanRemoveServices=4, scanDontRemoveFeeds=8, clearToScanOnFirstNIT = 16 };
        int start(int feid, int flags=0 );
        SWIG_VOID(RESULT) getFrontend(ePtr<iDVBFrontend> &SWIG_OUTPUT);
        enum { scanNetworkSearch=1, scanRemoveServices=4, scanDontRemoveFeeds=8, clearToScanOnFirstNIT = 16 };
        int start(int feid, int flags=0 );
        SWIG_VOID(RESULT) getFrontend(ePtr<iDVBFrontend> &SWIG_OUTPUT);
+       SWIG_VOID(RESULT) getCurrentTransponder(ePtr<iDVBFrontendParameters> &SWIG_OUTPUT);
 };
 
 #endif
 };
 
 #endif
index 6bf3646..db1c364 100644 (file)
@@ -16,18 +16,18 @@ public:
        eDVBFrontendParameters();
        ~eDVBFrontendParameters() {}
        
        eDVBFrontendParameters();
        ~eDVBFrontendParameters() {}
        
-       RESULT getSystem(int &type) const;
-       RESULT getDVBS(eDVBFrontendParametersSatellite &SWIG_OUTPUT) const;
-       RESULT getDVBC(eDVBFrontendParametersCable &SWIG_OUTPUT) const;
-       RESULT getDVBT(eDVBFrontendParametersTerrestrial &SWIG_OUTPUT) const;
-
        RESULT setDVBS(const eDVBFrontendParametersSatellite &p, bool no_rotor_command_on_tune=false);
        RESULT setDVBC(const eDVBFrontendParametersCable &p);
        RESULT setDVBT(const eDVBFrontendParametersTerrestrial &p);
        RESULT setDVBS(const eDVBFrontendParametersSatellite &p, bool no_rotor_command_on_tune=false);
        RESULT setDVBC(const eDVBFrontendParametersCable &p);
        RESULT setDVBT(const eDVBFrontendParametersTerrestrial &p);
-       
-       RESULT calculateDifference(const iDVBFrontendParameters *parm, int &SWIG_OUTPUT, bool exact) const;
-       
-       RESULT getHash(unsigned long &SWIG_OUTPUT) const;
+
+#ifndef SWIG
+       RESULT getSystem(int &type) const;
+       RESULT getDVBS(eDVBFrontendParametersSatellite &) const;
+       RESULT getDVBC(eDVBFrontendParametersCable &) const;
+       RESULT getDVBT(eDVBFrontendParametersTerrestrial &) const;
+       RESULT calculateDifference(const iDVBFrontendParameters *parm, int &, bool exact) const;
+       RESULT getHash(unsigned long &) const;
+#endif
 };
 
 #ifndef SWIG
 };
 
 #ifndef SWIG
index 86aea7c..b8f47f4 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __lib_dvb_frontendparms_h
 #define __lib_dvb_frontendparms_h
 
 #ifndef __lib_dvb_frontendparms_h
 #define __lib_dvb_frontendparms_h
 
+#include <lib/python/swig.h>
+
 class SatelliteDeliverySystemDescriptor;
 class CableDeliverySystemDescriptor;
 class TerrestrialDeliverySystemDescriptor;
 class SatelliteDeliverySystemDescriptor;
 class CableDeliverySystemDescriptor;
 class TerrestrialDeliverySystemDescriptor;
@@ -10,38 +12,32 @@ struct eDVBFrontendParametersSatellite
 #ifndef SWIG
        void set(const SatelliteDeliverySystemDescriptor  &);
 #endif
 #ifndef SWIG
        void set(const SatelliteDeliverySystemDescriptor  &);
 #endif
-       struct Polarisation
-       {
+       struct Polarisation {
                enum {
                        Horizontal, Vertical, CircularLeft, CircularRight
                };
        };
                enum {
                        Horizontal, Vertical, CircularLeft, CircularRight
                };
        };
-       struct Inversion
-       {
+       struct Inversion {
                enum {
                        Off, On, Unknown
                };
        };
                enum {
                        Off, On, Unknown
                };
        };
-       struct FEC
-       {
+       struct FEC {
                enum {
                        fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, f8_9, f3_5, f4_5, f9_10, fNone=15
                };
        };
                enum {
                        fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, f8_9, f3_5, f4_5, f9_10, fNone=15
                };
        };
-       struct System
-       {
+       struct System {
                enum {
                        DVB_S, DVB_S2
                };
        };
                enum {
                        DVB_S, DVB_S2
                };
        };
-       struct Modulation
-       {
+       struct Modulation {
                enum {
                        Auto, QPSK, M8PSK, QAM_16
                };
        };
                enum {
                        Auto, QPSK, M8PSK, QAM_16
                };
        };
-       struct RollOff  // dvb-s2
-       {
+       struct RollOff {  // dvb-s2
                enum {
                        alpha_0_35, alpha_0_25, alpha_0_20, alpha_auto
                };
                enum {
                        alpha_0_35, alpha_0_25, alpha_0_20, alpha_auto
                };
@@ -50,20 +46,19 @@ struct eDVBFrontendParametersSatellite
        unsigned int frequency, symbol_rate;
        int polarisation, fec, inversion, orbital_position, system, modulation, roll_off;
 };
        unsigned int frequency, symbol_rate;
        int polarisation, fec, inversion, orbital_position, system, modulation, roll_off;
 };
+SWIG_ALLOW_OUTPUT_SIMPLE(eDVBFrontendParametersSatellite);
 
 struct eDVBFrontendParametersCable
 {
 #ifndef SWIG
        void set(const CableDeliverySystemDescriptor  &);
 #endif
 
 struct eDVBFrontendParametersCable
 {
 #ifndef SWIG
        void set(const CableDeliverySystemDescriptor  &);
 #endif
-       struct Inversion
-       {
+       struct Inversion {
                enum {
                        Off, On, Unknown
                };
        };
                enum {
                        Off, On, Unknown
                };
        };
-       struct FEC
-       {
+       struct FEC {
                enum {
                        fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, f8_9, fNone=15
                };
                enum {
                        fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, f8_9, fNone=15
                };
@@ -76,19 +71,19 @@ struct eDVBFrontendParametersCable
        unsigned int frequency, symbol_rate;
        int modulation, inversion, fec_inner;
 };
        unsigned int frequency, symbol_rate;
        int modulation, inversion, fec_inner;
 };
+SWIG_ALLOW_OUTPUT_SIMPLE(eDVBFrontendParametersCable);
 
 struct eDVBFrontendParametersTerrestrial
 {
 #ifndef SWIG
 
 struct eDVBFrontendParametersTerrestrial
 {
 #ifndef SWIG
- void set(const TerrestrialDeliverySystemDescriptor  &);
      void set(const TerrestrialDeliverySystemDescriptor  &);
 #endif
        struct Bandwidth {
                enum {
                        Bw8MHz, Bw7MHz, Bw6MHz, /*Bw5MHz,*/ BwAuto
                }; // Bw5Mhz nyi (compatibilty with enigma1)
        };
 #endif
        struct Bandwidth {
                enum {
                        Bw8MHz, Bw7MHz, Bw6MHz, /*Bw5MHz,*/ BwAuto
                }; // Bw5Mhz nyi (compatibilty with enigma1)
        };
-       struct FEC
-       {
+       struct FEC {
                enum {
                        f1_2, f2_3, f3_4, f5_6, f7_8, fAuto
                };
                enum {
                        f1_2, f2_3, f3_4, f5_6, f7_8, fAuto
                };
@@ -128,5 +123,6 @@ struct eDVBFrontendParametersTerrestrial
        int hierarchy;
        int inversion;
 };
        int hierarchy;
        int inversion;
 };
+SWIG_ALLOW_OUTPUT_SIMPLE(eDVBFrontendParametersTerrestrial);
 
 #endif
 
 #endif
index 14d6ebb..c18d242 100644 (file)
@@ -409,6 +409,7 @@ public:
        virtual RESULT calculateDifference(const iDVBFrontendParameters *parm, int &SWIG_OUTPUT, bool exact) const = 0;
        virtual RESULT getHash(unsigned long &SWIG_OUTPUT) const = 0;
 };
        virtual RESULT calculateDifference(const iDVBFrontendParameters *parm, int &SWIG_OUTPUT, bool exact) const = 0;
        virtual RESULT getHash(unsigned long &SWIG_OUTPUT) const = 0;
 };
+SWIG_TEMPLATE_TYPEDEF(ePtr<iDVBFrontendParameters>, iDVBFrontendParametersPtr);
 
 #define MAX_DISEQC_LENGTH  16
 
 
 #define MAX_DISEQC_LENGTH  16
 
@@ -509,7 +510,7 @@ public:
                state_last_instance, /* just one reference to this channel is left */
                state_release      /* channel is being shut down. */
        };
                state_last_instance, /* just one reference to this channel is left */
                state_release      /* channel is being shut down. */
        };
-       virtual RESULT getState(int &SWIG_OUTPUT)=0;
+       virtual RESULT getState(int &)=0;
 
        virtual RESULT getCurrentFrontendParameters(ePtr<iDVBFrontendParameters> &)=0;
        enum 
 
        virtual RESULT getCurrentFrontendParameters(ePtr<iDVBFrontendParameters> &)=0;
        enum 
index 3915a0c..20bb915 100644 (file)
@@ -123,13 +123,10 @@ RESULT eDVBScan::nextChannel()
        m_chid_current = eDVBChannelID();
 
        m_channel_state = iDVBChannel::state_idle;
        m_chid_current = eDVBChannelID();
 
        m_channel_state = iDVBChannel::state_idle;
+
        if (fe->tune(*m_ch_current))
        if (fe->tune(*m_ch_current))
-       {
                return nextChannel();
                return nextChannel();
-               m_event(evtFail);
-               return -EINVAL;
-       }
-               
+
        m_event(evtUpdate);
        return 0;
 }
        m_event(evtUpdate);
        return 0;
 }
@@ -782,4 +779,15 @@ RESULT eDVBScan::getFrontend(ePtr<iDVBFrontend> &fe)
                return m_channel->getFrontend(fe);
        fe = 0;
        return -1;
                return m_channel->getFrontend(fe);
        fe = 0;
        return -1;
-}
\ No newline at end of file
+}
+
+RESULT eDVBScan::getCurrentTransponder(ePtr<iDVBFrontendParameters> &tp)
+{
+       if (m_ch_current)
+       {
+               tp = m_ch_current;
+               return 0;
+       }
+       tp = 0;
+       return -1;
+}
index ab7f3b5..6dcbe70 100644 (file)
@@ -87,6 +87,7 @@ public:
        void getStats(int &transponders_done, int &transponders_total, int &services);
        void getLastServiceName(std::string &name);
        RESULT getFrontend(ePtr<iDVBFrontend> &);
        void getStats(int &transponders_done, int &transponders_total, int &services);
        void getLastServiceName(std::string &name);
        RESULT getFrontend(ePtr<iDVBFrontend> &);
+       RESULT getCurrentTransponder(ePtr<iDVBFrontendParameters> &);
 };
 
 #endif
 };
 
 #endif
index 26ce763..2406326 100644 (file)
@@ -1,4 +1,5 @@
-from enigma import eComponentScan
+from enigma import eComponentScan, iDVBFrontend
+from Components.NimManager import nimmanager as nimmgr
 
 class ServiceScan:
        
 
 class ServiceScan:
        
@@ -25,8 +26,65 @@ class ServiceScan:
                                else:
                                        self.state = self.Error
                                        self.errorcode = errcode
                                else:
                                        self.state = self.Error
                                        self.errorcode = errcode
+                               self.network.setText("")
+                               self.transponder.setText("")
                        else:
                                self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.foundServices + self.scan.getNumServices()))
                        else:
                                self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.foundServices + self.scan.getNumServices()))
+                               transponder = self.scan.getCurrentTransponder()
+                               network = ""
+                               tp_text = ""
+                               if transponder:
+                                       tp_type = transponder.getSystem()
+                                       if not tp_type[0]:
+                                               tp_type = tp_type[1]
+                                               if tp_type == iDVBFrontend.feSatellite:
+                                                       network = _("Satellite")
+                                                       tp = transponder.getDVBS()
+                                                       if not tp[0]:
+                                                               tp = tp[1]
+                                                               orb_pos = tp.orbital_position
+                                                               try:
+                                                                       sat_name = str(nimmgr.getSatDescription(orb_pos))
+                                                               except KeyError:
+                                                                       sat_name = ""
+                                                               if orb_pos > 1800: # west
+                                                                       orb_pos = 3600 - orbpos
+                                                                       h = _("W")
+                                                               else:
+                                                                       h = _("E")
+                                                               if sat_name.find("%d.%d" % (orb_pos/10, orb_pos%10)) != -1:
+                                                                       network = sat_name
+                                                               else:
+                                                                       network = ("%s %d.%d %s") % (sat_name, orb_pos / 10, orb_pos % 10, h)
+                                                               tp_text = ("%s %s %d%c / %d / %s") %( { 0 : "DVB-S", 1 : "DVB-S2" }[tp.system],
+                                                                       { 0 : "Auto", 1 : "QPSK", 2 : "M8PSK", 3 : "QAM16" }[tp.modulation],
+                                                                       tp.frequency/1000,
+                                                                       { 0 : 'H', 1 : 'V', 2 : 'L', 3 : 'R' }[tp.polarisation],
+                                                                       tp.symbol_rate/1000,
+                                                                       { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6",
+                                                                        5 : "7/8", 6 : "8/9", 7 : "3/5", 8 : "4/5", 9 : "9/10",
+                                                                        15 : "NONE" }[tp.fec] )
+                                               elif tp_type == iDVBFrontend.feCable:
+                                                       network = _("Cable")
+                                                       tp = transponder.getDVBC()
+                                                       if not tp[0]:
+                                                               tp = tp[1]
+                                                               tp_text = ("DVB-C %s %d / %d / %s") %( { 0 : "AUTO", 1 : "QAM16", 2 : "QAM32", 3 : "QAM64", 4 : "QAM128", 5 : "QAM256" }[tp.modulation],
+                                                                       tp.frequency,
+                                                                       tp.symbol_rate/1000,
+                                                                       { 0 : "AUTO", 1 : "1/2", 2 : "2/3", 3 : "3/4", 4 : "5/6", 5 : "7/8", 6 : "8/9", 15 : "NONE" }[tp.fec_inner] )
+                                               elif tp_type == iDVBFrontend.feTerrestrial:
+                                                       network = _("Terrestrial")
+                                                       tp = transponder.getDVBT()
+                                                       if not tp[0]:
+                                                               tp = tp[1]
+                                                               tp_text = ("DVB-T %s %d / %d") %( { 0 : "QPSK", 1 : "QAM16", 2 : "QAM64", 3 : "AUTO"}[tp.modulation],
+                                                                       tp.frequency,
+                                                                       tp.symbol_rate/1000)
+                                               else:
+                                                       print "unknown transponder type in scanStatusChanged"
+                               self.network.setText(network)
+                               self.transponder.setText(tp_text)
                
                if self.state == self.Done:
                        if self.scan.getNumServices() == 1:
                
                if self.state == self.Done:
                        if self.scan.getNumServices() == 1:
@@ -46,7 +104,7 @@ class ServiceScan:
                                self.run += 1
                                self.execBegin()
        
                                self.run += 1
                                self.execBegin()
        
-       def __init__(self, progressbar, text, servicelist, passNumber, scanList, frontendInfo):
+       def __init__(self, progressbar, text, servicelist, passNumber, scanList, network, transponder, frontendInfo):
                self.foundServices = 0
                self.progressbar = progressbar
                self.text = text
                self.foundServices = 0
                self.progressbar = progressbar
                self.text = text
@@ -54,6 +112,8 @@ class ServiceScan:
                self.passNumber = passNumber
                self.scanList = scanList
                self.frontendInfo = frontendInfo
                self.passNumber = passNumber
                self.scanList = scanList
                self.frontendInfo = frontendInfo
+               self.transponder = transponder
+               self.network = network
                self.run = 0
 
        def doRun(self):
                self.run = 0
 
        def doRun(self):
index a529e71..3b1d780 100644 (file)
@@ -22,10 +22,13 @@ class ServiceScan(Screen):
                
                self["scan_progress"] = ProgressBar()
                self["scan_state"] = Label(_("scan state"))
                
                self["scan_progress"] = ProgressBar()
                self["scan_state"] = Label(_("scan state"))
+               self["network"] = Label()
+               self["transponder"] = Label()
+
                self["pass"] = Label("")
                self["servicelist"] = FIFOList(len=7)
                self["FrontendInfo"] = FrontendInfo()
                self["pass"] = Label("")
                self["servicelist"] = FIFOList(len=7)
                self["FrontendInfo"] = FrontendInfo()
-               self["scan"] = CScan(self["scan_progress"], self["scan_state"], self["servicelist"], self["pass"], scanList, self["FrontendInfo"])
+               self["scan"] = CScan(self["scan_progress"], self["scan_state"], self["servicelist"], self["pass"], scanList, self["network"], self["transponder"], self["FrontendInfo"])
 
                self["actions"] = ActionMap(["OkCancelActions"], 
                        {
 
                self["actions"] = ActionMap(["OkCancelActions"], 
                        {
index 9c4c013..e19f456 100644 (file)
@@ -75,13 +75,13 @@ is usually caused by not marking PSignals as immutable.
 #include <lib/gdi/gfont.h>
 #include <lib/gdi/epng.h>
 #include <lib/dvb/db.h>
 #include <lib/gdi/gfont.h>
 #include <lib/gdi/epng.h>
 #include <lib/dvb/db.h>
+#include <lib/dvb/frontendparms.h>
 #include <lib/dvb/idvb.h>
 #include <lib/dvb/dvb.h>
 #include <lib/dvb/frontend.h>
 #include <lib/dvb/volume.h>
 #include <lib/dvb/sec.h>
 #include <lib/dvb/epgcache.h>
 #include <lib/dvb/idvb.h>
 #include <lib/dvb/dvb.h>
 #include <lib/dvb/frontend.h>
 #include <lib/dvb/volume.h>
 #include <lib/dvb/sec.h>
 #include <lib/dvb/epgcache.h>
-#include <lib/dvb/frontendparms.h>
 #include <lib/dvb/dvbtime.h>
 #include <lib/dvb/pmt.h>
 #include <lib/components/scan.h>
 #include <lib/dvb/dvbtime.h>
 #include <lib/dvb/pmt.h>
 #include <lib/components/scan.h>