invent proper signalPowerdB enums and use them
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 20 May 2007 23:47:19 +0000 (23:47 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 20 May 2007 23:47:19 +0000 (23:47 +0000)
lib/dvb/frontend.cpp
lib/dvb/frontend.h
lib/dvb/idvb.h
lib/python/Components/Converter/FrontendInfo.py
lib/python/Components/Sources/FrontendStatus.py
lib/service/iservice.h

index f9ca6c7..d2730a2 100644 (file)
@@ -623,8 +623,13 @@ int eDVBFrontend::readFrontendData(int type)
                        uint16_t snr=0;
                        if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
                                eDebug("FE_READ_SNR failed (%m)");
-
-#if defined(DM8000)
+                       return snr;
+               }
+               case signalPowerdB: /* this will move into the driver */
+               {
+                       uint16_t snr=0;
+                       if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
+                               eDebug("FE_READ_SNR failed (%m)");
                        unsigned int SDS_SNRE = snr << 16;
                        
                        static float SNR_COEFF[6] = {
@@ -655,8 +660,6 @@ int eDVBFrontend::readFrontendData(int type)
                        snr_in_db = fval1;
                        
                        return (int)(snr_in_db * 100.0);
-#endif
-                       return snr;
                }
                case signalQuality:
                {
@@ -1034,6 +1037,7 @@ void eDVBFrontend::getFrontendStatus(ePyObject dest)
                PutToDict(dest, "tuner_synced", readFrontendData(synced));
                PutToDict(dest, "tuner_bit_error_rate", readFrontendData(bitErrorRate));
                PutToDict(dest, "tuner_signal_power", readFrontendData(signalPower));
+               PutToDict(dest, "tuner_signal_power_db", readFrontendData(signalPowerdB));
                PutToDict(dest, "tuner_signal_quality", readFrontendData(signalQuality));
        }
 }
index cfe25d1..eb91eb7 100644 (file)
@@ -109,7 +109,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, signalPowerdB, signalQuality, locked, synced
        void getFrontendStatus(ePyObject dest);
        void getTransponderData(ePyObject dest, bool original);
        void getFrontendData(ePyObject dest);
index 0fa10bc..9c21050 100644 (file)
@@ -443,7 +443,7 @@ public:
        enum { stateIdle, stateTuning, stateFailed, stateLock, stateLostLock };
        enum { toneOff, toneOn };
        enum { voltageOff, voltage13, voltage18, voltage13_5, voltage18_5 };
-       enum { bitErrorRate, signalPower, signalQuality, locked, synced, frontendNumber };
+       enum { bitErrorRate, signalPower, signalQuality, locked, synced, frontendNumber, signalPowerdB };
 };
 
 SWIG_IGNORE(iDVBFrontend);
index bcef931..34d55be 100644 (file)
@@ -35,9 +35,9 @@ class FrontendInfo(Converter, object):
                elif self.type == self.SNR:
                        percent = self.source.snr
                elif self.type == self.SNRdB:
-                       if self.source.snr is None:
+                       if self.source.snr_db is None:
                                return "N/A"
-                       return "%3.02f dB" % (self.source.snr / 100.0)
+                       return "%3.02f dB" % (self.source.snr_db / 100.0)
                if percent is None:
                        return "N/A"
 
index 60b7010..1af03f9 100644 (file)
@@ -13,7 +13,7 @@ class FrontendStatus(Source):
                self.poll_timer.start(1000)
 
        def invalidate(self):
-               self.snr = self.agc = self.ber = self.lock = None
+               self.snr = self.agc = self.ber = self.lock = self.snr_db = None
 
        def updateFrontendStatus(self):
                status = self.getFrontendStatus()
@@ -21,6 +21,7 @@ class FrontendStatus(Source):
                        self.invalidate()
                else:
                        self.snr = status.get("tuner_signal_power")
+                       self.snr_db = status.get("tuner_signal_power_db")
                        self.agc = status.get("tuner_signal_quality")
                        self.ber = status.get("tuner_bit_error_rate")
                        self.lock = status.get("tuner_locked")
index b004273..2e88f23 100644 (file)
@@ -354,7 +354,8 @@ public:
                signalQuality,
                lockState,
                syncState,
-               frontendNumber
+               frontendNumber,
+               signalPowerdB,
        };
 };