From: tho Date: Mon, 16 Feb 2009 13:36:59 +0000 (+0000) Subject: DVBSocketController: some code convention clean ups X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=2cca421d9047b07c5789b32694c45c789d9c153d;p=senf.git DVBSocketController: some code convention clean ups git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1119 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/DVB/DVBSocketController.cc b/Socket/Protocols/DVB/DVBSocketController.cc index 942f153..1a5cda5 100644 --- a/Socket/Protocols/DVB/DVBSocketController.cc +++ b/Socket/Protocols/DVB/DVBSocketController.cc @@ -20,26 +20,30 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + \brief DVBSocketController non-inline non-template implementation */ +#include "DVBSocketController.hh" + +// Custom includes +#include #include "senf/Utils/Exception.hh" #include "senf/Utils/Logger/Logger.hh" #include "senf/Utils/membind.hh" -#include "DVBSocketController.hh" -#include -using namespace std; #define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// +using namespace std; - -senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_, DVBDemuxSectionHandle sectionHandle_ , const Callback & cb_) : - dir( this ), - frontendHandle( frontendHandle_ ), - sectionHandle( sectionHandle_ ), - type( frontendHandle.protocol().getInfo().type ), - parser( type ), - cb( cb_ ), - event( "senf::DVBSocketController::readEvent", senf::membind(&DVBSocketController::readEvent, this), frontendHandle, senf::scheduler::FdEvent::EV_PRIO, false ) +senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_, DVBDemuxSectionHandle sectionHandle_ , const Callback & cb_) + : dir( this ), + frontendHandle( frontendHandle_ ), + sectionHandle( sectionHandle_ ), + type( frontendHandle.protocol().getInfo().type ), + parser( type ), + cb( cb_ ), + event( "senf::DVBSocketController::readEvent", senf::membind(&DVBSocketController::readEvent, this), frontendHandle, senf::scheduler::FdEvent::EV_PRIO, false ) { initConsole(); } @@ -47,10 +51,11 @@ senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_ prefix_ senf::DVBSocketController::~DVBSocketController() { } -prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const string & mode){ + +prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const string & mode) +{ struct dvb_frontend_parameters frontend; - - + // no valid configline, so it will be treaten like a channel name if (input.find(":")==string::npos){ if (mode.c_str()[0]=='a') @@ -61,7 +66,7 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st } // add psydo name "foo" to complete configline syntax frontend = parser.getFrontendParam("foo:"+input); - + if (mode.c_str()[0]=='a'){ switch (type) { case FE_QPSK: @@ -97,9 +102,9 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st prefix_ void senf::DVBSocketController::tuneTo(const string & channel) { struct dvb_frontend_parameters frontend; - + string configLine = parser.getConfigLine(channel); - + frontend = parser.getFrontendParam(configLine); switch (type) { case FE_QPSK: @@ -113,61 +118,62 @@ prefix_ void senf::DVBSocketController::tuneTo(const string & channel) break; default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); - } + } } -prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, +prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, fe_spectral_inversion_t inversion, - fe_bandwidth_t bandwidth, + fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ fe_code_rate_t code_rate_LP, /* low priority stream code rate */ fe_modulation_t constellation, /* modulation type (see above) */ - fe_transmit_mode_t transmission_mode, + fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, fe_hierarchy_t hierarchy_information ) { if(type != FE_OFDM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; - + event.enable(); - + frontendHandle.protocol().setNonBlock(); - frontendHandle.protocol().tuneDVB_T(frequency, - inversion, - bandwidth, - code_rate_HP, - code_rate_LP, - constellation, - transmission_mode, - guard_interval, + frontendHandle.protocol().tuneDVB_T(frequency, + inversion, + bandwidth, + code_rate_HP, + code_rate_LP, + constellation, + transmission_mode, + guard_interval, hierarchy_information); } -prefix_ void senf::DVBSocketController::tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate){ +prefix_ void senf::DVBSocketController::tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) +{ if(type != FE_QPSK) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; - + event.enable(); - + frontendHandle.protocol().setNonBlock(); frontendHandle.protocol().tuneDVB_S(frequency, inversion, symbole_rate, code_rate); } -prefix_ void senf::DVBSocketController::tuneDVB_C(unsigned int frequency, +prefix_ void senf::DVBSocketController::tuneDVB_C(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, fe_code_rate_t fec_inner, fe_modulation_t modulation ) -{ +{ if(type != FE_QAM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; - + event.enable(); - + frontendHandle.protocol().setNonBlock(); - + frontendHandle.protocol().tuneDVB_C(frequency, inversion, symbol_rate, fec_inner, modulation); } @@ -176,7 +182,7 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneTo_sync(const string & struct dvb_frontend_parameters frontend; dvb_frontend_event ev; string configLine = parser.getConfigLine(channel); - + frontend = parser.getFrontendParam(configLine); switch (type) { case FE_QPSK: @@ -194,69 +200,69 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneTo_sync(const string & return ev; } -prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_T_sync(unsigned int frequency, +prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_T_sync(unsigned int frequency, fe_spectral_inversion_t inversion, - fe_bandwidth_t bandwidth, + fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ fe_code_rate_t code_rate_LP, /* low priority stream code rate */ fe_modulation_t constellation, /* modulation type (see above) */ - fe_transmit_mode_t transmission_mode, + fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, fe_hierarchy_t hierarchy_information ) { if(type != FE_OFDM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; - + event.disable(); - + frontendHandle.protocol().setNonBlock(false); - - frontendHandle.protocol().tuneDVB_T(frequency, - inversion, - bandwidth, - code_rate_HP, - code_rate_LP, - constellation, - transmission_mode, - guard_interval, + + frontendHandle.protocol().tuneDVB_T(frequency, + inversion, + bandwidth, + code_rate_HP, + code_rate_LP, + constellation, + transmission_mode, + guard_interval, hierarchy_information); - + if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); - + return frontendHandle.protocol().getEvent(); } prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_S_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate){ if(type != FE_QPSK) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; - + event.disable(); - + frontendHandle.protocol().setNonBlock(false); - + frontendHandle.protocol().tuneDVB_S(frequency, inversion, symbole_rate, code_rate); - + if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); return frontendHandle.protocol().getEvent(); } -prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned int frequency, +prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, fe_code_rate_t fec_inner, fe_modulation_t modulation ) -{ +{ if(type != FE_QAM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; - + event.disable(); - + frontendHandle.protocol().setNonBlock(false); - + frontendHandle.protocol().tuneDVB_C(frequency, inversion, symbol_rate, fec_inner, modulation); if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); @@ -265,7 +271,8 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned in } -prefix_ string senf::DVBSocketController::getTypeString(){ +prefix_ string senf::DVBSocketController::getTypeString() +{ switch (type) { case FE_QPSK: return "DVB-S"; @@ -276,24 +283,28 @@ prefix_ string senf::DVBSocketController::getTypeString(){ default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); } - } -prefix_ unsigned int senf::DVBSocketController::bitErrorRate(){ + +prefix_ unsigned int senf::DVBSocketController::bitErrorRate() +{ return frontendHandle.protocol().bitErrorRate(); } -prefix_ unsigned int senf::DVBSocketController::signalToNoiseRatio(){ +prefix_ unsigned int senf::DVBSocketController::signalToNoiseRatio() +{ return frontendHandle.protocol().signalNoiseRatio(); } -prefix_ unsigned int senf::DVBSocketController::signalStrength(){ +prefix_ unsigned int senf::DVBSocketController::signalStrength() +{ return frontendHandle.protocol().signalStrength(); } -prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf){ +prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf) +{ const char* cConf = conf.c_str(); stringstream info; - + fe_status_t status; frontendHandle.protocol().setNonBlock(false); uint16_t snr, signal; @@ -303,9 +314,9 @@ prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf){ signal = frontendHandle.protocol().signalStrength(); ber = frontendHandle.protocol().bitErrorRate(); uncorrected_blocks = frontendHandle.protocol().uncorrectedBlocks(); - + info << hex; - + for(unsigned int i = 0; i < conf.size(); ++i){ if(i>0) info << " | "; @@ -313,7 +324,7 @@ prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf){ case 'S' : info << "signal " << signal; break; - case 's' : + case 's' : info << "snr " << snr; break; case 'b' : @@ -331,10 +342,12 @@ prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf){ } return info.str(); } -prefix_ string senf::DVBSocketController::status2String(fe_status_t status){ - string s(""); + +prefix_ string senf::DVBSocketController::status2String(fe_status_t status) +{ + string s(""); if (status & FE_HAS_LOCK) - return s += "HAS LOCK"; + return s += "HAS LOCK"; if (status & FE_HAS_CARRIER) s += "HAS CARRIER "; if (status & FE_HAS_VITERBI) @@ -351,15 +364,15 @@ prefix_ string senf::DVBSocketController::status2String(fe_status_t status){ return s; } -prefix_ void senf::DVBSocketController::setSectionFilter(unsigned short int pid, +prefix_ void senf::DVBSocketController::setSectionFilter(unsigned short int pid, u_int8_t filter, - unsigned int flags, - u_int8_t mask, + unsigned int flags, + u_int8_t mask, u_int8_t mode, unsigned int timeout) { sectionHandle.protocol().setSectionFilter(pid, timeout, flags, filter, mask, mode); - + } prefix_ void senf::DVBSocketController::setBufferSize(unsigned long size) @@ -377,23 +390,26 @@ prefix_ void senf::DVBSocketController::stopFiltering() sectionHandle.protocol().stopFiltering(); } -prefix_ fe_type_t senf::DVBSocketController::getType(){ +prefix_ fe_type_t senf::DVBSocketController::getType() +{ return type; } -prefix_ void senf::DVBSocketController::readEvent(int event){ +prefix_ void senf::DVBSocketController::readEvent(int event) +{ if(cb) cb(frontendHandle.protocol().getEvent()); } -prefix_ void senf::DVBSocketController::initConsole(){ +prefix_ void senf::DVBSocketController::initConsole() +{ // binding functions to console namespace kw = senf::console::kw; dir.doc("DVB Controller"); - + dir.add("type", &DVBSocketController::getTypeString) .doc("Shows actual type of card DVB-{T, S, C}"); - + dir.add("info", &DVBSocketController::getTuneInfo) .doc("Returns a string which shows actual tuning status.\n\ \"S\" prints signal strength (in hex)\n\ @@ -405,22 +421,22 @@ prefix_ void senf::DVBSocketController::initConsole(){ features may not be supported be your current driver implementation\n\ and could end in throwing an exception!") .arg("conf", "Ssbuf", kw::default_value = "Ssbuf"); - + dir.add("tune", &DVBSocketController::tuneToCMD) .doc("tunes to channel listet in the configfile.") .arg("channel", "channel to tune") .arg("mode", "mode \"sync\" or \"async\"", kw::default_value = "async"); - + dir.add("buffersize", &DVBSocketController::setBufferSize) .doc("Set the size of the circular buffer used for filtered data.") .arg("size", "in byte"); - + dir.add("start", &DVBSocketController::startFiltering) .doc("Starts filtering"); - + dir.add("stop", &DVBSocketController::setBufferSize) .doc("Stops filtering"); - + dir.add("filter", &DVBSocketController::setSectionFilter) .arg("pid", "pid to filter") .arg("filter", "filter", kw::default_value = 62, kw::default_doc = "0x3e") @@ -429,7 +445,10 @@ prefix_ void senf::DVBSocketController::initConsole(){ .arg("mode", "mode", kw::default_value = 0, kw::default_doc = "0x00") .arg("timeout", "timeout", kw::default_value = 0, kw::default_doc = "0x00") .doc("Sets parameters for section filter."); - + dir.add("stop", &DVBSocketController::setBufferSize) .doc("Stops filtering"); } + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ diff --git a/Socket/Protocols/DVB/DVBSocketController.hh b/Socket/Protocols/DVB/DVBSocketController.hh index 31a031a..4576515 100644 --- a/Socket/Protocols/DVB/DVBSocketController.hh +++ b/Socket/Protocols/DVB/DVBSocketController.hh @@ -21,56 +21,71 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef DVBSOCKETCONTROLLER_HH_ -#define DVBSOCKETCONTROLLER_HH_ +#ifndef HH_SENF_Socket_Protocols_DVB_DVBSocketController_ +#define HH_SENF_Socket_Protocols_DVB_DVBSocketController_ 1 -#include "DVBFrontendHandle.hh" -#include "DVBDemuxHandles.hh" // Custom includes #include #include -#include "senf/Scheduler/Scheduler.hh" +#include "DVBFrontendHandle.hh" +#include "DVBDemuxHandles.hh" #include "DVBConfigParser.hh" -#include "senf/Console.hh" +#include "../../../Scheduler/Scheduler.hh" +#include "../../../Utils/Console/Console.hh" #define MPE_TABLEID 62 namespace senf { - /** \brief Helperclass for configuration and controlling DVB devices.

- * - * The DVB API provides two methods for tuning. The first method is - * synchronous, which means e.g. "tuneTo_sync" will return when the tuning operation on the card succeed, - * no matter how long it takes. The second (preferred) method is to tune asynchronous. The call "tuneTo" will return - * immediately and (if a callback was set) call the callback when the tuning operation succeeds. - *

- * Note that you may have to take draw backs in using this API. This dues to the implementation of the DVB device driver which you or your kernel choose. - * It has shown that the completeness of implementations vary from driver to driver. - * This wrapper provides the full Frontend API which is defined by Convergence . - * You have to find out which parts of these functionality are implemented by your preferred device driver by your own. - */ + +/** \brief Helperclass for configuration and controlling DVB devices. + + The DVB API provides two methods for tuning. The first method is + synchronous, which means e.g. "tuneTo_sync" will return when the tuning operation on the card + succeed, no matter how long it takes. The second (preferred) method is to tune asynchronous. + The call "tuneTo" will return immediately and (if a callback was set) call the callback when + the tuning operation succeeds.
+ + Note that you may have to take draw backs in using this API. This dues to the implementation + of the DVB device driver which you or your kernel choose. It has shown that the completeness + of implementations vary from driver to driver. This wrapper provides the full Frontend API which + is defined by Convergence. + You have to find out which parts of these functionality are implemented by your preferred + device driver by your own. +*/ class DVBSocketController : boost::noncopyable { public: senf::console::ScopedDirectory dir; - - typedef boost::function Callback; ///< Callback which is called when an asynchronous tuning succeeds. - /**< Callback which is called when an asynchronous tuning succeeds.*/ - + + typedef boost::function Callback; + ///< Callback which is called when an asynchronous tuning succeeds. + DVBSocketController(DVBFrontendHandle frontendHandle_ = DVBFrontendHandle(0,0), DVBDemuxSectionHandle sectionHandle_ = DVBDemuxSectionHandle(0,0), const Callback & cb = NULL); ~DVBSocketController(); - void tuneToCMD( const std::string & input, const std::string & mode = "async");///< Tunes a DVB device given by the type of the DVBFrontendHandle - /**< Tunes a DVB device by a channel name or complete configuration line. This method was created for use in Senf-Console. - \param[in] input A channel name or a complete configuration line. If a channel name is given it would be searched in the config file. - \param[in] mode The mode in which it will tune "sync" or "async"*/ - void tuneTo(const std::string & channel); - ///< Tunes a DVB device to a channel - /**< Tunes a DVB device to a channel whose parameters are stored in a configfile. The method determines the type of DVB device by it self. - \param[in] channel A channel name which will be looked up in config file.*/ + void tuneToCMD( const std::string & input, const std::string & mode = "async"); + ///< Tunes a DVB device given by the type of the DVBFrontendHandle + /**< Tunes a DVB device by a channel name or complete + configuration line. This method was created for use + in the SENF-Console. + \param[in] input A channel name or a complete + configuration line. If a channel name is given + it would be searched in the config file. + \param[in] mode The mode in which it will tune + "sync" or "async"*/ + void tuneTo(const std::string & channel); + ///< Tunes a DVB device to a channel + /**< Tunes a DVB device to a channel whose parameters + are stored in a config file. The method determines + the type of DVB device by it self. + \param[in] channel A channel name which will be + looked up in config file.*/ void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate); - ///< Tunes a DVB-S device - /**< Tunes a DVB-S device in asynchronous mode and calls the callback if existing. Needs full configuration */ + ///< Tunes a DVB-S device + /**< Tunes a DVB-S device in asynchronous mode and calls + the callback if existing. Needs full configuration */ + void tuneDVB_T(unsigned int frequency, fe_spectral_inversion_t inversion, fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ @@ -78,32 +93,41 @@ public: fe_modulation_t constellation, /* modulation type (see above) */ fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, - fe_hierarchy_t hierarchy_information); ///< Tunes a DVB-T device - /**< Tunes a DVB-T device in asynchronous mode and calls the callback if existing. Needs full configuration. */ + fe_hierarchy_t hierarchy_information); + ///< Tunes a DVB-T device + /**< Tunes a DVB-T device in asynchronous mode and calls + the callback if existing. Needs full configuration. */ + 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); - ///< Tunes a DVB-C device - /**< Tunes a DVB-C device in asynchronous mode and calls the callback if existing. Needs full configuration. */ - + fe_code_rate_t fec_inner, fe_modulation_t modulation); + ///< Tunes a DVB-C device + /**< Tunes a DVB-C device in asynchronous mode and calls + the callback if existing. Needs full configuration. */ + dvb_frontend_event tuneTo_sync( const std::string & channel ); - ///< Tunes a DVB device given by the type of the DVBFrontendHandle - /**< Tunes a DVB device, given by the type of the DVBFrontendHandle, by a channel name in synchronous mode - \param[in] channel A channel name which will be looked up in config file. - \returns dvb_frontend_event - \note The member "dvb_frontend_event.status" should be correct by the - most device driver implementations. But "dvb_frontend_event.parameters" maybe not and is definitly not set by: - Cinergy T� (2.6.27), Terratec Cinergy DT USB XS Diversity (2.6.27) - */ - + ///< Tunes a DVB device given by the type of the DVBFrontendHandle + /**< Tunes a DVB device, given by the type of the + DVBFrontendHandle, by a channel name in synchronous mode + \param[in] channel A channel name which will be looked + up in config file. + \returns dvb_frontend_event + \note The member "dvb_frontend_event.status" should be + correct by the most device driver implementations. + But "dvb_frontend_event.parameters" maybe not and is + definitly not set by: Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + dvb_frontend_event tuneDVB_S_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate); - ///< Tunes a DVB-S device - /**< Tunes a DVB-S device in synchronous mode. Needs full configuration - \returns dvb_frontend_event - \note The member "dvb_frontend_event.status" should be correct by the - most device driver implementations. But "dvb_frontend_event.parameters" maybe not and is definitly not set by: - Cinergy T� (2.6.27), Terratec Cinergy DT USB XS Diversity (2.6.27) - */ + ///< Tunes a DVB-S device + /**< Tunes a DVB-S device in synchronous mode. Needs full configuration + \returns dvb_frontend_event + \note The member "dvb_frontend_event.status" should be + correct by the most device driver implementations. + But "dvb_frontend_event.parameters" maybe not and is + definitly not set by: Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + dvb_frontend_event tuneDVB_T_sync(unsigned int frequency, fe_spectral_inversion_t inversion, fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ @@ -111,79 +135,90 @@ public: fe_modulation_t constellation, /* modulation type (see above) */ fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, - fe_hierarchy_t hierarsourcechy_information); - ///< Tunes a DVB-T device - /**< Tunes a DVB-T device in synchronous mode. Needs full configuration - \returns dvb_frontend_event - \note The member "dvb_frontend_event.status" should be correct by the - most device driver implementations. But "dvb_frontend_event.parameters" maybe not and is definitly not set by: - Cinergy T� (2.6.27), Terratec Cinergy DT USB XS Diversity (2.6.27) - */ + fe_hierarchy_t hierarsourcechy_information); + ///< Tunes a DVB-T device + /**< Tunes a DVB-T device in synchronous mode. Needs full + configuration + \returns dvb_frontend_event + \note The member "dvb_frontend_event.status" should be + correct by the most device driver implementations. + But "dvb_frontend_event.parameters" maybe not and is + definitly not set by: Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + dvb_frontend_event tuneDVB_C_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, - fe_code_rate_t fec_inner, fe_modulation_t modulation); - ///< Tunes a DVB-C device - /**< Tunes a DVB-C device in synchronous mode. Needs full configuration - \returns dvb_frontend_event - \note The member "dvb_frontend_event.status" should be correct by the - most device driver implementations. But "dvb_frontend_event.parameters" maybe not and is definitly not set by: - Cinergy T� (2.6.27), Terratec Cinergy DT USB XS Diversity (2.6.27) - */ - fe_type_t getType(); ///< Returns the type of the card. The type is defined in frontend.h - - std::string getTypeString(); ///< Returns the type of the card. - /**< Returns the type of the card but human readable e.g. "DVB-S", "DVB-T" or "DVB-C"*/ - + fe_code_rate_t fec_inner, fe_modulation_t modulation); + ///< Tunes a DVB-C device + /**< Tunes a DVB-C device in synchronous mode. Needs full configuration + \returns dvb_frontend_event + \note The member "dvb_frontend_event.status" should be + correct by the most device driver implementations. + But "dvb_frontend_event.parameters" maybe not and is + definitly not set by: Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + + fe_type_t getType(); ///< Returns the type of the card. The type is defined in frontend.h + + std::string getTypeString(); ///< Returns the type of the card. + /**< Returns the type of the card but human readable e.g. + "DVB-S", "DVB-T" or "DVB-C"*/ + std::string status2String(fe_status_t status); - ///< Returns a human readable status information - /**< Returns a human readable version of fe_status_t (defined by frontend.h)*/ - - unsigned int bitErrorRate(); ///< Returns the bit error rate - /**< Returns the bit error rate. - \note This function may not be implemented by your specific driver implementation. In this case the output is random. This is true for: Cinergy T� (2.6.27), Terratec Cinergy DT USB XS Diversity (2.6.27)*/ - unsigned int signalToNoiseRatio(); - ///< Returns the signal to noise ratio - /**< Returns the signal to noise ratio - \note This function may not be implemented by your specific driver implementation. In this case the output is random.*/ - unsigned int signalStrength(); - ///< Returns the signal strength - /**< Returns the signal to noise ratio - \note This function may not be implemented by your specific driver implementation. In this case the output is random.*/ - - void setSectionFilter(unsigned short int pid, + ///< Returns a human readable status information + /**< Returns a human readable version of fe_status_t + (defined by frontend.h)*/ + + unsigned int bitErrorRate(); ///< Returns the bit error rate + /**< \note This function may not be implemented by your + specific driver implementation. In this case the + output is random. This is true for: + Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + + unsigned int signalToNoiseRatio(); ///< Returns the signal to noise ratio + /**< \note This function may not be implemented by your + specific driver implementation. In this case the + output is random. This is true for: + Cinergy T� (2.6.27), + Terratec Cinergy DT USB XS Diversity (2.6.27) */ + + unsigned int signalStrength(); ///< Returns the signal strength + /**< Returns the signal to noise ratio + \note This function may not be implemented by your + specific driver implementation. In this case the output is + random.*/ + + void setSectionFilter(unsigned short int pid, u_int8_t filter = MPE_TABLEID, unsigned int flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC, - u_int8_t mask = 0xff, + u_int8_t mask = 0xff, u_int8_t mode = 0, unsigned int timeout = 0); - ///< Set the section filter - /**< Set the section filter.*/ - - void setBufferSize(unsigned long size); - ///< Set the size of the circular buffer used for filtered data. - /**< The default size is two maximum sized sections, i.e. if this - function is not called a buffer size of 2 * 4096 bytes will - be used. - \param[in] size Size of circular buffer. */ - - void startFiltering(); - ///< Starts filtering - /**< Starts filtering.*/ - - void stopFiltering(); - ///< Stops filtering - /**< Stops filtering.*/ - - std::string getTuneInfo(const std::string & conf ="Ssbuf"); ///< Returns a string which shows actual tuning status - /**< Returns a string which shows actual tuning status. -
"S" prints signal strength (in hex) -
"s" prints singal to noise ration (in hex) -
"b" prints bit error rate (in hex) -
"u" prints uncorrected blocks (in hex) -
"f" prints readable overal status e.g. "Has Lock"
- These characters can be used to form the output. Be aware, some - features may not be supported be your current driver implementation and - could end in throwing an exception!*/ + ///< Set the section filter + + void setBufferSize(unsigned long size); + ///< Set the size of the circular buffer used for filtered data. + /**< The default size is two maximum sized sections, i.e. if + this function is not called a buffer size of 2 * 4096 + bytes will be used. + \param[in] size Size of circular buffer. */ + + void startFiltering(); ///< Starts filtering + + void stopFiltering(); ///< Stops filtering + + std::string getTuneInfo(const std::string & conf ="Ssbuf"); + ///< Returns a string which shows actual tuning status + /**<
"S" prints signal strength (in hex) +
"s" prints singal to noise ration (in hex) +
"b" prints bit error rate (in hex) +
"u" prints uncorrected blocks (in hex) +
"f" prints readable overal status e.g. "Has Lock"
+ These characters can be used to form the output. Be + aware, some features may not be supported be your + current driver implementation and could end in throwing + an exception! */ private: DVBFrontendHandle frontendHandle; senf::DVBDemuxSectionHandle sectionHandle; @@ -191,10 +226,10 @@ private: DVBConfigParser parser; Callback cb; senf::scheduler::FdEvent event; - + void readEvent(int i); void initConsole(); }; } -#endif /*DVBSOCKETCONTROLLER_HH_*/ +#endif