HardwareDVBInterface.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Ext_NetEmu_DVB_HardwareDVBInterface_
18 #define HH_SENF_Ext_NetEmu_DVB_HardwareDVBInterface_ 1
19 
20 // Custom includes
23 #include "DVBInterface.hh"
24 
25 #include "HardwareDVBInterface.ih"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 namespace emu {
30 
32  : public DVBInterface, public HardwareInterface
33  {
34  protected:
36 
37  void init();
38 
41 
43 
44  private:
45  void registerFrequencyRange(unsigned frequencyLower, unsigned frequencyUpper);
46  virtual unsigned v_frequency() const;
47  virtual unsigned v_bandwidth() const;
48  virtual void v_frequency(unsigned freq, unsigned bw);
49 
50  virtual void v_coverageRange(unsigned distance);
51 
52  unsigned frequency_;
53  unsigned bandwidth_;
54  };
55 
56 
58  : private detail::HardwareDVBSenderInterfaceNet,
59  public HardwareDVBInterface,
60  public WirelessTransmitter
61  {
62  public:
63  HardwareDVBSenderInterface(std::string const & iface);
64 
65  private:
66  virtual void v_enable() override;
67  virtual void v_disable() override;
68  virtual bool v_enabled() const override;
69 
70  virtual unsigned v_mtu() const override;
71  virtual void v_mtu(unsigned v) override;
72 
73  virtual void v_id(MACAddress const & id) override;
74  virtual MACAddress v_id() const override;
75 
76  virtual int v_txPower() const override;
77  virtual void v_txPower(int power) override;
78 
79  virtual ModulationParameter::id_t v_modulationId() const override;
80  virtual void v_modulationId(ModulationParameter::id_t id) override;
81 
82  std::string const & v_device() const override;
83 
84  std::string iface_;
85  NetdeviceController ctrl_;
86  int txPower_;
87  };
88 
89 
91  : private detail::HardwareDVBReceiverInterfaceNet,
92  public HardwareDVBInterface,
93  public WirelessReceiver
94  {
95  public:
97 
98  boost::shared_ptr<InterfaceIdFactoryBase> ifaceIdFactory();
99  void ifaceIdFactory(boost::shared_ptr<InterfaceIdFactoryBase> factory);
100 
101  private:
102  virtual void v_enable() override;
103  virtual void v_disable() override;
104  virtual bool v_enabled() const override;
105 
106  virtual void v_id(MACAddress const & id) override;
107  virtual MACAddress v_id() const override;
108 
109  std::string const & v_device() const override;
110 
111  virtual bool v_promisc() const override;
112  virtual void v_promisc(bool v) override;
113 
114  virtual bool v_annotationMode() const override;
115  virtual void v_annotationMode(bool a) override;
116 
117  virtual void v_mcAdd(MACAddress const & address) override;
118  virtual void v_mcDrop(MACAddress const & address) override;
119 
122  void tuneEvent(const struct dvb_frontend_event & ev);
123  void tune(std::string const & channelName);
124  using DVBInterface::tune;
125 
126  int tsPidChanged(int oldPid);
127 
128  boost::shared_ptr<InterfaceIdFactoryBase> ifaceIdFactory_;
129  MACAddress id_;
130 
131  int tsPid_;
132  int stuffingPid_;
133  DVBSocketController dvbController;
134  std::string dev_;
135 
136  friend struct detail::HardwareDVBReceiverInterfaceNet;
137  };
138 
139 }}
140 
141 //-/////////////////////////////////////////////////////////////////////////////////////////////////
142 //#include "HardwareDVBInterface.cci"
143 //#include "HardwareDVBInterface.ct"
144 //#include "HardwareDVBInterface.cti"
145 #endif
void tune(DVBModulationParameter::fec_rate_t fec, DVBModulationParameter::modulation_t mod, DVBModulationParameter::guard_interval_t gi, unsigned freq)
virtual void v_enable()=0
Called to enable interface.
virtual void v_disable()=0
Called to disable interface.
ModulationParameter::id_t modulationId_
virtual bool v_enabled() const =0
Return true if interface is enabled.
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)
InterfaceId public header.
Hardware interface base class.
DVBInterface public header.
virtual MACAddress v_id() const =0
Return the interface mac address.
Transmit capable wireless interface base class.
virtual std::string const & v_device() const =0
__be16 freq