wifi: Add methods to check the type of the operating channel

This commit is contained in:
Stefano Avallone
2022-04-27 15:28:30 +02:00
committed by Stefano Avallone
parent 258920c0d6
commit 983dbc2254
2 changed files with 39 additions and 0 deletions

View File

@@ -393,6 +393,27 @@ WifiPhyOperatingChannel::GetWidth (void) const
return std::get<2> (*m_channelIt);
}
bool
WifiPhyOperatingChannel::IsOfdm (void) const
{
NS_ASSERT (IsSet ());
return std::get<FrequencyChannelType> (*m_channelIt) == WIFI_PHY_OFDM_CHANNEL;
}
bool
WifiPhyOperatingChannel::IsDsss (void) const
{
NS_ASSERT (IsSet ());
return std::get<FrequencyChannelType> (*m_channelIt) == WIFI_PHY_DSSS_CHANNEL;
}
bool
WifiPhyOperatingChannel::Is80211p (void) const
{
NS_ASSERT (IsSet ());
return std::get<FrequencyChannelType> (*m_channelIt) == WIFI_PHY_80211p_CHANNEL;
}
uint8_t
WifiPhyOperatingChannel::GetPrimaryChannelIndex (uint16_t primaryChannelWidth) const
{

View File

@@ -113,6 +113,24 @@ public:
* \return the width of the whole operating channel (in MHz)
*/
uint16_t GetWidth (void) const;
/**
* Return whether the operating channel is an OFDM channel.
*
* \return whether the operating channel is an OFDM channel
*/
bool IsOfdm (void) const;
/**
* Return whether the operating channel is a DSSS channel.
*
* \return whether the operating channel is a DSSS channel
*/
bool IsDsss (void) const;
/**
* Return whether the operating channel is an 802.11p channel.
*
* \return whether the operating channel is an 802.11p channel
*/
bool Is80211p (void) const;
/**
* If the operating channel width is a multiple of 20 MHz, return the index of the