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, dBm_u > | UpdateTxCurrentCallback |
Callback type for updating the transmit current based on the nominal TX power. | |
Public Member Functions | |
WifiRadioEnergyModelPhyListener () | |
~WifiRadioEnergyModelPhyListener () override | |
void | NotifyCcaBusyStart (Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations) override |
void | NotifyOff () override |
Notify listeners that we went to switch off. | |
void | NotifyOn () override |
Notify listeners that we went to switch on. | |
void | NotifyRxEndError () override |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has not been successfully received. | |
void | NotifyRxEndOk () override |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has been successfully received. | |
void | NotifyRxStart (Time duration) override |
void | NotifySleep () override |
Notify listeners that we went to sleep. | |
void | NotifySwitchingStart (Time duration) override |
void | NotifyTxStart (Time duration, dBm_u txPower) override |
void | NotifyWakeup () override |
Notify listeners that we woke up. | |
void | SetChangeStateCallback (energy::DeviceEnergyModel::ChangeStateCallback callback) |
Sets the change state callback. | |
void | SetUpdateTxCurrentCallback (UpdateTxCurrentCallback callback) |
Sets the update TX current callback. | |
![]() | |
virtual | ~WifiPhyListener () |
Private Member Functions | |
void | SwitchToIdle () |
A helper function that makes scheduling m_changeStateCallback possible. | |
Private Attributes | |
energy::DeviceEnergyModel::ChangeStateCallback | m_changeStateCallback |
Change state callback used to notify the WifiRadioEnergyModel of a state change. | |
EventId | m_switchToIdleEvent |
switch to idle event | |
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. | |
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.
Definition at line 32 of file wifi-radio-energy-model.h.
Callback type for updating the transmit current based on the nominal TX power.
Definition at line 38 of file wifi-radio-energy-model.h.
ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener | ( | ) |
Definition at line 464 of file wifi-radio-energy-model.cc.
References m_changeStateCallback, m_updateTxCurrentCallback, NS_LOG_FUNCTION, and ns3::Callback< R, UArgs >::Nullify().
|
override |
Definition at line 471 of file wifi-radio-energy-model.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
duration | the expected busy duration. |
channelType | the channel type for which the CCA busy state is reported. |
per20MhzDurations | vector that indicates for how long each 20 MHz subchannel (corresponding to the index of the element in the vector) is busy and where a zero duration indicates that the subchannel is idle. The vector is non-empty if the PHY supports 802.11ax or later and if the operational channel width is larger than 20 MHz. |
This method does not really report a real state change as opposed to the other methods in this class. It merely reports that, unless the medium is reported busy through NotifyTxStart or NotifyRxStart/End, it will be busy as defined by the currently selected CCA mode.
Typical client code which wants to have a clear picture of the CCA state will need to keep track of the time at which the last NotifyCcaBusyStart method is called and what duration it reported.
Implements ns3::WifiPhyListener.
Definition at line 548 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::CCA_BUSY, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SwitchToIdle().
|
overridevirtual |
Notify listeners that we went to switch off.
Implements ns3::WifiPhyListener.
Definition at line 603 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::OFF.
|
overridevirtual |
Notify listeners that we went to switch on.
Implements ns3::WifiPhyListener.
Definition at line 615 of file wifi-radio-energy-model.cc.
References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has not been successfully received.
Implements ns3::WifiPhyListener.
Definition at line 517 of file wifi-radio-energy-model.cc.
References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has been successfully received.
Implements ns3::WifiPhyListener.
Definition at line 506 of file wifi-radio-energy-model.cc.
References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
duration | the expected duration of the packet reception. |
We have received the first bit of a packet. We decided that we could synchronize on this packet. It does not mean we will be able to successfully receive completely the whole packet. It means that we will report a BUSY status until one of the following happens:
Implements ns3::WifiPhyListener.
Definition at line 494 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::RX.
|
overridevirtual |
Notify listeners that we went to sleep.
Implements ns3::WifiPhyListener.
Definition at line 580 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::SLEEP.
|
overridevirtual |
duration | the expected channel switching duration. |
We do not send any event to notify the end of channel switching. Listeners should assume that the channel implicitly reverts to the idle or busy states.
Implements ns3::WifiPhyListener.
Definition at line 565 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::SWITCHING, and SwitchToIdle().
|
overridevirtual |
duration | the expected transmission duration. |
txPower | the nominal TX power |
We are about to send the first bit of the packet. We do not send any event to notify the end of transmission. Listeners should assume that the channel implicitly reverts to the idle state unless they have received a CCA busy report.
Implements ns3::WifiPhyListener.
Definition at line 528 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, m_updateTxCurrentCallback, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SwitchToIdle(), and ns3::TX.
|
overridevirtual |
Notify listeners that we woke up.
Implements ns3::WifiPhyListener.
Definition at line 592 of file wifi-radio-energy-model.cc.
References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback | ( | energy::DeviceEnergyModel::ChangeStateCallback | callback | ) |
Sets the change state callback.
Used by helper class.
callback | Change state callback. |
Definition at line 477 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_ASSERT, and NS_LOG_FUNCTION.
void ns3::WifiRadioEnergyModelPhyListener::SetUpdateTxCurrentCallback | ( | UpdateTxCurrentCallback | callback | ) |
Sets the update TX current callback.
callback | Update TX current callback. |
Definition at line 486 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, UArgs >::IsNull(), m_updateTxCurrentCallback, NS_ASSERT, and NS_LOG_FUNCTION.
|
private |
A helper function that makes scheduling m_changeStateCallback possible.
Definition at line 626 of file wifi-radio-energy-model.cc.
References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by NotifyCcaBusyStart(), NotifySwitchingStart(), and NotifyTxStart().
|
private |
Change state callback used to notify the WifiRadioEnergyModel of a state change.
Definition at line 80 of file wifi-radio-energy-model.h.
Referenced by WifiRadioEnergyModelPhyListener(), NotifyCcaBusyStart(), NotifyOff(), NotifyOn(), NotifyRxEndError(), NotifyRxEndOk(), NotifyRxStart(), NotifySleep(), NotifySwitchingStart(), NotifyTxStart(), NotifyWakeup(), SetChangeStateCallback(), and SwitchToIdle().
|
private |
switch to idle event
Definition at line 88 of file wifi-radio-energy-model.h.
Referenced by NotifyCcaBusyStart(), 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 86 of file wifi-radio-energy-model.h.
Referenced by WifiRadioEnergyModelPhyListener(), NotifyTxStart(), and SetUpdateTxCurrentCallback().