wifi: Do no longer pass CCA busy duration to SwitchFromSleep and SwitchFromOff
This commit is contained in:
committed by
Stefano Avallone
parent
e736151b27
commit
faacbe02c9
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user