From 5bd77d712d7005fafcb7b83cc4bd8490e34ce4fd Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 8 Sep 2023 16:36:32 +0200 Subject: [PATCH] wifi: Avoid code duplication in WifiPhyStateHelper --- src/wifi/model/wifi-phy-state-helper.cc | 133 ++++-------------------- src/wifi/model/wifi-phy-state-helper.h | 89 ++++++---------- 2 files changed, 50 insertions(+), 172 deletions(-) diff --git a/src/wifi/model/wifi-phy-state-helper.cc b/src/wifi/model/wifi-phy-state-helper.cc index 9ecc53ceb..0f5f77b63 100644 --- a/src/wifi/model/wifi-phy-state-helper.cc +++ b/src/wifi/model/wifi-phy-state-helper.cc @@ -29,6 +29,7 @@ #include "ns3/simulator.h" #include +#include #include namespace ns3 @@ -66,7 +67,8 @@ WifiPhyStateHelper::GetTypeId() } WifiPhyStateHelper::WifiPhyStateHelper() - : m_sleeping(false), + : NS_LOG_TEMPLATE_DEFINE("Queue"), + m_sleeping(false), m_isOff(false), m_endTx(Seconds(0)), m_endRx(Seconds(0)), @@ -230,108 +232,6 @@ WifiPhyStateHelper::GetState() const } } -void -WifiPhyStateHelper::NotifyTxStart(Time duration, double txPowerDbm) -{ - NS_LOG_FUNCTION(this); - for (const auto& listener : m_listeners) - { - listener->NotifyTxStart(duration, txPowerDbm); - } -} - -void -WifiPhyStateHelper::NotifyRxStart(Time duration) -{ - NS_LOG_FUNCTION(this); - for (const auto& listener : m_listeners) - { - listener->NotifyRxStart(duration); - } -} - -void -WifiPhyStateHelper::NotifyRxEndOk() -{ - NS_LOG_FUNCTION(this); - for (const auto& listener : m_listeners) - { - listener->NotifyRxEndOk(); - } -} - -void -WifiPhyStateHelper::NotifyRxEndError() -{ - NS_LOG_FUNCTION(this); - for (const auto& listener : m_listeners) - { - listener->NotifyRxEndError(); - } -} - -void -WifiPhyStateHelper::NotifyCcaBusyStart(Time duration, - WifiChannelListType channelType, - const std::vector