DVBFrontendHandle.hh

Go to the documentation of this file.
00001 // $Id: DVBFrontendHandle.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Thorsten Horstmann <tho@berlios.de>
00007 //     Anton Gillert <atx@berlios.de>
00008 //
00009 // This program is free software; you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation; either version 2 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the
00021 // Free Software Foundation, Inc.,
00022 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 
00027 #ifndef HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_
00028 #define HH_SENF_Socket_Protocols_DVB_DVBFrontendHandle_ 1
00029 
00030 // Custom includes
00031 #include <boost/cstdint.hpp>
00032 #include <boost/bind.hpp>
00033 #include <boost/function.hpp>
00034 #include <linux/dvb/frontend.h>
00035 #include <senf/Socket/FramingPolicy.hh>
00036 #include <senf/Socket/CommunicationPolicy.hh>
00037 #include <senf/Socket/ReadWritePolicy.hh>
00038 #include <senf/Socket/ProtocolClientSocketHandle.hh>
00039 #include <senf/Socket/SocketProtocol.hh>
00040 #include <fcntl.h>
00041 //#include "DVBFrontendHandle.mpp"
00042 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00043 
00044 namespace senf {
00045 
00047     //\{
00048 
00049     typedef MakeSocketPolicy<
00050         NoAddressingPolicy,
00051         DatagramFramingPolicy,
00052         UnconnectedCommunicationPolicy,
00053         NotReadablePolicy,
00054         NotWriteablePolicy
00055 >    ::policy DVBFrontend_Policy; 
00056 
00057 
00071     class DVBFrontendSocketProtocol
00072         : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
00073     {
00074     private:
00075         void tune(const struct dvb_frontend_parameters & frontend) const;
00076     public:
00077 
00078 
00079         //-////////////////////////////////////////////////////////////////////////
00080         // internal interface
00081 
00083         //\{
00084         void init_client(unsigned short adapter = 0, unsigned short device = 0, int flags = (O_RDWR | O_NONBLOCK) ) const;
00086 
00090         //\}
00091 
00092         void setNonBlock(bool on = true) const;
00093 
00094         void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) const;
00096 
00097         void tuneDVB_T(unsigned int frequency,
00098                 fe_spectral_inversion_t inversion,
00099                 fe_bandwidth_t bandwidth,
00100                 fe_code_rate_t code_rate_HP, /* high priority stream code rate */
00101                 fe_code_rate_t code_rate_LP, /* low priority stream code rate */
00102                 fe_modulation_t constellation, /* modulation type (see above) */
00103                 fe_transmit_mode_t transmission_mode,
00104                 fe_guard_interval_t guard_interval,
00105                 fe_hierarchy_t hierarchy_information
00106                 ) const;                                                
00107 
00108         void tuneDVB_C(unsigned int frequency,
00109                 fe_spectral_inversion_t inversion,
00110                 unsigned int symbol_rate,
00111                 fe_code_rate_t fec_inner,
00112                 fe_modulation_t modulation
00113                 ) const;
00115 
00116         dvb_frontend_info getInfo() const;                              
00117 
00119         struct dvb_frontend_parameters getFrontendParam() const;        
00120 
00122 
00123         //\{
00124 
00125         dvb_frontend_event getEvent() const;
00126 
00127 
00128         unsigned available() const;     
00129 
00131         bool eof() const;               
00132 
00135         //\}
00136 
00137         int16_t signalStrength() const; 
00138 
00142         int16_t signalNoiseRatio() const;
00144 
00148         uint32_t bitErrorRate() const;  
00149 
00152         uint32_t uncorrectedBlocks() const; 
00153 
00161         fe_status_t status() const;         
00162 
00166     };
00167 
00168     typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
00169 
00170     //\}
00171 }
00172 
00173 
00174 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00175 //#include "DVBFrontendHandle.cci"
00176 //#include "DVBFrontendHandle.ct"
00177 //#include "DVBFrontendHandle.cti"
00178 #endif
00179 
00180 
00181 // Local Variables:
00182 // mode: c++
00183 // fill-column: 100
00184 // c-file-style: "senf"
00185 // indent-tabs-mode: nil
00186 // ispell-local-dictionary: "american"
00187 // compile-command: "scons -u test"
00188 // comment-column: 40
00189 // End: