add support for read signal quality, power and biterror rate from python
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 3 Dec 2005 21:16:59 +0000 (21:16 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 3 Dec 2005 21:16:59 +0000 (21:16 +0000)
lib/dvb/frontend.cpp
lib/dvb/frontend.h
lib/dvb/idvb.h
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h

index 8d035bfa86b37fe6376d43607df7bca116ff4933..a26f6bd85b36dffacf0246b57c34ba91f40230ac 100644 (file)
@@ -376,6 +376,35 @@ void eDVBFrontend::timeout()
                m_tuning = 0;
 }
 
                m_tuning = 0;
 }
 
+int eDVBFrontend::readFrontendData(int type)
+{
+       switch(type)
+       {
+               case bitErrorRate:
+               {
+                       uint32_t ber=0;
+                       if (ioctl(m_fd, FE_READ_BER, &ber) < 0 && errno != ERANGE)
+                               eDebug("FE_READ_BER failed (%m)");
+                       return ber;
+               }
+               case signalPower:
+               {
+                       uint16_t snr=0;
+                       if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
+                               eDebug("FE_READ_SNR failed (%m)");
+                       return snr;
+               }
+               case signalQuality:
+               {
+                       uint16_t strength=0;
+                       if (ioctl(m_fd, FE_READ_SIGNAL_STRENGTH, &strength) < 0 && errno != ERANGE)
+                               eDebug("FE_READ_SIGNAL_STRENGTH failed (%m)");
+                       return strength;
+               }
+       }
+       return 0;
+}
+
 #ifndef FP_IOCTL_GET_ID
 #define FP_IOCTL_GET_ID 0
 #endif
 #ifndef FP_IOCTL_GET_ID
 #define FP_IOCTL_GET_ID 0
 #endif
index d06da32a58b4592a13925d0c887266e576b56425..8da0829c84ba30cc7731b58297940d1c80ecf9cf 100644 (file)
@@ -91,7 +91,9 @@ public:
        RESULT setSecSequence(const eSecCommandList &list);
        RESULT getData(int num, int &data);
        RESULT setData(int num, int val);
        RESULT setSecSequence(const eSecCommandList &list);
        RESULT getData(int num, int &data);
        RESULT setData(int num, int val);
-       
+
+       int readFrontendData(int type); // bitErrorRate, signalPower, signalQuality
+
        int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
        
        int getID() { return m_fe; }
        int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
        
        int getID() { return m_fe; }
index a14e0af5a59cf623f44a9f98ffd2ea1a55627085..22eccbd9ecc77486a3ab7d5bebe7b77ae88334ca 100644 (file)
@@ -344,6 +344,12 @@ public:
        virtual RESULT sendToneburst(int burst)=0;
        virtual RESULT setSEC(iDVBSatelliteEquipmentControl *sec)=0;
        virtual RESULT setSecSequence(const eSecCommandList &list)=0;
        virtual RESULT sendToneburst(int burst)=0;
        virtual RESULT setSEC(iDVBSatelliteEquipmentControl *sec)=0;
        virtual RESULT setSecSequence(const eSecCommandList &list)=0;
+
+       enum {
+               bitErrorRate, signalPower, signalQuality
+       };
+       virtual int readFrontendData(int type)=0;
+
        virtual RESULT getData(int num, int &data)=0;
        virtual RESULT setData(int num, int val)=0;
        
        virtual RESULT getData(int num, int &data)=0;
        virtual RESULT setData(int num, int val)=0;
        
index 232e66f2872fbae8749d3e7d38abec4dfd291455..dfd066934099ce8694589a62c2538c3365998fdc 100644 (file)
@@ -224,6 +224,19 @@ public:
 
 TEMPLATE_TYPEDEF(ePtr<iServiceInformation>, iServiceInformationPtr);
 
 
 TEMPLATE_TYPEDEF(ePtr<iServiceInformation>, iServiceInformationPtr);
 
+class iFrontendStatusInformation: public iObject
+{
+public:
+       enum {
+               bitErrorRate,
+               signalPower,
+               signalQuality
+       };
+       virtual int getFrontendInfo(int w)=0;
+};
+
+TEMPLATE_TYPEDEF(ePtr<iFrontendStatusInformation>, iFrontendStatusInformationPtr);
+
 class iPauseableService: public iObject
 {
 public:
 class iPauseableService: public iObject
 {
 public:
@@ -287,6 +300,7 @@ public:
        virtual SWIG_VOID(RESULT) pause(ePtr<iPauseableService> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) info(ePtr<iServiceInformation> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) audioTracks(ePtr<iAudioTrackSelection> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) pause(ePtr<iPauseableService> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) info(ePtr<iServiceInformation> &SWIG_OUTPUT)=0;
        virtual SWIG_VOID(RESULT) audioTracks(ePtr<iAudioTrackSelection> &SWIG_OUTPUT)=0;
+       virtual SWIG_VOID(RESULT) frontendStatusInfo(ePtr<iFrontendStatusInformation> &SWIG_OUTPUT)=0;
 };
 
 TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
 };
 
 TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
index 96f942abfd15a837c7214095a3d25318b3cc72b0..9e77a7a7a33ecf7310c8152fe78f457e489dd8fd 100644 (file)
@@ -681,6 +681,12 @@ RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
        return pvr_channel->getCurrentPosition(demux, pos);
 }
 
        return pvr_channel->getCurrentPosition(demux, pos);
 }
 
+RESULT eDVBServicePlay::frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr)
+{
+       ptr = this;
+       return 0;
+}
+
 RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr)
 {
        ptr = this;
 RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr)
 {
        ptr = this;
@@ -811,6 +817,17 @@ int eDVBServicePlay::selectAudioStream(int i)
        return 0;
 }
 
        return 0;
 }
 
+int eDVBServicePlay::getFrontendInfo(int w)
+{
+       eUsePtr<iDVBChannel> channel;
+       if(m_service_handler.getChannel(channel))
+               return 0;
+       ePtr<iDVBFrontend> fe;
+       if(channel->getFrontend(fe))
+               return 0;
+       return fe->readFrontendData(w);
+}
+
 DEFINE_REF(eDVBServicePlay)
 
 eAutoInitPtr<eServiceFactoryDVB> init_eServiceFactoryDVB(eAutoInitNumbers::service+1, "eServiceFactoryDVB");
 DEFINE_REF(eDVBServicePlay)
 
 eAutoInitPtr<eServiceFactoryDVB> init_eServiceFactoryDVB(eAutoInitNumbers::service+1, "eServiceFactoryDVB");
index 44d920f8d9ef771c9f919ead65e63c046bf8cad4..4b6ef3e14b724ff46701fa97ce902232f3be9162 100644 (file)
@@ -54,7 +54,7 @@ private:
 
 class eDVBServicePlay: public iPlayableService, public iPauseableService, 
                public iSeekableService, public Object, public iServiceInformation, 
 
 class eDVBServicePlay: public iPlayableService, public iPauseableService, 
                public iSeekableService, public Object, public iServiceInformation, 
-               public iAudioTrackSelection
+               public iAudioTrackSelection, public iFrontendStatusInformation
 {
 DECLARE_REF(eDVBServicePlay);
 public:
 {
 DECLARE_REF(eDVBServicePlay);
 public:
@@ -68,6 +68,7 @@ public:
        RESULT pause(ePtr<iPauseableService> &ptr);
        RESULT info(ePtr<iServiceInformation> &ptr);
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
        RESULT pause(ePtr<iPauseableService> &ptr);
        RESULT info(ePtr<iServiceInformation> &ptr);
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
+       RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
        
                // iPauseableService
        RESULT pause();
        
                // iPauseableService
        RESULT pause();
@@ -90,6 +91,9 @@ public:
        RESULT selectTrack(unsigned int i);
        RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
 
        RESULT selectTrack(unsigned int i);
        RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
 
+               // iFrontendStatusInformation
+       int getFrontendInfo(int w);
+
 private:
        friend class eServiceFactoryDVB;
        eServiceReference m_reference;
 private:
        friend class eServiceFactoryDVB;
        eServiceReference m_reference;
index dc038a852eb4d0259cc871b6a041b9d2b7cd6812..8f9994713798ac7e1fc0f2c6643ef32e56aa3a46 100644 (file)
@@ -149,6 +149,7 @@ RESULT eServiceMP3::stop()
 RESULT eServiceMP3::pause(ePtr<iPauseableService> &ptr) { ptr=this; return 0; }
 RESULT eServiceMP3::seek(ePtr<iSeekableService> &ptr) { ptr = 0; return -1; }
 
 RESULT eServiceMP3::pause(ePtr<iPauseableService> &ptr) { ptr=this; return 0; }
 RESULT eServiceMP3::seek(ePtr<iSeekableService> &ptr) { ptr = 0; return -1; }
 
+RESULT eServiceMP3::frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr) { ptr = 0; return -1; }
 RESULT eServiceMP3::audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; };
 
                // iPausableService
 RESULT eServiceMP3::audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; };
 
                // iPausableService
index bf18e92b60f7b6100dd8cb41ba31a376a538d82a..9f1a8e9fc6a4706c1d071d429aa86510c80c37df 100644 (file)
@@ -58,6 +58,7 @@ public:
        RESULT pause(ePtr<iPauseableService> &ptr);
        RESULT seek(ePtr<iSeekableService> &ptr);
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
        RESULT pause(ePtr<iPauseableService> &ptr);
        RESULT seek(ePtr<iSeekableService> &ptr);
        RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
+       RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
 
                // iPausableService
        RESULT pause();
 
                // iPausableService
        RESULT pause();