diff --git a/src/wifi/model/he/constant-obss-pd-algorithm.cc b/src/wifi/model/he/constant-obss-pd-algorithm.cc index eb210d8fd..088b4b95f 100644 --- a/src/wifi/model/he/constant-obss-pd-algorithm.cc +++ b/src/wifi/model/he/constant-obss-pd-algorithm.cc @@ -93,9 +93,10 @@ ConstantObssPdAlgorithm::ReceiveHeSigA (HeSigAParameters params) bool isObss = (bssColor != params.bssColor); if (isObss) { - if (WToDbm (params.rssiW) < m_obssPdLevel) + const double obssPdLevel = GetObssPdLevel (); + if (WToDbm (params.rssiW) < obssPdLevel) { - NS_LOG_DEBUG ("Frame is OBSS and RSSI " << WToDbm(params.rssiW) << " is below OBSS-PD level of " << m_obssPdLevel << "; reset PHY to IDLE"); + NS_LOG_DEBUG ("Frame is OBSS and RSSI " << WToDbm(params.rssiW) << " is below OBSS-PD level of " << obssPdLevel << "; reset PHY to IDLE"); ResetPhy (params); } else diff --git a/src/wifi/model/he/obss-pd-algorithm.cc b/src/wifi/model/he/obss-pd-algorithm.cc index 15fa5def5..16c75ce76 100644 --- a/src/wifi/model/he/obss-pd-algorithm.cc +++ b/src/wifi/model/he/obss-pd-algorithm.cc @@ -40,7 +40,8 @@ ObssPdAlgorithm::GetTypeId (void) .AddAttribute ("ObssPdLevel", "The current OBSS PD level (dBm).", DoubleValue (-82.0), - MakeDoubleAccessor (&ObssPdAlgorithm::m_obssPdLevel), + MakeDoubleAccessor (&ObssPdAlgorithm::SetObssPdLevel, + &ObssPdAlgorithm::GetObssPdLevel), MakeDoubleChecker (-101, -62)) .AddAttribute ("ObssPdLevelMin", "Minimum value (dBm) of OBSS PD level.", @@ -109,4 +110,17 @@ ObssPdAlgorithm::ResetPhy (HeSigAParameters params) phy->ResetCca (powerRestricted, txPowerMaxSiso, txPowerMaxMimo); } +void +ObssPdAlgorithm::SetObssPdLevel (double level) +{ + NS_LOG_FUNCTION (this << level); + m_obssPdLevel = level; +} + +double +ObssPdAlgorithm::GetObssPdLevel (void) const +{ + return m_obssPdLevel; +} + } //namespace ns3 diff --git a/src/wifi/model/he/obss-pd-algorithm.h b/src/wifi/model/he/obss-pd-algorithm.h index 8662a9b15..33107a130 100644 --- a/src/wifi/model/he/obss-pd-algorithm.h +++ b/src/wifi/model/he/obss-pd-algorithm.h @@ -82,15 +82,23 @@ public: */ typedef void (* ResetTracedCallback)(uint8_t bssColor, double rssiDbm, bool powerRestricted, double txPowerMaxDbmSiso, double txPowerMaxDbmMimo); + /** + * \param level the current OBSS PD level in dBm + */ + void SetObssPdLevel (double level); + /** + * \return the current OBSS PD level in dBm. + */ + double GetObssPdLevel (void) const; + protected: void DoDispose (void) override; Ptr m_device; ///< Pointer to the WifiNetDevice - double m_obssPdLevel; ///< Current OBSS PD level (dBm) - private: + double m_obssPdLevel; ///< Current OBSS PD level (dBm) double m_obssPdLevelMin; ///< Minimum OBSS PD level (dBm) double m_obssPdLevelMax; ///< Maximum OBSS PD level (dBm) double m_txPowerRefSiso; ///< SISO reference TX power level (dBm)