4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <tho@berlios.de>
7 // Anton Gillert <atx@berlios.de>
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the
21 // Free Software Foundation, Inc.,
22 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 \brief DVBFrontendHandle public header */
27 #ifndef HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_
28 #define HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_ 1
31 #include <boost/cstdint.hpp>
32 #include <boost/bind.hpp>
33 #include <boost/function.hpp>
34 #include <linux/dvb/frontend.h>
35 #include "../../../Socket/FramingPolicy.hh"
36 #include "../../../Socket/CommunicationPolicy.hh"
37 #include "../../../Socket/ReadWritePolicy.hh"
38 #include "../../../Socket/ProtocolClientSocketHandle.hh"
39 #include "../../../Socket/SocketProtocol.hh"
41 //#include "DVBFrontendHandle.mpp"
42 ///////////////////////////////hh.p////////////////////////////////////////
46 /// \addtogroup concrete_protocol_group
49 typedef MakeSocketPolicy<
51 DatagramFramingPolicy,
52 UnconnectedCommunicationPolicy,
55 > ::policy DVBFrontend_Policy; ///< Socket Policy for DVBFrontendSocketProtocol
58 /** \brief SocketProtocol for the dvb frontend device
60 The DVB frontend device controls the tuner and DVB demodulator hardware.
62 Some calls are not supported by real life drivers, known issues:
64 Cinergy T² getParameter is not supported
65 Cinergy T² in getEvent fe_status_t will be set but dvb_frontend_parameters will be stay untouched
66 Cinergy DT XS bitErrorRate is not supported
68 This dues to the lack of driver implementation. There could be restrictions also for other DVB devices!
71 class DVBFrontendSocketProtocol
72 : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
75 void tune(const struct dvb_frontend_parameters & frontend) const;
79 ///////////////////////////////////////////////////////////////////////////
84 void init_client(unsigned short adapter = 0, unsigned short device = 0, int flags = (O_RDWR | O_NONBLOCK) ) const;
85 ///< Opens the specified frontend device in read-only mode.
86 /**< \note This member is implicitly called from the
87 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
92 void setNonBlock(bool on = true) const;
94 void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) const;
95 ///< Tunes a DVB-S device
96 /**< Tunes a DVB-S device. Needs full configuration */
97 void tuneDVB_T(unsigned int frequency,
98 fe_spectral_inversion_t inversion,
99 fe_bandwidth_t bandwidth,
100 fe_code_rate_t code_rate_HP, /* high priority stream code rate */
101 fe_code_rate_t code_rate_LP, /* low priority stream code rate */
102 fe_modulation_t constellation, /* modulation type (see above) */
103 fe_transmit_mode_t transmission_mode,
104 fe_guard_interval_t guard_interval,
105 fe_hierarchy_t hierarchy_information
106 ) const; ///< Tunes a DVB-T device
107 /**< Tunes a DVB-T device. Needs full configuration */
108 void tuneDVB_C(unsigned int frequency,
109 fe_spectral_inversion_t inversion,
110 unsigned int symbol_rate,
111 fe_code_rate_t fec_inner,
112 fe_modulation_t modulation
114 ///< Tunes a DVB-C device
115 /**< Tunes a DVB-C device. Needs full configuration */
116 dvb_frontend_info getInfo() const; ///< Returns information struct.
117 /**< Returns information struct, which contains information
118 about the device which is associated with the current frontend.*/
119 struct dvb_frontend_parameters getFrontendParam() const; ///< Returns dvb_frontend_parameters struct.
120 /**< Returns dvb_frontend_parameters struct, which contains the actual
121 configuration of the device.*/
122 ///\name Abstract Interface Implementation
125 dvb_frontend_event getEvent() const;
128 unsigned available() const; ///< Returns always <tt>0</tt>
129 /**< Returns always <tt>0</tt>, since the DVB frontend
130 socket is not readable. */
131 bool eof() const; ///< Returns always <tt>false</tt>
132 /**< Returns always <tt>false</tt>, since the DVB frontend
133 socket does not support the notion of EOF. */
137 int16_t signalStrength() const; ///< Returns current signal strength
138 /**< Returns the signal strength value for the signal
139 currently received by the front-end. For this method,
140 read-only access to the device is sufficient.*/
142 int16_t signalNoiseRatio() const;
143 ///< Returns current signal-to-noise ratio
144 /**< Returns the signal-to-noise ratio for the signal
145 currently received by the front-end. For this method,
146 read-only access to the device is sufficient. */
148 uint32_t bitErrorRate() const; ///< Returns the current bit error rate for the signal
149 /**< Returns the bit error rate for the signal currently
150 received/demodulated by the front-end. For this method,
151 read-only access to the device is sufficient. */
152 uint32_t uncorrectedBlocks() const; ///< Returns the number of uncorrected blocks
153 /**< Returns the number of uncorrected blocks
154 * detected by the device driver during its lifetime.
155 * For meaningful measurements, the increment in block
156 * count during a specific time interval should be calculated.
157 * For this command, read-only access to the device is sufficient.
158 * Note that the counter will wrap to zero after its maximum count
159 * has been reached.*/
161 fe_status_t status() const; ///< This ioctl call returns status information about the front-end.
162 /**< This ioctl call returns status information about the
163 * front-end. This call only requires read-only access
168 typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
174 ///////////////////////////////hh.e////////////////////////////////////////
175 //#include "DVBFrontendHandle.cci"
176 //#include "DVBFrontendHandle.ct"
177 //#include "DVBFrontendHandle.cti"
184 // c-file-style: "senf"
185 // indent-tabs-mode: nil
186 // ispell-local-dictionary: "american"
187 // compile-command: "scons -u test"
188 // comment-column: 40