da71b183b1731f1ac124c4203ec0880e143d9cb9
[senf.git] / 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 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief DVBFrontendHandle public header */
25
26 #ifndef HH_DVBFrontendHandle_
27 #define HH_DVBFrontendHandle_ 1
28
29 // Custom includes
30 #include <boost/cstdint.hpp>
31 #include <linux/dvb/frontend.h>
32 #include "../../../Socket/FramingPolicy.hh"
33 #include "../../../Socket/CommunicationPolicy.hh"
34 #include "../../../Socket/ReadWritePolicy.hh"
35 #include "../../../Socket/ProtocolClientSocketHandle.hh"
36 #include "../../../Socket/SocketProtocol.hh"
37
38 //#include "DVBFrontendHandle.mpp"
39 ///////////////////////////////hh.p////////////////////////////////////////
40
41 namespace senf {
42
43     /// \addtogroup concrete_protocol_group
44     /// @{
45
46     typedef MakeSocketPolicy<
47         NoAddressingPolicy,
48         DatagramFramingPolicy,
49         UnconnectedCommunicationPolicy,
50         NotReadablePolicy,
51         NotWriteablePolicy
52         >::policy DVBFrontend_Policy;   ///< Socket Policy for DVBFrontendSocketProtocol
53
54     /** \brief SocketProtocol for the dvb frontend device
55
56         The DVB frontend device controls the tuner and DVB demodulator hardware.
57      */
58     class DVBFrontendSocketProtocol
59         : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
60     {
61     public:
62         ///////////////////////////////////////////////////////////////////////////
63         // internal interface
64
65         ///\name Constructors
66         ///@{
67
68         void init_client(boost::uint8_t adapter=0, boost::uint8_t device=0) const;
69                                         ///< Opens the specified frontend device in read-only mode.
70                                         /**< \note This member is implicitly called from the
71                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
72                                              constructor */
73
74         ///@}
75         ///\name Abstract Interface Implementation
76         ///@{
77
78         unsigned available() const;     ///< Returns always <tt>0</tt>
79                                         /**< Returns always <tt>0</tt>, since the DVB frontend
80                                              socket is not readable. */
81         bool eof() const;               ///< Returns always <tt>false</tt>
82                                         /**< Returns always <tt>false</tt>, since the DVB frontend
83                                              socket does not support the notion of EOF. */
84
85         ///@}
86
87         int16_t signalStrength() const; ///< Returns current signal strength
88                                         /**< Returns the signal strength value for the signal
89                                              currently received by the front-end. For this method,
90                                              read-only access to the device is sufficient.*/
91
92         int16_t signalNoiseRatio() const;
93                                         ///< Returns current signal-to-noise ratio
94                                         /**< Returns the signal-to-noise ratio for the signal
95                                              currently received by the front-end. For this method,
96                                              read-only access to the device is sufficient. */
97
98         uint32_t bitErrorRate() const;  ///< Returns the current bit error rate for the signal
99                                         /**< Returns the bit error rate for the signal currently
100                                              received/demodulated by the front-end. For this method,
101                                              read-only access to the device is sufficient. */
102     };
103
104     typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
105
106     ///@}
107 }
108
109
110 ///////////////////////////////hh.e////////////////////////////////////////
111 //#include "DVBFrontendHandle.cci"
112 //#include "DVBFrontendHandle.ct"
113 //#include "DVBFrontendHandle.cti"
114 #endif
115
116
117 // Local Variables:
118 // mode: c++
119 // fill-column: 100
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"
124 // comment-column: 40
125 // End: