23 #include "ns3/assert.h"
268 : m_channelIt (m_frequencyChannels.end ()),
289 NS_LOG_FUNCTION (
this << +number << frequency << width << standard << band);
291 auto channelIt =
FindFirst (number, frequency, width, standard, band);
294 &&
FindFirst (number, frequency, width, standard, band, std::next (channelIt))
304 throw std::runtime_error (
"WifiPhyOperatingChannel: No unique channel found given the specified criteria");
318 auto channelIt =
FindFirst (0, 0, width, standard, band);
323 return std::get<0> (*channelIt);
327 throw std::runtime_error (
"WifiPhyOperatingChannel: No default channel found of the given width and for the given PHY standard and band");
338 if (number != 0 && std::get<0> (
channel) != number)
342 if (frequency != 0 && std::get<1> (
channel) != frequency)
346 if (width != 0 && std::get<2> (
channel) != width)
354 if (std::get<4> (
channel) != band)
366 || std::find (standardIt->second.cbegin (), standardIt->second.cend (), band) == standardIt->second.cend ()
401 if (primaryChannelWidth % 20 != 0)
403 NS_LOG_DEBUG (
"The operating channel width is not a multiple of 20 MHz; return 0");
414 while (width < primaryChannelWidth)
447 auto& [chanNumber, centerFreq, channelWidth, channelType, band] = *
m_channelIt;
448 auto primaryChanIt =
FindFirst (0, frequency, primaryChannelWidth, standard, band);
449 return std::get<0> (*primaryChanIt);
WifiPhyOperatingChannel()
Create an uninitialized PHY operating channel.
uint8_t GetNumber(void) const
Return the channel number identifying the whole operating channel.
bool IsSet(void) const
Return true if a valid channel has been set, false otherwise.
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
ConstIterator m_channelIt
const iterator pointing to the configured frequency channel
uint16_t GetWidth(void) const
Return the width of the whole operating channel (in MHz).
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
void Set(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band)
Set the channel according to the specified parameters if a unique frequency channel matches the speci...
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth, WifiStandard standard) const
Get channel number of the primary channel.
void SetDefault(uint16_t width, WifiStandard standard, WifiPhyBand band)
Set the default channel of the given width and for the given standard and band.
static uint8_t GetDefaultChannelNumber(uint16_t width, WifiStandard standard, WifiPhyBand band)
Get the default channel number of the given width and for the given standard and band.
uint8_t m_primary20Index
index of the primary20 channel (0 indicates the 20 MHz subchannel with the lowest center frequency)
uint16_t GetFrequency(void) const
Return the center frequency of the operating channel (in MHz).
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
virtual ~WifiPhyOperatingChannel()
std::set< FrequencyChannelInfo >::const_iterator ConstIterator
Typedef for a const iterator pointing to a channel in the set of available channels.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
@ WIFI_PHY_80211p_CHANNEL
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::tuple< uint8_t, uint16_t, uint16_t, FrequencyChannelType, WifiPhyBand > FrequencyChannelInfo
A tuple (number, frequency, width, type, band) identifying a frequency channel.
const std::map< WifiStandard, std::list< WifiPhyBand > > wifiStandards
map a given standard configured by the user to the allowed PHY bands
FrequencyChannelType GetFrequencyChannelType(WifiStandard standard)
Get the type of the frequency channel for the given standard.
uint16_t GetMaximumChannelWidth(WifiStandard standard)
Get the maximum channel width in MHz allowed for the given standard.