From 3acca767d4996b0d6de6fc41fde929727d93047a Mon Sep 17 00:00:00 2001
From: tho <tho@wiback.org>
Date: Mon, 10 Nov 2008 15:19:57 +0000
Subject: [PATCH] DVBFrontendHandle: added some methods to the protocol

---
 Socket/Protocols/DVB/DVBFrontendHandle.cc | 18 ++++++++++++++++++
 Socket/Protocols/DVB/DVBFrontendHandle.hh | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/Socket/Protocols/DVB/DVBFrontendHandle.cc b/Socket/Protocols/DVB/DVBFrontendHandle.cc
index 5a152fe4a..d13489eb7 100644
--- a/Socket/Protocols/DVB/DVBFrontendHandle.cc
+++ b/Socket/Protocols/DVB/DVBFrontendHandle.cc
@@ -73,6 +73,24 @@ prefix_ int16_t senf::DVBFrontendSocketProtocol::signalStrength()
     return strength;
 }
 
+prefix_ int16_t senf::DVBFrontendSocketProtocol::signalNoiseRatio()
+    const
+{
+    int16_t snr;
+    if (::ioctl(fd(), FE_READ_SNR, &snr) < 0)
+        SENF_THROW_SYSTEM_EXCEPTION("Could not get signal-to-noise ratio of DVB adapter.");
+    return snr;
+}
+
+prefix_ uint32_t senf::DVBFrontendSocketProtocol::bitErrorRate()
+    const
+{
+    uint32_t ber;
+    if (::ioctl(fd(), FE_READ_BER, &ber) < 0)
+        SENF_THROW_SYSTEM_EXCEPTION("Could not get bit error rate of DVB adapter.");
+    return ber;
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "DVBFrontendHandle.mpp"
diff --git a/Socket/Protocols/DVB/DVBFrontendHandle.hh b/Socket/Protocols/DVB/DVBFrontendHandle.hh
index b7c659c5f..da71b183b 100644
--- a/Socket/Protocols/DVB/DVBFrontendHandle.hh
+++ b/Socket/Protocols/DVB/DVBFrontendHandle.hh
@@ -84,9 +84,21 @@ namespace senf {
 
         ///@}
 
-        int16_t signalStrength() const; ///< Return current signal strength
+        int16_t signalStrength() const; ///< Returns current signal strength
                                         /**< Returns the signal strength value for the signal
-                                             currently received by the front-end. */
+                                             currently received by the front-end. For this method,
+                                             read-only access to the device is sufficient.*/
+
+        int16_t signalNoiseRatio() const;
+                                        ///< Returns current signal-to-noise ratio
+                                        /**< Returns the signal-to-noise ratio for the signal
+                                             currently received by the front-end. For this method,
+                                             read-only access to the device is sufficient. */
+
+        uint32_t bitErrorRate() const;  ///< Returns the current bit error rate for the signal
+                                        /**< Returns the bit error rate for the signal currently
+                                             received/demodulated by the front-end. For this method,
+                                             read-only access to the device is sufficient. */
     };
 
     typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
-- 
GitLab