Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Socket / Protocols / DVB / DVBFrontendHandle.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
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>
8 //
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.
13 //
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.
18 //
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.
23
24 /** \file
25     \brief DVBFrontendHandle public header */
26
27 #ifndef HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_
28 #define HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_ 1
29
30 // Custom includes
31 #include <boost/cstdint.hpp>
32 #include <boost/bind.hpp>
33 #include <boost/function.hpp>
34 #include <linux/dvb/frontend.h>
35 #include <senf/Socket/FramingPolicy.hh>
36 #include <senf/Socket/CommunicationPolicy.hh>
37 #include <senf/Socket/ReadWritePolicy.hh>
38 #include <senf/Socket/ProtocolClientSocketHandle.hh>
39 #include <senf/Socket/SocketProtocol.hh>
40 #include <fcntl.h>
41 //#include "DVBFrontendHandle.mpp"
42 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43
44 namespace senf {
45
46     /// \addtogroup concrete_protocol_group
47     //\{
48
49     typedef MakeSocketPolicy<
50         NoAddressingPolicy,
51         DatagramFramingPolicy,
52         UnconnectedCommunicationPolicy,
53         NotReadablePolicy,
54         NotWriteablePolicy
55 >    ::policy DVBFrontend_Policy; ///< Socket Policy for DVBFrontendSocketProtocol
56
57
58     /** \brief SocketProtocol for the dvb frontend device
59
60         The DVB frontend device controls the tuner and DVB demodulator hardware.
61         ATTENTION!
62         Some calls are not supported by real life drivers, known issues:
63
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
67
68         This dues to the lack of driver implementation. There could be restrictions also for other DVB devices!
69      */
70
71     class DVBFrontendSocketProtocol
72         : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
73     {
74     private:
75         void tune(const struct dvb_frontend_parameters & frontend) const;
76     public:
77
78
79         //-////////////////////////////////////////////////////////////////////////
80         // internal interface
81
82         ///\name Constructors
83         //\{
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()
88                                              constructor */
89
90         //\}
91
92         void setNonBlock(bool on = true) const;
93
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
113                 ) const;
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
123         //\{
124
125         dvb_frontend_event getEvent() const;
126
127
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. */
134
135         //\}
136
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.*/
141
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. */
147
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.*/
160
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
164                                              * to the device.*/
165
166     };
167
168     typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
169
170     //\}
171 }
172
173
174 //-/////////////////////////////////////////////////////////////////////////////////////////////////
175 //#include "DVBFrontendHandle.cci"
176 //#include "DVBFrontendHandle.ct"
177 //#include "DVBFrontendHandle.cti"
178 #endif
179
180 \f
181 // Local Variables:
182 // mode: c++
183 // fill-column: 100
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
189 // End: