diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index 767332ce7..b7e6be3f1 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -27,6 +27,7 @@ #include "dcf-manager.h" #include "msdu-aggregator.h" #include "mpdu-aggregator.h" +#include "wifi-utils.h" namespace ns3 { @@ -265,15 +266,15 @@ RegularWifiMac::GetHeCapabilities (void) const { capabilities.SetHeSupported (1); uint8_t channelWidthSet = 0; - if (m_phy->GetChannelWidth () >= 40 && m_phy->Is2_4Ghz (m_phy->GetFrequency ())) + if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ())) { channelWidthSet |= 0x01; } - if (m_phy->GetChannelWidth () >= 80 && m_phy->Is5Ghz (m_phy->GetFrequency ())) + if (m_phy->GetChannelWidth () >= 80 && Is5Ghz (m_phy->GetFrequency ())) { channelWidthSet |= 0x02; } - if (m_phy->GetChannelWidth () >= 160 && m_phy->Is5Ghz (m_phy->GetFrequency ())) + if (m_phy->GetChannelWidth () >= 160 && Is5Ghz (m_phy->GetFrequency ())) { channelWidthSet |= 0x04; } diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 2155f3477..27f52ed21 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1272,26 +1272,6 @@ WifiPhy::GetFrequency (void) const return m_channelCenterFrequency; } -bool -WifiPhy::Is2_4Ghz (double frequency) -{ - if (frequency >= 2400 && frequency <= 2500) - { - return true; - } - return false; -} - -bool -WifiPhy::Is5Ghz (double frequency) -{ - if (frequency >= 5000 && frequency <= 6000) - { - return true; - } - return false; -} - void WifiPhy::SetChannelWidth (uint8_t channelwidth) { diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 09148aadc..c81ce348e 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1521,16 +1521,6 @@ public: * \return the maximum number of supported RX spatial streams */ uint8_t GetMaxSupportedRxSpatialStreams (void) const; - /** - * \param frequency the frequency to check - * \return whether frequency is in the 2.4 GHz band - */ - static bool Is2_4Ghz (double frequency); - /** - * \param frequency the frequency to check - * \return whether frequency is in the 5 GHz band - */ - static bool Is5Ghz (double frequency); /** * Enable or disable support for HT/VHT short guard interval. * diff --git a/src/wifi/model/wifi-utils.cc b/src/wifi/model/wifi-utils.cc index e654781bf..aa64edbd5 100644 --- a/src/wifi/model/wifi-utils.cc +++ b/src/wifi/model/wifi-utils.cc @@ -57,6 +57,26 @@ RatioToDb (double ratio) return 10.0 * std::log10 (ratio); } +bool +Is2_4Ghz (double frequency) +{ + if (frequency >= 2400 && frequency <= 2500) + { + return true; + } + return false; +} + +bool +Is5Ghz (double frequency) +{ + if (frequency >= 5000 && frequency <= 6000) + { + return true; + } + return false; +} + uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval) { diff --git a/src/wifi/model/wifi-utils.h b/src/wifi/model/wifi-utils.h index c7f74eaf4..ac99b20b6 100644 --- a/src/wifi/model/wifi-utils.h +++ b/src/wifi/model/wifi-utils.h @@ -71,6 +71,16 @@ double WToDbm (double w); * \return dB */ double RatioToDb (double ratio); +/** + * \param frequency the frequency to check + * \return whether frequency is in the 2.4 GHz band + */ +bool Is2_4Ghz (double frequency); +/** + * \param frequency the frequency to check + * \return whether frequency is in the 5 GHz band + */ +bool Is5Ghz (double frequency); /** * Convert the guard interval to nanoseconds based on the wifimode. *