DVBFrontendHandle.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_
18 #define HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_ 1
19 
20 // Custom includes
21 #include <boost/cstdint.hpp>
22 #include <boost/bind.hpp>
23 #include <boost/function.hpp>
24 #include <linux/dvb/frontend.h>
30 #include <fcntl.h>
31 //#include "DVBFrontendHandle.mpp"
32 //-/////////////////////////////////////////////////////////////////////////////////////////////////
33 
34 namespace senf {
35 
37  //\{
38 
39  typedef MakeSocketPolicy<
40  NoAddressingPolicy,
41  DatagramFramingPolicy,
42  UnconnectedCommunicationPolicy,
43  NotReadablePolicy,
44  NotWriteablePolicy
45 > ::policy DVBFrontend_Policy;
46 
47 
62  : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
63  {
64  private:
65  void tune(const struct dvb_frontend_parameters & frontend) const;
66  public:
67 
68 
69  //-////////////////////////////////////////////////////////////////////////
70  // internal interface
71 
73  //\{
74  void init_client(unsigned short adapter = 0, unsigned short device = 0, int flags = (O_RDWR | O_NONBLOCK) ) const;
76 
80  //\}
81 
82  void setNonBlock(bool on = true) const;
83 
84  void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) const;
86 
87  void tuneDVB_T(unsigned int frequency,
88  fe_spectral_inversion_t inversion,
89  fe_bandwidth_t bandwidth,
90  fe_code_rate_t code_rate_HP, /* high priority stream code rate */
91  fe_code_rate_t code_rate_LP, /* low priority stream code rate */
92  fe_modulation_t constellation, /* modulation type (see above) */
93  fe_transmit_mode_t transmission_mode,
94  fe_guard_interval_t guard_interval,
95  fe_hierarchy_t hierarchy_information
96  ) const;
97 
98  void tuneDVB_C(unsigned int frequency,
99  fe_spectral_inversion_t inversion,
100  unsigned int symbol_rate,
101  fe_code_rate_t fec_inner,
102  fe_modulation_t modulation
103  ) const;
105 
106  dvb_frontend_info getInfo() const;
107 
109  struct dvb_frontend_parameters getFrontendParam() const;
110 
112  //\{
114 
115  dvb_frontend_event getEvent() const;
116 
117 
118  unsigned available() const;
119 
121  bool eof() const;
122 
125  //\}
126 
127  int16_t signalStrength() const;
128 
132  int16_t signalNoiseRatio() const;
134 
138  uint32_t bitErrorRate() const;
139 
142  uint32_t uncorrectedBlocks() const;
143 
151  fe_status_t status() const;
152 
156  };
157 
159 
160  //\}
161 }
162 
163 
164 //-/////////////////////////////////////////////////////////////////////////////////////////////////
165 //#include "DVBFrontendHandle.cci"
166 //#include "DVBFrontendHandle.ct"
167 //#include "DVBFrontendHandle.cti"
168 #endif
169 
170 
171 // Local Variables:
172 // mode: c++
173 // fill-column: 100
174 // c-file-style: "senf"
175 // indent-tabs-mode: nil
176 // ispell-local-dictionary: "american"
177 // compile-command: "scons -u test"
178 // comment-column: 40
179 // End:
SocketProtocol for the dvb frontend device.
CommunicationPolicy public header.
uint32_t bitErrorRate() const
Returns the current bit error rate for the signal.
ProtocolClientSocketHandle public header.
ReadPolicy and WritePolicy public header.
dvb_frontend_event getEvent() const
fe_status_t status() const
This ioctl call returns status information about the front-end.
unsigned available() const
Returns always 0
void tuneDVB_T(unsigned int frequency, fe_spectral_inversion_t inversion, fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, fe_code_rate_t code_rate_LP, fe_modulation_t constellation, fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, fe_hierarchy_t hierarchy_information) const
Tunes a DVB-T device.
void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) const
Tunes a DVB-S device.
void tuneDVB_C(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, fe_code_rate_t fec_inner, fe_modulation_t modulation) const
Tunes a DVB-C device.
Concrete Socket Protocol implementation base class.
bool eof() const
Returns always false
void setNonBlock(bool on=true) const
SocketProtocol and ConcreteSocketProtocol public header.
int16_t signalNoiseRatio() const
Returns current signal-to-noise ratio.
FramingPolicy public header.
void init_client(unsigned short adapter=0, unsigned short device=0, int flags=(O_RDWR|O_NONBLOCK)) const
Opens the specified frontend device in read-only mode.
dvb_frontend_info getInfo() const
Returns information struct.
ProtocolClientSocketHandle< DVBFrontendSocketProtocol > DVBFrontendHandle
uint32_t uncorrectedBlocks() const
Returns the number of uncorrected blocks.
MakeSocketPolicy< NoAddressingPolicy, DatagramFramingPolicy, UnconnectedCommunicationPolicy, NotReadablePolicy, NotWriteablePolicy >::policy DVBFrontend_Policy
Socket Policy for DVBFrontendSocketProtocol.
int16_t signalStrength() const
Returns current signal strength.