A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change. More...
#include "wifi-radio-energy-model.h"
Public Types | |
typedef Callback< void, double > | UpdateTxCurrentCallback |
Callback type for updating the transmit current based on the nominal TX power. More... | |
Public Member Functions | |
WifiRadioEnergyModelPhyListener () | |
virtual | ~WifiRadioEnergyModelPhyListener () |
void | NotifyMaybeCcaBusyStart (Time duration) override |
void | NotifyOff (void) override |
Defined in ns3::WifiPhyListener. More... | |
void | NotifyOn (void) override |
Defined in ns3::WifiPhyListener. More... | |
void | NotifyRxEndError (void) override |
Switches the WifiRadioEnergyModel back to IDLE state. More... | |
void | NotifyRxEndOk (void) override |
Switches the WifiRadioEnergyModel back to IDLE state. More... | |
void | NotifyRxStart (Time duration) override |
Switches the WifiRadioEnergyModel to RX state. More... | |
void | NotifySleep (void) override |
Defined in ns3::WifiPhyListener. More... | |
void | NotifySwitchingStart (Time duration) override |
void | NotifyTxStart (Time duration, double txPowerDbm) override |
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration. More... | |
void | NotifyWakeup (void) override |
Defined in ns3::WifiPhyListener. More... | |
void | SetChangeStateCallback (DeviceEnergyModel::ChangeStateCallback callback) |
Sets the change state callback. More... | |
void | SetUpdateTxCurrentCallback (UpdateTxCurrentCallback callback) |
Sets the update TX current 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 |
switch to idle event More... | |
UpdateTxCurrentCallback | m_updateTxCurrentCallback |
Callback used to update the TX current stored in WifiRadioEnergyModel based on the nominal TX power used to transmit the current frame. More... | |
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.
Definition at line 42 of file wifi-radio-energy-model.h.
typedef Callback<void, double> ns3::WifiRadioEnergyModelPhyListener::UpdateTxCurrentCallback |
Callback type for updating the transmit current based on the nominal TX power.
Definition at line 48 of file wifi-radio-energy-model.h.
ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener | ( | ) |
Definition at line 462 of file wifi-radio-energy-model.cc.
References m_changeStateCallback, m_updateTxCurrentCallback, NS_LOG_FUNCTION, and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Nullify().
|
virtual |
Definition at line 469 of file wifi-radio-energy-model.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
duration | the expected busy duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 544 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), 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().
|
overridevirtual |
Defined in ns3::WifiPhyListener.
Implements ns3::WifiPhyListener.
Definition at line 595 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 OFF.
|
overridevirtual |
Defined in ns3::WifiPhyListener.
Implements ns3::WifiPhyListener.
Definition at line 607 of file wifi-radio-energy-model.cc.
References IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
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 514 of file wifi-radio-energy-model.cc.
References IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
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 503 of file wifi-radio-energy-model.cc.
References IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
Switches the WifiRadioEnergyModel to RX state.
duration | the expected duration of the packet reception. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 491 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 RX.
|
overridevirtual |
Defined in ns3::WifiPhyListener.
Implements ns3::WifiPhyListener.
Definition at line 572 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 SLEEP.
|
overridevirtual |
duration | the expected channel switching duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 558 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(), SWITCHING, and SwitchToIdle().
|
overridevirtual |
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration.
duration | the expected transmission duration. |
txPowerDbm | the nominal TX power in dBm |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 525 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, m_updateTxCurrentCallback, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SwitchToIdle(), and TX.
|
overridevirtual |
Defined in ns3::WifiPhyListener.
Implements ns3::WifiPhyListener.
Definition at line 584 of file wifi-radio-energy-model.cc.
References IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback | ( | DeviceEnergyModel::ChangeStateCallback | callback | ) |
Sets the change state callback.
Used by helper class.
callback | Change state callback. |
Definition at line 475 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().
void ns3::WifiRadioEnergyModelPhyListener::SetUpdateTxCurrentCallback | ( | UpdateTxCurrentCallback | callback | ) |
Sets the update TX current callback.
callback | Update TX current callback. |
Definition at line 483 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_updateTxCurrentCallback, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::WifiRadioEnergyModel::WifiRadioEnergyModel().
|
private |
A helper function that makes scheduling m_changeStateCallback possible.
Definition at line 618 of file wifi-radio-energy-model.cc.
References 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 152 of file wifi-radio-energy-model.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyOff(), NotifyOn(), NotifyRxEndError(), NotifyRxEndOk(), NotifyRxStart(), NotifySleep(), NotifySwitchingStart(), NotifyTxStart(), NotifyWakeup(), SetChangeStateCallback(), SwitchToIdle(), and WifiRadioEnergyModelPhyListener().
|
private |
switch to idle event
Definition at line 160 of file wifi-radio-energy-model.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyOff(), NotifyRxStart(), NotifySleep(), NotifySwitchingStart(), and NotifyTxStart().
|
private |
Callback used to update the TX current stored in WifiRadioEnergyModel based on the nominal TX power used to transmit the current frame.
Definition at line 158 of file wifi-radio-energy-model.h.
Referenced by NotifyTxStart(), SetUpdateTxCurrentCallback(), and WifiRadioEnergyModelPhyListener().