}
prefix_ senf::DVBSocketController::~DVBSocketController()
-{
-}
+{}
-prefix_ senf::DVBDemuxSectionHandle senf::DVBSocketController::createDVBDemuxSectionHandle( int adapternumber, int demuxnumber, bool addToConsole ){
+prefix_ senf::DVBDemuxSectionHandle
+senf::DVBSocketController::createDVBDemuxSectionHandle(int adapternumber, int demuxnumber,
+ bool addToConsole)
+{
DVBDemuxSectionHandle sectionHandle(adapternumber, demuxnumber);
- if(addToConsole)
+ if (addToConsole)
this->addToConsole(sectionHandle);
return sectionHandle;
}
-prefix_ senf::DVBDemuxPESHandle senf::DVBSocketController::createDVBDemuxPESHandle( int adapternumber, int demuxnumber, bool addToConsole ){
+prefix_ senf::DVBDemuxPESHandle
+senf::DVBSocketController::createDVBDemuxPESHandle(int adapternumber, int demuxnumber,
+ bool addToConsole)
+{
DVBDemuxPESHandle pesHandle(adapternumber, demuxnumber);
- if(addToConsole )
+ if (addToConsole)
this->addToConsole(pesHandle);
return pesHandle;
}
-prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxSectionHandle sh){
+prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxSectionHandle sh)
+{
boost::shared_ptr<DVBSectionProtocolWrapper> wrap(new DVBSectionProtocolWrapper(sh));
sh.protocol().addWrapper(wrap);
dir.node().add("section" + senf::str(sectionNr), wrap->dir);
sectionNr++;
}
-prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxPESHandle sh){
+
+prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxPESHandle sh)
+{
boost::shared_ptr<DVBPESProtocolWrapper> wrap(new DVBPESProtocolWrapper(sh));
sh.protocol().addWrapper(wrap);
dir.node().add("pes"+ senf::str(pesNr), wrap->dir);
struct dvb_frontend_parameters frontend;
// no valid configline, so it will be treaten like a channel name
- if (input.find(":")==string::npos){
+ if (input.find(":")==string::npos)
+ {
if (mode.c_str()[0]=='a')
tuneTo(input);
else
// add psydo name "foo" to complete configline syntax
frontend = parser.getFrontendParam("foo:"+input);
- if (mode.c_str()[0]=='a'){
+ if (mode.c_str()[0]=='a') {
switch (type) {
case FE_QPSK:
tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner);
fe_hierarchy_t hierarchy_information
)
{
- if(type != FE_OFDM)
+ if (type != FE_OFDM)
SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!";
event.enable();
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)
+ if (type != FE_QPSK)
SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!";
event.enable();
fe_modulation_t modulation
)
{
- if(type != FE_QAM)
+ if (type != FE_QAM)
SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!";
event.enable();
fe_hierarchy_t hierarchy_information
)
{
- if(type != FE_OFDM)
+ if (type != FE_OFDM)
SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!";
event.disable();
guard_interval,
hierarchy_information);
- if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2)))
+ 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)
+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().tuneDVB_S(frequency, inversion, symbole_rate, code_rate);
- if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2)))
+ if (!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2)))
SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!");
return frontendHandle.protocol().getEvent();
}
fe_modulation_t modulation
)
{
- if(type != FE_QAM)
+ 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)))
+ if (!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2)))
SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!");
return frontendHandle.protocol().getEvent();
info << hex;
- for(unsigned int i = 0; i < conf.size(); ++i){
- if(i>0)
+ for (unsigned int i = 0; i < conf.size(); ++i) {
+ if (i>0)
info << " | ";
- switch(cConf[i]){
+ switch (cConf[i]) {
case 'S' :
info << "signal " << signal;
break;
prefix_ void senf::DVBSocketController::readEvent(int event)
{
- if(cb)
+ if (cb)
cb(frontendHandle.protocol().getEvent());
}
prefix_ void senf::DVBSocketController::initConsole()
{
- // binding functions to console
+ namespace fty = senf::console::factory;
namespace kw = senf::console::kw;
+
dir.doc("DVB Controller " + controllerNr);
++controllerNr;
- 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\
- \"s\" prints singal to noise ration (in hex)\n\
- \"b\" prints bit error rate (in hex)\n\
- \"u\" prints uncorrected blocks (in hex)\n\
- \"f\" prints readable overal status e.g. \"Has Lock\"\n\n\
- These characters can be used to form the output. Be aware, some\n\
- 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("type", fty::BoundCommand(this, &DVBSocketController::getTypeString)
+ .doc("Shows actual type of card DVB-{T, S, C}") );
+
+ dir.add("info", fty::BoundCommand(this, &DVBSocketController::getTuneInfo)
+ .doc("Returns a string which shows actual tuning status.\n"
+ "'S' prints signal strength (in hex)\n"
+ "'s' prints singal to noise ration (in hex)\n"
+ "'b' prints bit error rate (in hex)\n"
+ "'u' prints uncorrected blocks (in hex)\n"
+ "'f' prints readable overal status e.g. 'Has Lock'\n\n"
+ "These characters can be used to form the output. Be aware, some\n"
+ "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", fty::BoundCommand(this,&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") );
}
///////////////////////////////cc.e////////////////////////////////////////