wifi: Implement function to retrieve secondary band for a given width
This commit is contained in:
@@ -1042,6 +1042,13 @@ PhyEntity::GetPrimaryBand (uint16_t bandWidth) const
|
||||
return m_wifiPhy->GetBand (bandWidth, m_wifiPhy->m_operatingChannel.GetPrimaryChannelIndex (bandWidth));
|
||||
}
|
||||
|
||||
WifiSpectrumBand
|
||||
PhyEntity::GetSecondaryBand (uint16_t bandWidth) const
|
||||
{
|
||||
NS_ASSERT (m_wifiPhy->GetChannelWidth () >= 40);
|
||||
return m_wifiPhy->GetBand (bandWidth, m_wifiPhy->m_operatingChannel.GetSecondaryChannelIndex (bandWidth));
|
||||
}
|
||||
|
||||
uint16_t
|
||||
PhyEntity::GetRxChannelWidth (const WifiTxVector& txVector) const
|
||||
{
|
||||
|
||||
@@ -805,6 +805,16 @@ protected:
|
||||
* \return a pair of start and stop indexes that defines the band
|
||||
*/
|
||||
WifiSpectrumBand GetPrimaryBand (uint16_t bandWidth) const;
|
||||
/**
|
||||
* If the channel bonding is used, return the start band index and the stop band index
|
||||
* for the secondary channel of the given bandwidth (which must be a multiple of 20 MHz
|
||||
* and not exceed the operating channel width).
|
||||
*
|
||||
* \param bandWidth the width of the band to be returned (MHz)
|
||||
*
|
||||
* \return a pair of start and stop indexes that defines the band
|
||||
*/
|
||||
WifiSpectrumBand GetSecondaryBand (uint16_t bandWidth) const;
|
||||
|
||||
/**
|
||||
* Return the channel width used to measure the RSSI.
|
||||
|
||||
@@ -437,10 +437,20 @@ WifiPhyOperatingChannel::GetPrimaryChannelIndex (uint16_t primaryChannelWidth) c
|
||||
index /= 2;
|
||||
width *= 2;
|
||||
}
|
||||
NS_LOG_LOGIC ("Return " << +index);
|
||||
NS_LOG_LOGIC ("Return primary index " << +index);
|
||||
return index;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiPhyOperatingChannel::GetSecondaryChannelIndex (uint16_t secondaryChannelWidth) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << secondaryChannelWidth);
|
||||
const uint8_t primaryIndex = GetPrimaryChannelIndex (secondaryChannelWidth);
|
||||
const uint8_t secondaryIndex = (primaryIndex % 2 == 0) ? (primaryIndex + 1) : (primaryIndex - 1);
|
||||
NS_LOG_LOGIC ("Return secondary index " << +secondaryIndex);
|
||||
return secondaryIndex;
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhyOperatingChannel::SetPrimary20Index (uint8_t index)
|
||||
{
|
||||
|
||||
@@ -141,6 +141,17 @@ public:
|
||||
* \return the index of the requested primary channel within the operating channel
|
||||
*/
|
||||
uint8_t GetPrimaryChannelIndex (uint16_t primaryChannelWidth) const;
|
||||
|
||||
/**
|
||||
* If the operating channel width is made of a multiple of 20 MHz, return the index of the
|
||||
* secondary channel of the given width within the operating channel (0 indicates
|
||||
* the 20 MHz subchannel with the lowest center frequency). Otherwise, return 0.
|
||||
*
|
||||
* \param secondaryChannelWidth the width of the secondary channel in MHz
|
||||
* \return the index of the requested secondary channel within the operating channel
|
||||
*/
|
||||
uint8_t GetSecondaryChannelIndex (uint16_t secondaryChannelWidth) const;
|
||||
|
||||
/**
|
||||
* Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel
|
||||
* with the lowest center frequency).
|
||||
|
||||
Reference in New Issue
Block a user