wifi: Add function to WifiPpdu to determine whether it overlaps with a given channel

This commit is contained in:
Sebastien Deronne
2022-05-15 15:59:44 +02:00
parent 1f3e89f6fa
commit d233286bb9
2 changed files with 23 additions and 5 deletions

View File

@@ -109,15 +109,25 @@ WifiPpdu::GetTransmissionChannelWidth (void) const
}
bool
WifiPpdu::CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const
WifiPpdu::DoesOverlapChannel (uint16_t minFreq, uint16_t maxFreq) const
{
NS_LOG_FUNCTION (this << m_txCenterFreq << p20MinFreq << p20MaxFreq);
NS_LOG_FUNCTION (this << m_txCenterFreq << minFreq << maxFreq);
uint16_t txChannelWidth = GetTxVector ().GetChannelWidth ();
uint16_t minTxFreq = m_txCenterFreq - txChannelWidth / 2;
uint16_t maxTxFreq = m_txCenterFreq + txChannelWidth / 2;
if (minTxFreq > minFreq || maxTxFreq < maxFreq)
{
return false;
}
return true;
}
if (minTxFreq > p20MinFreq || maxTxFreq < p20MaxFreq)
bool
WifiPpdu::CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const
{
NS_LOG_FUNCTION (this << p20MinFreq << p20MaxFreq);
const bool overlap = DoesOverlapChannel (p20MinFreq, p20MaxFreq);
if (!overlap)
{
NS_LOG_INFO ("Received PPDU does not overlap with the primary20 channel");
return false;
@@ -125,7 +135,6 @@ WifiPpdu::CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const
return true;
}
uint64_t
WifiPpdu::GetUid (void) const
{

View File

@@ -113,6 +113,15 @@ public:
*/
virtual uint16_t GetTransmissionChannelWidth (void) const;
/**
* Check whether the given PPDU overlaps a given channel.
*
* \param minFreq the minimum frequency (MHz) of the channel
* \param maxFreq the maximum frequency (MHz) of the channel
* \return true if this PPDU overlaps the channel, false otherwise
*/
bool DoesOverlapChannel (uint16_t minFreq, uint16_t maxFreq) const;
/**
* Check whether the given PPDU can be received on the specified primary
* channel. Normally, a PPDU can be received if it is transmitted over a