diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index f380a1dd5..88c4555ad 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -36,7 +36,11 @@ namespace ns3 NS_LOG_COMPONENT_DEFINE("ChannelAccessManager"); /** - * Listener for PHY events. Forwards to ChannelAccessManager + * Listener for PHY events. Forwards to ChannelAccessManager. + * The ChannelAccessManager may handle multiple PHY listeners connected to distinct PHYs, + * but only one listener at a time can be active. Notifications from inactive listeners are + * ignored by the ChannelAccessManager, except for the channel switch notification. + * Inactive PHY listeners are typically configured by 11be EMLSR clients. */ class PhyListener : public ns3::WifiPhyListener { @@ -47,7 +51,8 @@ class PhyListener : public ns3::WifiPhyListener * \param cam the ChannelAccessManager */ PhyListener(ns3::ChannelAccessManager* cam) - : m_cam(cam) + : m_cam(cam), + m_active(true) { } @@ -55,31 +60,64 @@ class PhyListener : public ns3::WifiPhyListener { } + /** + * Set this listener to be active or not. + * + * \param active whether this listener is active or not + */ + void SetActive(bool active) + { + m_active = active; + } + + /** + * \return whether this listener is active or not + */ + bool IsActive() const + { + return m_active; + } + void NotifyRxStart(Time duration) override { - m_cam->NotifyRxStartNow(duration); + if (m_active) + { + m_cam->NotifyRxStartNow(duration); + } } void NotifyRxEndOk() override { - m_cam->NotifyRxEndOkNow(); + if (m_active) + { + m_cam->NotifyRxEndOkNow(); + } } void NotifyRxEndError() override { - m_cam->NotifyRxEndErrorNow(); + if (m_active) + { + m_cam->NotifyRxEndErrorNow(); + } } void NotifyTxStart(Time duration, double txPowerDbm) override { - m_cam->NotifyTxStartNow(duration); + if (m_active) + { + m_cam->NotifyTxStartNow(duration); + } } void NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector