wifi: move Is2_4Ghz and Is5Ghz to wifi-utils
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user