A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::WifiRadioEnergyModelPhyListener Class Reference

A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change. More...

#include "wifi-radio-energy-model.h"

+ Inheritance diagram for ns3::WifiRadioEnergyModelPhyListener:
+ Collaboration diagram for ns3::WifiRadioEnergyModelPhyListener:

Public Types

typedef Callback< void, doubleUpdateTxCurrentCallback
 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.
 
- Public Member Functions inherited from ns3::WifiPhyListener
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.
 

Detailed Description

A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.

Definition at line 43 of file wifi-radio-energy-model.h.

Member Typedef Documentation

◆ UpdateTxCurrentCallback

Callback type for updating the transmit current based on the nominal TX power.

Definition at line 49 of file wifi-radio-energy-model.h.

Constructor & Destructor Documentation

◆ WifiRadioEnergyModelPhyListener()

ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener ( )

Definition at line 475 of file wifi-radio-energy-model.cc.

References m_changeStateCallback, m_updateTxCurrentCallback, NS_LOG_FUNCTION, and ns3::Callback< R, UArgs >::Nullify().

+ Here is the call graph for this function:

◆ ~WifiRadioEnergyModelPhyListener()

ns3::WifiRadioEnergyModelPhyListener::~WifiRadioEnergyModelPhyListener ( )
override

Definition at line 482 of file wifi-radio-energy-model.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ NotifyCcaBusyStart()

void ns3::WifiRadioEnergyModelPhyListener::NotifyCcaBusyStart ( Time  duration,
WifiChannelListType  channelType,
const std::vector< Time > &  per20MhzDurations 
)
overridevirtual
Parameters
durationthe expected busy duration.
channelTypethe channel type for which the CCA busy state is reported.
per20MhzDurationsvector 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 559 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().

+ Here is the call graph for this function:

◆ NotifyOff()

void ns3::WifiRadioEnergyModelPhyListener::NotifyOff ( )
overridevirtual

Notify listeners that we went to switch off.

Implements ns3::WifiPhyListener.

Definition at line 614 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.

+ Here is the call graph for this function:

◆ NotifyOn()

void ns3::WifiRadioEnergyModelPhyListener::NotifyOn ( )
overridevirtual

Notify listeners that we went to switch on.

Implements ns3::WifiPhyListener.

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.

+ Here is the call graph for this function:

◆ NotifyRxEndError()

void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndError ( )
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 528 of file wifi-radio-energy-model.cc.

References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyRxEndOk()

void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndOk ( )
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 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.

+ Here is the call graph for this function:

◆ NotifyRxStart()

void ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart ( Time  duration)
overridevirtual
Parameters
durationthe 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:

  • NotifyRxEndOk
  • NotifyRxEndError
  • NotifyTxStart

Implements ns3::WifiPhyListener.

Definition at line 505 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.

+ Here is the call graph for this function:

◆ NotifySleep()

void ns3::WifiRadioEnergyModelPhyListener::NotifySleep ( )
overridevirtual

Notify listeners that we went to sleep.

Implements ns3::WifiPhyListener.

Definition at line 591 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.

+ Here is the call graph for this function:

◆ NotifySwitchingStart()

void ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart ( Time  duration)
overridevirtual
Parameters
durationthe 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 576 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().

+ Here is the call graph for this function:

◆ NotifyTxStart()

void ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart ( Time  duration,
double  txPowerDbm 
)
overridevirtual
Parameters
durationthe expected transmission duration.
txPowerDbmthe 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 539 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.

+ Here is the call graph for this function:

◆ NotifyWakeup()

void ns3::WifiRadioEnergyModelPhyListener::NotifyWakeup ( )
overridevirtual

Notify listeners that we woke up.

Implements ns3::WifiPhyListener.

Definition at line 603 of file wifi-radio-energy-model.cc.

References ns3::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetChangeStateCallback()

void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback ( DeviceEnergyModel::ChangeStateCallback  callback)

Sets the change state callback.

Used by helper class.

Parameters
callbackChange state callback.

Definition at line 488 of file wifi-radio-energy-model.cc.

References ns3::Callback< R, UArgs >::IsNull(), m_changeStateCallback, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetUpdateTxCurrentCallback()

void ns3::WifiRadioEnergyModelPhyListener::SetUpdateTxCurrentCallback ( UpdateTxCurrentCallback  callback)

Sets the update TX current callback.

Parameters
callbackUpdate TX current callback.

Definition at line 497 of file wifi-radio-energy-model.cc.

References ns3::Callback< R, UArgs >::IsNull(), m_updateTxCurrentCallback, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchToIdle()

void ns3::WifiRadioEnergyModelPhyListener::SwitchToIdle ( )
private

A helper function that makes scheduling m_changeStateCallback possible.

Definition at line 637 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_changeStateCallback

◆ m_switchToIdleEvent

EventId ns3::WifiRadioEnergyModelPhyListener::m_switchToIdleEvent
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().

◆ m_updateTxCurrentCallback

UpdateTxCurrentCallback ns3::WifiRadioEnergyModelPhyListener::m_updateTxCurrentCallback
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().


The documentation for this class was generated from the following files: