wifi: Add function to retrieve the center frequency of a given secondary channel

This commit is contained in:
Sebastien Deronne
2022-06-08 07:40:26 +02:00
parent d233286bb9
commit 6940bb7170
2 changed files with 17 additions and 0 deletions

View File

@@ -470,6 +470,14 @@ WifiPhyOperatingChannel::GetPrimaryChannelCenterFrequency (uint16_t primaryChann
return freq;
}
uint16_t
WifiPhyOperatingChannel::GetSecondaryChannelCenterFrequency (uint16_t secondaryChannelWidth) const
{
const uint8_t primaryIndex = GetPrimaryChannelIndex (secondaryChannelWidth);
const uint16_t primaryCenterFrequency = GetPrimaryChannelCenterFrequency (secondaryChannelWidth);
return (primaryIndex % 2 == 0) ? (primaryCenterFrequency + secondaryChannelWidth) : (primaryCenterFrequency - secondaryChannelWidth);
}
uint8_t
WifiPhyOperatingChannel::GetPrimaryChannelNumber (uint16_t primaryChannelWidth,
WifiStandard standard) const

View File

@@ -159,6 +159,7 @@ public:
* \param index the index of the primary 20 MHz channel
*/
void SetPrimary20Index (uint8_t index);
/**
* Get the center frequency of the primary channel of the given width.
*
@@ -167,6 +168,14 @@ public:
*/
uint16_t GetPrimaryChannelCenterFrequency (uint16_t primaryChannelWidth) const;
/**
* Get the center frequency of the secondary channel of the given width.
*
* \param secondaryChannelWidth the width of the secondary channel in MHz
* \return the center frequency of the secondary channel of the given width
*/
uint16_t GetSecondaryChannelCenterFrequency (uint16_t secondaryChannelWidth) const;
/**
* Get the channel indices of all the 20 MHz channels included in the primary
* channel of the given width, if such primary channel exists, or an empty set,