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
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
15 \brief WirelessInterfaceAPI inline non-template implementation */
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::emu::WirelessInterface::Frequency
25 prefix_ senf::emu::WirelessInterface::Frequency::Frequency(unsigned frequencyLower_,
26 unsigned frequencyUpper_,
27 unsigned bandwidthLower_,
28 unsigned bandwidthUpper_)
29 : frequencyLower(frequencyLower_), frequencyUpper(frequencyUpper_), bandwidthLower(bandwidthLower_),
30 bandwidthUpper(bandwidthUpper_)
33 prefix_ senf::emu::WirelessInterface::Frequency::Frequency(unsigned frequency_,
35 : frequencyLower(frequency_), frequencyUpper(frequency_), bandwidthLower(bandwidth_),
36 bandwidthUpper(bandwidth_)
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
40 // senf::emu::WirelessInterface
42 prefix_ unsigned senf::emu::WirelessInterface::frequency()
48 prefix_ unsigned senf::emu::WirelessInterface::bandwidth()
54 prefix_ void senf::emu::WirelessInterface::frequency(unsigned freq)
56 unsigned bw (bandwidth());
57 lookupFrequency(freq, bw);
58 v_frequency(freq, bw);
61 prefix_ void senf::emu::WirelessInterface::frequency(unsigned freq, unsigned bw)
63 lookupFrequency(freq, bw);
64 v_frequency(freq, bw);
67 prefix_ senf::emu::WirelessInterface::FrequenciesRange
68 senf::emu::WirelessInterface::frequencies()
71 frequency_is_whitelisted predicate (whitelistedFrequencies_);
72 return boost::make_iterator_range(
73 boost::make_filter_iterator( predicate, frequencies_.begin(), frequencies_.end()),
74 boost::make_filter_iterator( predicate, frequencies_.end(), frequencies_.end()) );
77 prefix_ senf::emu::WirelessInterface::WirelessInterface()
80 prefix_ void senf::emu::WirelessInterface::coverageRange(unsigned distance)
82 v_coverageRange(distance);
85 prefix_ void senf::emu::WirelessInterface::clearRegisteredFrequencies()
90 prefix_ void senf::emu::WirelessInterface::clearRegisteredModulations()
92 modulationIds_.clear();
95 prefix_ void senf::emu::WirelessInterface::registerFrequency(unsigned frequency,
98 frequencies_.insert(Frequency(frequency, bandwidth));
101 prefix_ void senf::emu::WirelessInterface::registerFrequency(unsigned frequencyLower,
102 unsigned frequencyUpper,
103 unsigned bandwidthLower,
104 unsigned bandwidthUpper)
106 SENF_ASSERT( frequencyLower <= frequencyUpper,
107 "Reversed frequency parameters in "
108 "senf::emu::WirelessInterface::registerFrequency()");
109 SENF_ASSERT( bandwidthLower <= bandwidthUpper,
110 "Reversed frequency parameters in "
111 "senf::emu::WirelessInterface::registerFrequency()");
112 frequencies_.insert(Frequency(frequencyLower, frequencyUpper, bandwidthLower, bandwidthUpper));
115 prefix_ senf::emu::WirelessInterface::ModulationParameterIds const &
116 senf::emu::WirelessInterface::modulationParameterIds()
119 return modulationIds_;
122 prefix_ void senf::emu::WirelessInterface::registerModulation(ModulationParameter::id_t id)
124 ModulationParameterRegistry::instance().findModulationById(id); // throws if id is not registered
125 modulationIds_.insert(id);
128 //-/////////////////////////////////////////////////////////////////////////////////////////////////
129 // senf::emu::WirelessReceiver
132 senf::emu::WirelessReceiver::WirelessReceiver(ppi::connector::ActiveOutput<> & output)
136 prefix_ senf::emu::WirelessReceiver::
137 WirelessReceiver(ppi::connector::ActiveOutput<EthernetPacket> & output)
141 prefix_ senf::emu::WirelessReceiver::
142 WirelessReceiver(ppi::connector::ActiveOutputJack<> & output)
146 prefix_ senf::emu::WirelessReceiver::
147 WirelessReceiver(ppi::connector::ActiveOutputJack<EthernetPacket> & output)
151 prefix_ void senf::emu::WirelessReceiver::init()
156 //-/////////////////////////////////////////////////////////////////////////////////////////////////
157 // senf::emu::WirelessTransmitter::TxPower
159 prefix_ senf::emu::WirelessTransmitter::TxPower::TxPower(int _lower, int _upper)
160 : lower(_lower), upper(_upper)
163 //-/////////////////////////////////////////////////////////////////////////////////////////////////
164 // senf::emu::WirelessTransmitter
166 prefix_ int senf::emu::WirelessTransmitter::txPower()
172 prefix_ void senf::emu::WirelessTransmitter::txPower(int power)
174 TxPowers::const_iterator i (txPowers_.lower_bound(power));
175 if (i == txPowers_.end() || i->lower > power)
176 throw InvalidArgumentException("invalid txPower ") << power;
180 prefix_ senf::emu::WirelessTransmitter::TxPowersRange senf::emu::WirelessTransmitter::txPowers()
183 return boost::make_iterator_range(txPowers_.begin(), txPowers_.end());
186 prefix_ senf::emu::WirelessTransmitter::
187 WirelessTransmitter(ppi::connector::PassiveInput<> & input)
188 : Transmitter (input)
191 prefix_ senf::emu::WirelessTransmitter::
192 WirelessTransmitter(ppi::connector::PassiveInput<EthernetPacket> & input)
193 : Transmitter (input)
196 prefix_ senf::emu::WirelessTransmitter::
197 WirelessTransmitter(ppi::connector::PassiveInputJack<> & input)
198 : Transmitter (input)
201 prefix_ senf::emu::WirelessTransmitter::
202 WirelessTransmitter(ppi::connector::PassiveInputJack<EthernetPacket> & input)
203 : Transmitter (input)
206 //-/////////////////////////////////////////////////////////////////////////////////////////////////
213 // comment-column: 40
214 // c-file-style: "senf"
215 // indent-tabs-mode: nil
216 // ispell-local-dictionary: "american"
217 // compile-command: "scons -u test"