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