A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change. More...
#include <wifi-radio-energy-model.h>
Public Member Functions | |
WifiRadioEnergyModelPhyListener () | |
virtual | ~WifiRadioEnergyModelPhyListener () |
virtual void | NotifyMaybeCcaBusyStart (Time duration) |
virtual void | NotifyRxEndError (void) |
Switches the WifiRadioEnergyModel back to IDLE state. More... | |
virtual void | NotifyRxEndOk (void) |
Switches the WifiRadioEnergyModel back to IDLE state. More... | |
virtual void | NotifyRxStart (Time duration) |
Switches the WifiRadioEnergyModel to RX state. More... | |
virtual void | NotifySwitchingStart (Time duration) |
virtual void | NotifyTxStart (Time duration) |
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration. More... | |
void | SetChangeStateCallback (DeviceEnergyModel::ChangeStateCallback callback) |
Sets the change state callback. More... | |
Public Member Functions inherited from ns3::WifiPhyListener | |
virtual | ~WifiPhyListener () |
Private Member Functions | |
void | SwitchToIdle (void) |
A helper function that makes scheduling m_changeStateCallback possible. More... | |
Private Attributes | |
DeviceEnergyModel::ChangeStateCallback | m_changeStateCallback |
Change state callback used to notify the WifiRadioEnergyModel of a state change. More... | |
EventId | m_switchToIdleEvent |
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.
Definition at line 38 of file wifi-radio-energy-model.h.
ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener | ( | ) |
Definition at line 332 of file wifi-radio-energy-model.cc.
References m_changeStateCallback, NS_LOG_FUNCTION, and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Nullify().
|
virtual |
Definition at line 338 of file wifi-radio-energy-model.cc.
References NS_LOG_FUNCTION.
|
virtual |
duration | the expected busy duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 400 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::WifiPhy::CCA_BUSY, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SwitchToIdle().
|
virtual |
Switches the WifiRadioEnergyModel back to IDLE state.
Defined in ns3::WifiPhyListener
Note that for the WifiRadioEnergyModel, the behavior of the function is the same as NotifyRxEndOk.
Implements ns3::WifiPhyListener.
Definition at line 375 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
virtual |
Switches the WifiRadioEnergyModel back to IDLE state.
Defined in ns3::WifiPhyListener
Note that for the WifiRadioEnergyModel, the behavior of the function is the same as NotifyRxEndError.
Implements ns3::WifiPhyListener.
Definition at line 364 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
virtual |
Switches the WifiRadioEnergyModel to RX state.
duration | the expected duration of the packet reception. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 352 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::WifiPhy::RX.
|
virtual |
duration | the expected channel switching duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 414 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::WifiPhy::SWITCHING, and SwitchToIdle().
|
virtual |
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration.
duration | the expected transmission duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 386 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SwitchToIdle(), and ns3::WifiPhy::TX.
void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback | ( | DeviceEnergyModel::ChangeStateCallback | callback | ) |
Sets the change state callback.
Used by helper class.
callback | Change state callback. |
Definition at line 344 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::WifiRadioEnergyModel::WifiRadioEnergyModel().
|
private |
A helper function that makes scheduling m_changeStateCallback possible.
Definition at line 432 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by NotifyMaybeCcaBusyStart(), NotifySwitchingStart(), and NotifyTxStart().
|
private |
Change state callback used to notify the WifiRadioEnergyModel of a state change.
Definition at line 115 of file wifi-radio-energy-model.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyRxEndError(), NotifyRxEndOk(), NotifyRxStart(), NotifySwitchingStart(), NotifyTxStart(), SetChangeStateCallback(), SwitchToIdle(), and WifiRadioEnergyModelPhyListener().
|
private |
Definition at line 117 of file wifi-radio-energy-model.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyRxStart(), NotifySwitchingStart(), and NotifyTxStart().