30 : frequency_(0), bandwidth_(8000)
36 registerFrequencyRange(500000, 750000);
44 namespace fty = console::factory;
45 consoleDir().
add(
"registerFrequencyRange", fty::Command(&HardwareDVBInterface::registerFrequencyRange,
this) );
48 prefix_ void senf::emu::HardwareDVBInterface::registerFrequencyRange(
unsigned frequencyLower,
unsigned frequencyUpper)
54 prefix_ void senf::emu::HardwareDVBInterface::v_coverageRange(
unsigned distance)
59 prefix_ unsigned senf::emu::HardwareDVBInterface::v_frequency()
65 prefix_ unsigned senf::emu::HardwareDVBInterface::v_bandwidth()
71 prefix_ void senf::emu::HardwareDVBInterface::v_frequency(
unsigned freq,
unsigned bw)
90 prefix_ senf::emu::detail::HardwareDVBSenderInterfaceNet::HardwareDVBSenderInterfaceNet(std::string
const & iface)
93 ppi::connect(forwardSwitch, sink);
100 : HardwareDVBSenderInterfaceNet(iface),
102 iface_(iface), ctrl_(iface), txPower_(0)
108 prefix_ void senf::emu::HardwareDVBSenderInterface::v_enable()
110 HardwareDVBSenderInterfaceNet::forwardSwitch.forward(
true);
113 prefix_ void senf::emu::HardwareDVBSenderInterface::v_disable()
115 HardwareDVBSenderInterfaceNet::forwardSwitch.forward(
false);
118 prefix_ bool senf::emu::HardwareDVBSenderInterface::v_enabled()
121 return HardwareDVBSenderInterfaceNet::forwardSwitch.forward();
124 prefix_ unsigned senf::emu::HardwareDVBSenderInterface::v_mtu()
130 prefix_ void senf::emu::HardwareDVBSenderInterface::v_mtu(
unsigned v)
146 prefix_ int senf::emu::HardwareDVBSenderInterface::v_txPower()
152 prefix_ void senf::emu::HardwareDVBSenderInterface::v_txPower(
int power)
169 prefix_ std::string
const & senf::emu::HardwareDVBSenderInterface::v_device()
179 prefix_ senf::emu::detail::ActiveDVBSocketSource::ActiveDVBSocketSource(Handle handle)
182 registerEvent( event_, &ActiveDVBSocketSource::read );
183 route(event_, output);
195 mpe = reader_(handle_);
212 prefix_ void senf::emu::detail::ActiveDVBSocketSource::outputMPE2Eth(
MPESection mpein)
218 if (mpein.size() != mpein->section_length() + 3) {
219 SENF_LOG((
senf::log::IMPORTANT)(
"length field value differ packet size: length=" << mpein->section_length() <<
" size=" << mpein.size() <<
"."));
221 if (mpein->crc() == mpein.parser().calcCrc()) {
222 if (mpein->llc_snap_flag()) {
238 prefix_ senf::emu::detail::DVBReceiverInterfaceAnnotator::DVBReceiverInterfaceAnnotator(
240 : interface_(interface), dvbSocketCtrl_(dvbSocketCtrl), lastSNRUpdate_(0)
242 route(
input, output);
243 input.onRequest(&DVBReceiverInterfaceAnnotator::request);
246 #define DEFAULT_DVB_NOISE -110 248 prefix_ void senf::emu::detail::DVBReceiverInterfaceAnnotator::request()
251 p.annotation<annotations::Timestamp>().fromWallClock();
252 p.annotation<annotations::Interface>().value = interface_.id();
254 snr_ = dvbSocketCtrl_.signalToNoiseRatio();
256 emu::annotations::Quality & q (p.annotation<emu::annotations::Quality>());
259 q.rssi = snr_ + q.noise;
260 q.flags.frameLength = p.size();
268 prefix_ senf::emu::detail::HardwareDVBReceiverInterfaceNet::HardwareDVBReceiverInterfaceNet()
269 : dvbSourceHandle( 0, 0),
270 dvbControlHandle( 0, 0),
271 dvbStuffingHandle( 0, 0),
272 dvbSource( dvbSourceHandle),
273 annotator(
self(),
self().dvbController)
275 ppi::connect(dvbSource, annotator);
276 ppi::connect(annotator, forwardSwitch);
279 prefix_ void senf::emu::detail::HardwareDVBReceiverInterfaceNet::initHandle()
281 dvbSourceHandle.protocol().setBufferSize( 256*4096);
282 dvbSourceHandle.protocol().setSectionFilter(
self().tsPid_);
283 dvbControlHandle.protocol().setBufferSize( 256*4096);
284 dvbControlHandle.protocol().setPESFilter(
self().stuffingPid_, DMX_IN_FRONTEND, DMX_OUT_TS_TAP, DMX_PES_OTHER, 0);
291 return *
static_cast<HardwareDVBReceiverInterface
const *
>(
this);
306 namespace fty = console::factory;
308 .onChange(
membind(&HardwareDVBReceiverInterface::tsPidChanged,
this)) );
309 consoleDir().
add(
"stuffingPID", fty::Variable(stuffingPid_));
318 prefix_ int senf::emu::HardwareDVBReceiverInterface::tsPidChanged(
int oldPid)
320 HardwareDVBReceiverInterfaceNet::initHandle();
324 prefix_ bool senf::emu::HardwareDVBReceiverInterface::v_promisc()
330 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_promisc(
bool v)
336 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_annotationMode(
bool a)
341 prefix_ bool senf::emu::HardwareDVBReceiverInterface::v_annotationMode()
347 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_mcAdd(
MACAddress const & address)
352 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_mcDrop(
MACAddress const & address)
357 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_enable()
359 HardwareDVBReceiverInterfaceNet::forwardSwitch.forward(
true);
362 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_disable()
364 HardwareDVBReceiverInterfaceNet::forwardSwitch.forward(
false);
367 prefix_ bool senf::emu::HardwareDVBReceiverInterface::v_enabled()
370 return HardwareDVBReceiverInterfaceNet::forwardSwitch.forward();
373 prefix_ void senf::emu::HardwareDVBReceiverInterface::v_id(
MACAddress const & mac)
375 ifaceIdFactory_->releaseId( id_);
385 prefix_ std::string
const & senf::emu::HardwareDVBReceiverInterface::v_device()
394 return ifaceIdFactory_;
399 ifaceIdFactory_->releaseId( id_);
400 ifaceIdFactory_ = factory;
402 id( ifaceIdFactory_->getId());
405 prefix_ void senf::emu::HardwareDVBReceiverInterface::tuneEvent(
struct dvb_frontend_event
const & ev)
420 fe_modulation_t(mod),
421 TRANSMISSION_MODE_8K,
422 fe_guard_interval_t(gi),
427 prefix_ void senf::emu::HardwareDVBReceiverInterface::tune(std::string
const & channelName)
430 struct dvb_frontend_parameters frontend (parser.getFrontendParam(
431 parser.getConfigLine(channelName) ));
static MACAddress const None
#define SENF_MEMBINDFNP(ret, cls, fn, args)
console::ScopedDirectory dir
void registerFrequency(unsigned frequency, unsigned bandwidth)
register single frequency/bandwidth combination
unspecified_keyword_type parser
static DVBModulationParameterRegistry & instance()
std::string status2String(fe_status_t status)
#define DEFAULT_DVB_NOISE
static SENF_CLOCKSERVICE_CONSTEXPR clock_type seconds(int64_type const &v)
ModulationParameter::id_t modulationId_
boost::function< R(Args)> membind(R(T::*fn)(Args), T *ob)
Annotations public header.
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)
HardwareDVBInterface public header.
console::DirectoryNode & consoleDir() const
Access interface console directory.
HardwareDVBReceiverInterface()
NodeType & add(std::string const &name, boost::shared_ptr< NodeType > node)
unsigned frequency() const
Get current channel frequency.
Receive capable wireless interface base class.
virtual void v_tune(DVBModulationParameter::fec_rate_t fec, DVBModulationParameter::modulation_t mod, DVBModulationParameter::guard_interval_t gi, unsigned frequency)
MACAddress const & id() const
Get interface MAC Address.
DVBModulationParameter const & findModulationById(ModulationParameter::id_t id) const
void addToConsole(DVBDemuxSectionHandle sh)
ppi::connector::PassiveInputJack< EthernetPacket > input
MACAddress hardwareAddress() const
virtual char const * what() const
static PacketParserBase::size_type initSize()
HardwareDVBSenderInterface(std::string const &iface)
Transmit capable wireless interface base class.
ConcretePacket< MPESectionType > MPESection
ConcretePacket< EthernetPacketType > EthernetPacket
void clearRegisteredFrequencies()
remove all registered frequencies
void registerModulation(ModulationParameter::id_t id)
register modulation configuration
boost::shared_ptr< InterfaceIdFactoryBase > ifaceIdFactory()