diff --git a/src/wifi/model/wifi-phy-state-helper.cc b/src/wifi/model/wifi-phy-state-helper.cc index 79dc6f2e4..14aeaff0d 100644 --- a/src/wifi/model/wifi-phy-state-helper.cc +++ b/src/wifi/model/wifi-phy-state-helper.cc @@ -565,21 +565,15 @@ WifiPhyStateHelper::SwitchToSleep (void) } void -WifiPhyStateHelper::SwitchFromSleep (Time duration) +WifiPhyStateHelper::SwitchFromSleep (void) { - NS_LOG_FUNCTION (this << duration); + NS_LOG_FUNCTION (this); NS_ASSERT (IsStateSleep ()); Time now = Simulator::Now (); m_stateLogger (m_startSleep, now - m_startSleep, WifiPhyState::SLEEP); m_previousStateChangeTime = now; m_sleeping = false; NotifyWakeup (); - //update m_endCcaBusy after the sleep period - m_endCcaBusy = std::max (m_endCcaBusy, now + duration); - if (m_endCcaBusy > now) - { - NotifyMaybeCcaBusyStart (m_endCcaBusy - now); - } } void @@ -631,20 +625,14 @@ WifiPhyStateHelper::SwitchToOff (void) } void -WifiPhyStateHelper::SwitchFromOff (Time duration) +WifiPhyStateHelper::SwitchFromOff (void) { - NS_LOG_FUNCTION (this << duration); + NS_LOG_FUNCTION (this); NS_ASSERT (IsStateOff ()); Time now = Simulator::Now (); m_previousStateChangeTime = now; m_isOff = false; NotifyOn (); - //update m_endCcaBusy after the off period - m_endCcaBusy = std::max (m_endCcaBusy, now + duration); - if (m_endCcaBusy > now) - { - NotifyMaybeCcaBusyStart (m_endCcaBusy - now); - } } } //namespace ns3 diff --git a/src/wifi/model/wifi-phy-state-helper.h b/src/wifi/model/wifi-phy-state-helper.h index 57d08de4b..b7ad2f5a5 100644 --- a/src/wifi/model/wifi-phy-state-helper.h +++ b/src/wifi/model/wifi-phy-state-helper.h @@ -223,10 +223,8 @@ public: void SwitchToSleep (void); /** * Switch from sleep mode. - * - * \param duration the duration of CCA busy state */ - void SwitchFromSleep (Time duration); + void SwitchFromSleep (void); /** * Abort current reception */ @@ -237,10 +235,8 @@ public: void SwitchToOff (void); /** * Switch from off mode. - * - * \param duration the duration of CCA busy state */ - void SwitchFromOff (Time duration); + void SwitchFromOff (void); /** * TracedCallback signature for state changes. diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 1f4547091..7631d8b85 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1223,8 +1223,9 @@ WifiPhy::ResumeFromSleep (void) case WifiPhyState::SLEEP: { NS_LOG_DEBUG ("resuming from sleep mode"); - Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW, GetPrimaryBand (GetMeasurementChannelWidth (nullptr))); - m_state->SwitchFromSleep (delayUntilCcaEnd); + + m_state->SwitchFromSleep (); + SwitchMaybeToCcaBusy (GetMeasurementChannelWidth (nullptr)); break; } default: @@ -1254,8 +1255,8 @@ WifiPhy::ResumeFromOff (void) case WifiPhyState::OFF: { NS_LOG_DEBUG ("resuming from off mode"); - Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW, GetPrimaryBand (GetMeasurementChannelWidth (nullptr))); - m_state->SwitchFromOff (delayUntilCcaEnd); + m_state->SwitchFromOff (); + SwitchMaybeToCcaBusy (GetMeasurementChannelWidth (nullptr)); break; } default: