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. | |
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, double txPowerDbm) override |
void | NotifyWakeup () override |
Notify listeners that we woke up. | |
void | SetChangeStateCallback (DeviceEnergyModel::ChangeStateCallback callback) |
Sets the change state callback. | |
void | SetUpdateTxCurrentCallback (UpdateTxCurrentCallback callback) |
Sets the update TX current callback. | |
![]() | |
virtual | ~WifiPhyListener () |
virtual void | NotifyCcaBusyStart (Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations)=0 |
virtual void | NotifyOff ()=0 |
Notify listeners that we went to switch off. | |
virtual void | NotifyOn ()=0 |
Notify listeners that we went to switch on. | |
virtual void | NotifyRxEndError ()=0 |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has not been successfully received. | |
virtual void | NotifyRxEndOk ()=0 |
We have received the last bit of a packet for which NotifyRxStart was invoked first and, the packet has been successfully received. | |
virtual void | NotifyRxStart (Time duration)=0 |
virtual void | NotifySleep ()=0 |
Notify listeners that we went to sleep. | |
virtual void | NotifySwitchingStart (Time duration)=0 |
virtual void | NotifyTxStart (Time duration, double txPowerDbm)=0 |
virtual void | NotifyWakeup ()=0 |
Notify listeners that we woke up. | |
Private Member Functions | |
void | SwitchToIdle () |
A helper function that makes scheduling m_changeStateCallback possible. | |
Private Attributes | |
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 43 of file wifi-radio-energy-model.h.
Callback type for updating the transmit current based on the nominal TX power.
Definition at line 49 of file wifi-radio-energy-model.h.
ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener | ( | ) |
Definition at line 474 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 481 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 558 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(), and SwitchToIdle().
|
overridevirtual |
Notify listeners that we went to switch off.
Implements ns3::WifiPhyListener.
Definition at line 613 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
Notify listeners that we went to switch on.
Implements ns3::WifiPhyListener.
Definition at line 625 of file wifi-radio-energy-model.cc.
References 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 527 of file wifi-radio-energy-model.cc.
References 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 516 of file wifi-radio-energy-model.cc.
References 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 504 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
overridevirtual |
Notify listeners that we went to sleep.
Implements ns3::WifiPhyListener.
Definition at line 590 of file wifi-radio-energy-model.cc.
References ns3::EventId::Cancel(), ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, m_switchToIdleEvent, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
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 575 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(), and SwitchToIdle().
|
overridevirtual |
duration | the expected transmission duration. |
txPowerDbm | the nominal TX power in dBm |
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 538 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(), and SwitchToIdle().
|
overridevirtual |
Notify listeners that we woke up.
Implements ns3::WifiPhyListener.
Definition at line 602 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, UArgs >::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 487 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, UArgs >::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 496 of file wifi-radio-energy-model.cc.
References ns3::Callback< R, UArgs >::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 636 of file wifi-radio-energy-model.cc.
References 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 91 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 99 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 97 of file wifi-radio-energy-model.h.
Referenced by WifiRadioEnergyModelPhyListener(), NotifyTxStart(), and SetUpdateTxCurrentCallback().