DVBSocketController.hh
Go to the documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef HH_SENF_Socket_Protocols_DVB_DVBSocketController_
00025 #define HH_SENF_Socket_Protocols_DVB_DVBSocketController_ 1
00026
00027
00028 #include <string>
00029 #include <linux/dvb/frontend.h>
00030 #include "DVBFrontendHandle.hh"
00031 #include "DVBDemuxHandles.hh"
00032 #include "DVBConfigParser.hh"
00033 #include <senf/Scheduler/FdEvent.hh>
00034 #include <senf/Utils/Console/ScopedDirectory.hh>
00035
00037 namespace senf {
00038
00039 #define MPE_TABLEID 62
00040
00056 class DVBSocketController : boost::noncopyable
00057 {
00058 public:
00059
00060 console::ScopedDirectory<DVBSocketController> dir;
00061
00062 typedef boost::function<void (const struct dvb_frontend_event & )> Callback;
00064
00065 DVBSocketController(DVBFrontendHandle frontendHandle_ = DVBFrontendHandle(0,0), const Callback & cb = NULL);
00066 ~DVBSocketController();
00067
00068 DVBDemuxSectionHandle createDVBDemuxSectionHandle( int adapternumber=0, int demuxnumber=0, bool addToConsole=false );
00069 DVBDemuxPESHandle createDVBDemuxPESHandle( int adapternumber=0, int demuxnumber=0, bool addToConsole=false );
00070
00071 void addToConsole(DVBDemuxSectionHandle sh);
00073
00079 void addToConsole(DVBDemuxPESHandle sh);
00081
00087 void tuneToCMD(std::string const & input, std::string const & mode = "async");
00089
00097 void tuneTo(std::string const & channel);
00099
00105 void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate);
00107
00110 void tuneDVB_T(unsigned int frequency,
00111 fe_spectral_inversion_t inversion, fe_bandwidth_t bandwidth,
00112 fe_code_rate_t code_rate_HP,
00113 fe_code_rate_t code_rate_LP,
00114 fe_modulation_t constellation,
00115 fe_transmit_mode_t transmission_mode,
00116 fe_guard_interval_t guard_interval,
00117 fe_hierarchy_t hierarchy_information);
00119
00122 void tuneDVB_C(unsigned int frequency,
00123 fe_spectral_inversion_t inversion, unsigned int symbol_rate,
00124 fe_code_rate_t fec_inner, fe_modulation_t modulation);
00126
00129 dvb_frontend_event tuneTo_sync(std::string const & channel );
00131
00142 dvb_frontend_event tuneDVB_S_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate);
00144
00152 dvb_frontend_event tuneDVB_T_sync(unsigned int frequency,
00153 fe_spectral_inversion_t inversion, fe_bandwidth_t bandwidth,
00154 fe_code_rate_t code_rate_HP,
00155 fe_code_rate_t code_rate_LP,
00156 fe_modulation_t constellation,
00157 fe_transmit_mode_t transmission_mode,
00158 fe_guard_interval_t guard_interval,
00159 fe_hierarchy_t hierarsourcechy_information);
00161
00170 dvb_frontend_event tuneDVB_C_sync(unsigned int frequency,
00171 fe_spectral_inversion_t inversion, unsigned int symbol_rate,
00172 fe_code_rate_t fec_inner, fe_modulation_t modulation);
00174
00182 fe_type_t getType();
00183
00184 std::string getTypeString();
00185
00188 std::string status2String(fe_status_t status);
00190
00193 unsigned int bitErrorRate();
00194
00200 unsigned int signalToNoiseRatio();
00201
00207 unsigned int signalStrength();
00208
00213 std::string getTuneInfo(const std::string & conf ="Ssbuf");
00215
00224 private:
00225 DVBFrontendHandle frontendHandle;
00226 fe_type_t type;
00227 DVBConfigParser parser;
00228 Callback cb;
00229 static unsigned int controllerNr;
00230 unsigned int sectionNr;
00231 unsigned int pesNr;
00232 scheduler::FdEvent event;
00233 void readEvent(int i);
00234 void initConsole();
00235 };
00236
00237 }
00238
00240
00241
00242
00243 #endif