#include <wifi-radio-energy-model.h>
Public Member Functions | |
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 | NotifySensingStart (Time duration) |
virtual void | NotifySwitchingStart (Time duration, uint16_t toChannel) |
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. Used by helper class. More... | |
Private Member Functions | |
void | SwitchToIdle (void) |
Private Attributes | |
DeviceEnergyModel::ChangeStateCallback | m_changeStateCallback |
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.
|
virtual |
duration | the expected busy duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 402 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::WifiPhy::CCA_BUSY, m_changeStateCallback, 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 377 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, 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 366 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, 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 354 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), m_changeStateCallback, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::WifiPhy::RX.
|
virtual |
duration | the expected channel sensing duration. |
Implements ns3::WifiPhyListener.
Definition at line 430 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), m_changeStateCallback, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::WifiPhy::SENSING, and SwitchToIdle().
|
virtual |
duration | the expected channel switching duration. |
Defined in ns3::WifiPhyListener
Implements ns3::WifiPhyListener.
Definition at line 416 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), m_changeStateCallback, 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 388 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), m_changeStateCallback, 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 346 of file wifi-radio-energy-model.cc.
References m_changeStateCallback, NS_ASSERT, and NS_LOG_FUNCTION.
|
private |
A helper function that makes scheduling m_changeStateCallback possible.
Definition at line 448 of file wifi-radio-energy-model.cc.
References ns3::WifiPhy::IDLE, m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by NotifyMaybeCcaBusyStart(), NotifySensingStart(), NotifySwitchingStart(), and NotifyTxStart().
|
private |
Change state callback used to notify the WifiRadioEnergyModel of a state change.
Definition at line 116 of file wifi-radio-energy-model.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyRxEndError(), NotifyRxEndOk(), NotifyRxStart(), NotifySensingStart(), NotifySwitchingStart(), NotifyTxStart(), SetChangeStateCallback(), and SwitchToIdle().