rename iFrontendStatusInformation to iFrontendInformation
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 17 May 2006 13:14:15 +0000 (13:14 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 17 May 2006 13:14:15 +0000 (13:14 +0000)
add possibility to query the tuner number for playing and recording services

lib/dvb/frontend.cpp
lib/dvb/frontend.h
lib/dvb/idvb.h
lib/python/Components/TunerInfo.py
lib/python/Screens/ServiceInfo.py
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicedvbrecord.cpp
lib/service/servicedvbrecord.h
lib/service/servicemp3.h

index 1f1d17a..fe7c8cd 100644 (file)
@@ -588,7 +588,7 @@ int eDVBFrontend::readFrontendData(int type)
                                eDebug("FE_READ_SIGNAL_STRENGTH failed (%m)");
                        return strength;
                }
-               case Locked:
+               case locked:
                {
 #if HAVE_DVB_API_VERSION < 3
                        FrontendStatus status=0;
@@ -599,7 +599,7 @@ int eDVBFrontend::readFrontendData(int type)
                                eDebug("FE_READ_STATUS failed (%m)");
                        return !!(status&FE_HAS_LOCK);
                }
-               case Synced:
+               case synced:
                {
 #if HAVE_DVB_API_VERSION < 3
                        FrontendStatus status=0;
@@ -610,6 +610,8 @@ int eDVBFrontend::readFrontendData(int type)
                                eDebug("FE_READ_STATUS failed (%m)");
                        return !!(status&FE_HAS_SYNC);
                }
+               case frontendNumber:
+                       return m_fe;
        }
        return 0;
 }
@@ -966,8 +968,8 @@ PyObject *eDVBFrontend::readTransponderData(bool original)
                        }
                        PutToDict(ret, "tuner_state", tmp);
 
-                       PutToDict(ret, "tuner_locked", readFrontendData(Locked));
-                       PutToDict(ret, "tuner_synced", readFrontendData(Synced));
+                       PutToDict(ret, "tuner_locked", readFrontendData(locked));
+                       PutToDict(ret, "tuner_synced", readFrontendData(synced));
                        PutToDict(ret, "tuner_bit_error_rate", readFrontendData(bitErrorRate));
                        PutToDict(ret, "tuner_signal_power", readFrontendData(signalPower));
                        PutToDict(ret, "tuner_signal_quality", readFrontendData(signalQuality));
@@ -1170,7 +1172,7 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                        case eSecCommand::IF_TUNER_LOCKED_GOTO:
                        {
                                eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
-                               if (readFrontendData(Locked))
+                               if (readFrontendData(locked))
                                {
                                        eDebug("[SEC] locked step %d ok", cmd.okcount);
                                        ++cmd.okcount;
index 2c8d89e..ce40acd 100644 (file)
@@ -102,7 +102,7 @@ public:
        RESULT getData(int num, int &data);
        RESULT setData(int num, int val);
 
-       int readFrontendData(int type); // bitErrorRate, signalPower, signalQuality, Locked, Synced
+       int readFrontendData(int type); // bitErrorRate, signalPower, signalQuality, locked, synced
        PyObject *readTransponderData(bool original);
 
        int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
index dff543c..8b86866 100644 (file)
@@ -411,7 +411,7 @@ public:
        virtual RESULT setSecSequence(const eSecCommandList &list)=0;
 #endif
        enum {
-               bitErrorRate, signalPower, signalQuality, Locked, Synced
+               bitErrorRate, signalPower, signalQuality, locked, synced, frontendNumber
        };
        virtual int readFrontendData(int type)=0;
        virtual PyObject *readTransponderData(bool original)=0;
index 53cb3d9..a7e22fb 100644 (file)
@@ -1,6 +1,6 @@
 from GUIComponent import GUIComponent
 
-from enigma import eLabel, eSlider, iFrontendStatusInformation
+from enigma import eLabel, eSlider, iFrontendInformation
 
 from math import log
 
@@ -74,26 +74,26 @@ class TunerInfo(GUIComponent):
                if self.servicefkt is not None:
                        service = self.servicefkt()
                        if service is not None:
-                               feinfo = service.frontendStatusInfo()
+                               feinfo = service.frontendInfo()
                                if feinfo is not None:
                                        if what == self.SNR:
-                                               return feinfo.getFrontendInfo(iFrontendStatusInformation.signalPower)
+                                               return feinfo.getFrontendInfo(iFrontendInformation.signalPower)
                                        elif what == self.AGC:
-                                               return feinfo.getFrontendInfo(iFrontendStatusInformation.signalQuality)
+                                               return feinfo.getFrontendInfo(iFrontendInformation.signalQuality)
                                        elif what == self.BER:
-                                               return feinfo.getFrontendInfo(iFrontendStatusInformation.bitErrorRate)
+                                               return feinfo.getFrontendInfo(iFrontendInformation.bitErrorRate)
                                        elif what == self.LOCK:
-                                               return feinfo.getFrontendInfo(iFrontendStatusInformation.LockState)
+                                               return feinfo.getFrontendInfo(iFrontendInformation.lockState)
                elif self.frontendfkt is not None:
                        frontend = self.frontendfkt()
                        if what == self.SNR:
-                               return frontend.readFrontendData(iFrontendStatusInformation.signalPower)
+                               return frontend.readFrontendData(iFrontendInformation.signalPower)
                        elif what == self.AGC:
-                               return frontend.readFrontendData(iFrontendStatusInformation.signalQuality)
+                               return frontend.readFrontendData(iFrontendInformation.signalQuality)
                        elif what == self.BER:
-                               return frontend.readFrontendData(iFrontendStatusInformation.bitErrorRate)
+                               return frontend.readFrontendData(iFrontendInformation.bitErrorRate)
                        elif what == self.LOCK:
-                               return frontend.readFrontendData(iFrontendStatusInformation.LockState)
+                               return frontend.readFrontendData(iFrontendInformation.lockState)
                
                return 0
                                
index a4bb4e0..c1755d4 100644 (file)
@@ -68,7 +68,7 @@ class ServiceInfo(Screen):
                service = session.nav.getCurrentService()
                if service is not None:
                        self.info = service.info()
-                       self.feinfo = service.frontendStatusInfo()
+                       self.feinfo = service.frontendInfo()
                        print self.info.getInfoObject(iServiceInformation.sCAIDs);
                else:
                        self.info = None
index a24b8b2..ca2348c 100644 (file)
@@ -285,25 +285,26 @@ public:
 
 TEMPLATE_TYPEDEF(ePtr<iServiceInformation>, iServiceInformationPtr);
 
-class iFrontendStatusInformation: public iObject
+class iFrontendInformation: public iObject
 {
 #ifdef SWIG
-       iFrontendStatusInformation();
-       ~iFrontendStatusInformation();
+       iFrontendInformation();
+       ~iFrontendInformation();
 #endif
 public:
        enum {
                bitErrorRate,
                signalPower,
                signalQuality,
-               LockState,
-               SyncState
+               lockState,
+               syncState,
+               frontendNumber
        };
        virtual int getFrontendInfo(int w)=0;
        virtual PyObject *getFrontendData(bool original=false)=0;
 };
 
-TEMPLATE_TYPEDEF(ePtr<iFrontendStatusInformation>, iFrontendStatusInformationPtr);
+TEMPLATE_TYPEDEF(ePtr<iFrontendInformation>, iFrontendInformationPtr);
 
 class iPauseableService: public iObject
 {
@@ -475,7 +476,7 @@ public:
        virtual SWIG_VOID(RESULT) audioTracks(ePtr<iAudioTrackSelection> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) audioChannel(ePtr<iAudioChannelSelection> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) subServices(ePtr<iSubserviceList> &SWIG_OUTPUT)=0;
-       virtual SWIG_VOID(RESULT) frontendStatusInfo(ePtr<iFrontendStatusInformation> &SWIG_OUTPUT)=0;
+       virtual SWIG_VOID(RESULT) frontendInfo(ePtr<iFrontendInformation> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) timeshift(ePtr<iTimeshiftService> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) cueSheet(ePtr<iCueSheet> &SWIG_OUTPUT)=0;
 };
@@ -492,6 +493,7 @@ public:
        virtual RESULT prepare(const char *filename, time_t begTime=-1, time_t endTime=-1, int eit_event_id=-1)=0;
        virtual RESULT start()=0;
        virtual RESULT stop()=0;
+       virtual SWIG_VOID(RESULT) frontendInfo(ePtr<iFrontendInformation> &SWIG_OUTPUT)=0;
 };
 
 TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
index b99357c..928690d 100644 (file)
@@ -985,7 +985,7 @@ RESULT eDVBServicePlay::isCurrentlySeekable()
        return m_is_pvr || m_timeshift_active;
 }
 
-RESULT eDVBServicePlay::frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr)
+RESULT eDVBServicePlay::frontendInfo(ePtr<iFrontendInformation> &ptr)
 {
        ptr = this;
        return 0;
@@ -1279,10 +1279,8 @@ RESULT eDVBServicePlay::selectChannel(int i)
        }
 }
 
-int eDVBServicePlay::getFrontendInfo(int w)
+int eDVBServiceBase::getFrontendInfo(int w)
 {
-       if (m_is_pvr)
-               return 0;
        eUsePtr<iDVBChannel> channel;
        if(m_service_handler.getChannel(channel))
                return 0;
@@ -1292,7 +1290,7 @@ int eDVBServicePlay::getFrontendInfo(int w)
        return fe->readFrontendData(w);
 }
 
-PyObject *eDVBServicePlay::getFrontendData(bool original)
+PyObject *eDVBServiceBase::getFrontendData(bool original)
 {
        PyObject *ret=0;
 
index 79e8d54..da30732 100644 (file)
@@ -56,10 +56,20 @@ private:
        eBouquet *m_bouquet;
 };
 
-class eDVBServicePlay: public iPlayableService, public iPauseableService, 
+class eDVBServiceBase: public iFrontendInformation
+{
+protected:
+       eDVBServicePMTHandler m_service_handler;
+public:
+               // iFrontendInformation
+       int getFrontendInfo(int w);
+       PyObject *getFrontendData(bool);
+};
+
+class eDVBServicePlay: public eDVBServiceBase,
+               public iPlayableService, public iPauseableService, 
                public iSeekableService, public Object, public iServiceInformation, 
                public iAudioTrackSelection, public iAudioChannelSelection,
-               public iFrontendStatusInformation,
                public iSubserviceList, public iTimeshiftService,
                public iCueSheet
 {
@@ -78,7 +88,7 @@ public:
        RESULT info(ePtr<iServiceInformation> &ptr);
        RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
-       RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
+       RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
        RESULT subServices(ePtr<iSubserviceList> &ptr);
        RESULT timeshift(ePtr<iTimeshiftService> &ptr);
        RESULT cueSheet(ePtr<iCueSheet> &ptr);
@@ -113,10 +123,6 @@ public:
        int getCurrentChannel();
        RESULT selectChannel(int i);
 
-               // iFrontendStatusInformation
-       int getFrontendInfo(int w);
-       PyObject *getFrontendData(bool);
-
                // iSubserviceList
        int getNumberOfSubservices();
        RESULT getSubservice(eServiceReference &subservice, unsigned int n);
@@ -142,7 +148,7 @@ private:
        int m_is_primary;
        
                /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
-       eDVBServicePMTHandler m_service_handler, m_service_handler_timeshift;
+       eDVBServicePMTHandler m_service_handler_timeshift;
        eDVBServiceEITHandler m_event_handler;
        
        eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
index d0da074..4c41b5e 100644 (file)
@@ -276,3 +276,9 @@ int eDVBServiceRecord::doRecord()
        }
        return 0;
 }
+
+RESULT eDVBServiceRecord::frontendInfo(ePtr<iFrontendInformation> &ptr)
+{
+       ptr = this;
+       return 0;
+}
index dd00ee8..2b93b45 100644 (file)
@@ -10,7 +10,8 @@
 
 #include <lib/service/servicedvb.h>
 
-class eDVBServiceRecord: public iRecordableService, public Object
+class eDVBServiceRecord: public eDVBServiceBase,
+       public iRecordableService, public Object
 {
 DECLARE_REF(eDVBServiceRecord);
 public:
@@ -24,7 +25,6 @@ private:
        eDVBServiceRecord(const eServiceReferenceDVB &ref);
        
        eServiceReferenceDVB m_ref;
-       eDVBServicePMTHandler m_service_handler;
        void serviceEvent(int event);
        
        ePtr<iDVBTSRecorder> m_record;
@@ -36,6 +36,7 @@ private:
        
        int doPrepare();
        int doRecord();
+       RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
 };
 
 #endif
index c6a0df0..e430dce 100644 (file)
@@ -60,7 +60,7 @@ public:
                // not implemented (yet)
        RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr) { ptr = 0; return -1; }
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; }
-       RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr) { ptr = 0; return -1; }
+       RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
        RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
        RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
        RESULT cueSheet(ePtr<iCueSheet>& ptr) { ptr = 0; return -1; }