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

This objects implements the PHY state machine of the Wifi device. More...

#include "wifi-phy-state-helper.h"

+ Inheritance diagram for ns3::WifiPhyStateHelper:
+ Collaboration diagram for ns3::WifiPhyStateHelper:

Public Types

typedef void(* RxEndErrorTracedCallback) (Ptr< const Packet > packet, double snr)
 TracedCallback signature for receive end error event.
 
typedef void(* RxOkTracedCallback) (Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
 TracedCallback signature for receive end OK event.
 
typedef void(* RxOutcomeTracedCallback) (Ptr< const WifiPsdu > psdu, RxSignalInfo signalInfo, const WifiTxVector &txVector, const std::vector< bool > &outcomes)
 TracedCallback signature for the outcome of a received packet.
 
typedef void(* StateTracedCallback) (Time start, Time duration, WifiPhyState state)
 TracedCallback signature for state changes.
 
typedef void(* TxTracedCallback) (Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t power)
 TracedCallback signature for transmit event.
 

Public Member Functions

 WifiPhyStateHelper ()
 
Time GetDelayUntilIdle () const
 Return the time before the state is back to IDLE.
 
Time GetLastRxEndTime () const
 Return the time the last RX end.
 
Time GetLastRxStartTime () const
 Return the time the last RX start.
 
Time GetLastTime (std::initializer_list< WifiPhyState > states) const
 
WifiPhyState GetState () const
 Return the current state of WifiPhy.
 
bool IsStateCcaBusy () const
 Check whether the current state is CCA busy.
 
bool IsStateIdle () const
 Check whether the current state is IDLE.
 
bool IsStateOff () const
 Check whether the current state is OFF.
 
bool IsStateRx () const
 Check whether the current state is RX.
 
bool IsStateSleep () const
 Check whether the current state is SLEEP.
 
bool IsStateSwitching () const
 Check whether the current state is SWITCHING.
 
bool IsStateTx () const
 Check whether the current state is TX.
 
template<typename FUNC , typename... Ts>
void NotifyListeners (FUNC f, Ts &&... args)
 Notify all WifiPhyListener objects of the given PHY event.
 
void NotifyRxMpdu (Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector)
 Notify the reception of an MPDU included in an A-MPDU.
 
void NotifyRxPpduOutcome (Ptr< const WifiPpdu > ppdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, uint16_t staId, const std::vector< bool > &statusPerMpdu)
 Handle the outcome of a reception of a PPDU.
 
void NotifyRxPsduFailed (Ptr< const WifiPsdu > psdu, double snr)
 Handle the unsuccessful reception of a PSDU.
 
void NotifyRxPsduSucceeded (Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, uint16_t staId, const std::vector< bool > &statusPerMpdu)
 Handle the successful reception of a PSDU.
 
void RegisterListener (const std::shared_ptr< WifiPhyListener > &listener)
 Register WifiPhyListener to this WifiPhyStateHelper.
 
void SetReceiveErrorCallback (RxErrorCallback callback)
 Set a callback for a failed reception.
 
void SetReceiveOkCallback (RxOkCallback callback)
 Set a callback for a successful reception.
 
void SwitchFromOff ()
 Switch from off mode.
 
void SwitchFromRxAbort (MHz_u operatingWidth)
 Abort current reception following a CCA reset request.
 
void SwitchFromRxEndError ()
 Switch from RX after the reception failed.
 
void SwitchFromRxEndOk ()
 Switch from RX after the reception was successful.
 
void SwitchFromSleep ()
 Switch from sleep mode.
 
void SwitchMaybeToCcaBusy (Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations)
 Switch to CCA busy.
 
void SwitchToChannelSwitching (Time switchingDuration)
 Switch state to channel switching for the given duration.
 
void SwitchToOff ()
 Switch to off mode.
 
void SwitchToRx (Time rxDuration)
 Switch state to RX for the given duration.
 
void SwitchToSleep ()
 Switch to sleep mode.
 
void SwitchToTx (Time txDuration, const WifiConstPsduMap &psdus, dBm_u txPower, const WifiTxVector &txVector)
 Switch state to TX for the given duration.
 
void UnregisterListener (const std::shared_ptr< WifiPhyListener > &listener)
 Remove WifiPhyListener from this WifiPhyStateHelper.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Private Types

typedef std::list< std::weak_ptr< WifiPhyListener > > Listeners
 typedef for a list of WifiPhyListeners.
 

Private Member Functions

void DoSwitchFromRx ()
 Switch the state from RX.
 
void LogPreviousIdleAndCcaBusyStates ()
 Log the idle and CCA busy states.
 

Private Attributes

Time m_endCcaBusy
 end CCA busy
 
Time m_endIdle
 end idle
 
Time m_endOff
 end off
 
Time m_endRx
 end receive
 
Time m_endSleep
 end sleep
 
Time m_endSwitching
 end switching
 
Time m_endTx
 end transmit
 
bool m_isOff
 switched off
 
Listeners m_listeners
 listeners
 
Time m_previousStateChangeTime
 previous state change time
 
RxErrorCallback m_rxErrorCallback
 receive error callback
 
TracedCallback< Ptr< const Packet >, doublem_rxErrorTrace
 receive error trace callback
 
RxOkCallback m_rxOkCallback
 receive OK callback
 
TracedCallback< Ptr< const Packet >, double, WifiMode, WifiPreamblem_rxOkTrace
 receive OK trace callback
 
TracedCallback< Ptr< const WifiPpdu >, RxSignalInfo, const WifiTxVector &, const std::vector< bool > & > m_rxOutcomeTrace
 receive OK trace callback
 
bool m_sleeping
 sleeping
 
Time m_startCcaBusy
 start CCA busy
 
Time m_startOff
 start off
 
Time m_startRx
 start receive
 
Time m_startSleep
 start sleep
 
Time m_startSwitching
 start switching
 
Time m_startTx
 start transmit
 
TracedCallback< Time, Time, WifiPhyStatem_stateLogger
 The trace source fired when state is changed.
 
TracedCallback< Ptr< const Packet >, WifiMode, WifiPreamble, uint8_t > m_txTrace
 transmit trace callback
 
 NS_LOG_TEMPLATE_DECLARE
 the log component
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Detailed Description

This objects implements the PHY state machine of the Wifi device.

Config Paths

ns3::WifiPhyStateHelper is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phy/State"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phys/[i]/State"

No Attributes are defined for this type.

TraceSources

Group: Wifi

Size of this type is 344 bytes (on a 64-bit architecture).

Definition at line 61 of file wifi-phy-state-helper.h.

Member Typedef Documentation

◆ Listeners

typedef std::list<std::weak_ptr<WifiPhyListener> > ns3::WifiPhyStateHelper::Listeners
private

typedef for a list of WifiPhyListeners.

We use weak pointers so that unregistering a listener is not necessary to delete a listener (reference count is not incremented by weak pointers).

Definition at line 359 of file wifi-phy-state-helper.h.

◆ RxEndErrorTracedCallback

typedef void(* ns3::WifiPhyStateHelper::RxEndErrorTracedCallback) (Ptr< const Packet > packet, double snr)

TracedCallback signature for receive end error event.

Parameters
[in]packetThe received packet.
[in]snrThe SNR of the received packet in linear scale.

Definition at line 327 of file wifi-phy-state-helper.h.

◆ RxOkTracedCallback

typedef void(* ns3::WifiPhyStateHelper::RxOkTracedCallback) (Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)

TracedCallback signature for receive end OK event.

Parameters
[in]packetThe received packet.
[in]snrThe SNR of the received packet in linear scale.
[in]modeThe transmission mode of the packet.
[in]preambleThe preamble of the packet.

Definition at line 300 of file wifi-phy-state-helper.h.

◆ RxOutcomeTracedCallback

typedef void(* ns3::WifiPhyStateHelper::RxOutcomeTracedCallback) (Ptr< const WifiPsdu > psdu, RxSignalInfo signalInfo, const WifiTxVector &txVector, const std::vector< bool > &outcomes)

TracedCallback signature for the outcome of a received packet.

Parameters
[in]psduThe received PSDU (Physical Layer Service Data Unit).
[in]signalInfoInformation about the received signal, including its power and other characteristics.
[in]txVectorThe transmission vector used for the packet, detailing the transmission parameters.
[in]outcomesA vector of boolean values indicating the success or failure of receiving individual MPDUs within the PSDU.

Definition at line 316 of file wifi-phy-state-helper.h.

◆ StateTracedCallback

typedef void(* ns3::WifiPhyStateHelper::StateTracedCallback) (Time start, Time duration, WifiPhyState state)

TracedCallback signature for state changes.

Parameters
[in]startTime when the state started.
[in]durationAmount of time we've been in (or will be in) the state .
[in]stateThe state.

Definition at line 290 of file wifi-phy-state-helper.h.

◆ TxTracedCallback

typedef void(* ns3::WifiPhyStateHelper::TxTracedCallback) (Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t power)

TracedCallback signature for transmit event.

Parameters
[in]packetThe received packet.
[in]modeThe transmission mode of the packet.
[in]preambleThe preamble of the packet.
[in]powerThe transmit power level.

Definition at line 337 of file wifi-phy-state-helper.h.

Constructor & Destructor Documentation

◆ WifiPhyStateHelper()

ns3::WifiPhyStateHelper::WifiPhyStateHelper ( )

Definition at line 63 of file wifi-phy-state-helper.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ DoSwitchFromRx()

void ns3::WifiPhyStateHelper::DoSwitchFromRx ( )
private

Switch the state from RX.

Definition at line 493 of file wifi-phy-state-helper.cc.

References IsStateCcaBusy(), IsStateIdle(), m_endRx, m_previousStateChangeTime, m_startRx, m_stateLogger, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, and ns3::RX.

Referenced by SwitchFromRxAbort(), SwitchFromRxEndError(), and SwitchFromRxEndOk().

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

◆ GetDelayUntilIdle()

Time ns3::WifiPhyStateHelper::GetDelayUntilIdle ( ) const

Return the time before the state is back to IDLE.

Returns
the delay before the state is back to IDLE

Definition at line 152 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, m_endCcaBusy, m_endRx, m_endSwitching, m_endTx, Max, ns3::Simulator::Now(), NS_FATAL_ERROR, ns3::OFF, ns3::RX, ns3::Seconds(), ns3::SLEEP, ns3::SWITCHING, and ns3::TX.

+ Here is the call graph for this function:

◆ GetLastRxEndTime()

Time ns3::WifiPhyStateHelper::GetLastRxEndTime ( ) const

Return the time the last RX end.

Returns
the time the last RX end.

Definition at line 191 of file wifi-phy-state-helper.cc.

References m_endRx.

◆ GetLastRxStartTime()

Time ns3::WifiPhyStateHelper::GetLastRxStartTime ( ) const

Return the time the last RX start.

Returns
the time the last RX start.

Definition at line 185 of file wifi-phy-state-helper.cc.

References m_startRx.

◆ GetLastTime()

Time ns3::WifiPhyStateHelper::GetLastTime ( std::initializer_list< WifiPhyState > states) const
Parameters
statesa set of PHY states
Returns
the last time the PHY has been in any of the given states

Definition at line 197 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, m_endCcaBusy, m_endIdle, m_endOff, m_endRx, m_endSleep, m_endSwitching, m_endTx, ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, ns3::OFF, ns3::RX, ns3::SLEEP, ns3::SWITCHING, and ns3::TX.

+ Here is the call graph for this function:

◆ GetState()

WifiPhyState ns3::WifiPhyStateHelper::GetState ( ) const

Return the current state of WifiPhy.

Returns
the current state of WifiPhy

Definition at line 241 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, ns3::IDLE, m_endCcaBusy, m_endRx, m_endSwitching, m_endTx, m_isOff, m_sleeping, ns3::Simulator::Now(), ns3::OFF, ns3::RX, ns3::SLEEP, ns3::SWITCHING, and ns3::TX.

Referenced by GetDelayUntilIdle(), GetLastTime(), IsStateCcaBusy(), IsStateIdle(), IsStateOff(), IsStateRx(), IsStateSleep(), IsStateSwitching(), IsStateTx(), LogPreviousIdleAndCcaBusyStates(), SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToOff(), SwitchToRx(), SwitchToSleep(), and SwitchToTx().

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

◆ GetTypeId()

TypeId ns3::WifiPhyStateHelper::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 32 of file wifi-phy-state-helper.cc.

References m_rxErrorTrace, m_rxOkTrace, m_rxOutcomeTrace, m_stateLogger, m_txTrace, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ IsStateCcaBusy()

bool ns3::WifiPhyStateHelper::IsStateCcaBusy ( ) const

Check whether the current state is CCA busy.

Returns
true if the current state is CCA busy, false otherwise

Definition at line 116 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, and GetState().

Referenced by DoSwitchFromRx(), SwitchFromRxAbort(), and SwitchToRx().

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

◆ IsStateIdle()

bool ns3::WifiPhyStateHelper::IsStateIdle ( ) const

Check whether the current state is IDLE.

Returns
true if the current state is IDLE, false otherwise

Definition at line 110 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::IDLE.

Referenced by DoSwitchFromRx(), SwitchFromRxAbort(), and SwitchToRx().

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

◆ IsStateOff()

bool ns3::WifiPhyStateHelper::IsStateOff ( ) const

Check whether the current state is OFF.

Returns
true if the current state is OFF, false otherwise

Definition at line 146 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::OFF.

Referenced by SwitchFromOff(), and SwitchToOff().

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

◆ IsStateRx()

bool ns3::WifiPhyStateHelper::IsStateRx ( ) const

Check whether the current state is RX.

Returns
true if the current state is RX, false otherwise

Definition at line 122 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::RX.

Referenced by SwitchToRx().

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

◆ IsStateSleep()

bool ns3::WifiPhyStateHelper::IsStateSleep ( ) const

Check whether the current state is SLEEP.

Returns
true if the current state is SLEEP, false otherwise

Definition at line 140 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::SLEEP.

Referenced by SwitchFromSleep(), and SwitchToSleep().

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

◆ IsStateSwitching()

bool ns3::WifiPhyStateHelper::IsStateSwitching ( ) const

Check whether the current state is SWITCHING.

Returns
true if the current state is SWITCHING, false otherwise

Definition at line 134 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::SWITCHING.

Referenced by SwitchToChannelSwitching().

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

◆ IsStateTx()

bool ns3::WifiPhyStateHelper::IsStateTx ( ) const

Check whether the current state is TX.

Returns
true if the current state is TX, false otherwise

Definition at line 128 of file wifi-phy-state-helper.cc.

References GetState(), and ns3::TX.

+ Here is the call graph for this function:

◆ LogPreviousIdleAndCcaBusyStates()

void ns3::WifiPhyStateHelper::LogPreviousIdleAndCcaBusyStates ( )
private

Log the idle and CCA busy states.

Definition at line 275 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, m_endCcaBusy, m_endIdle, m_endOff, m_endRx, m_endSleep, m_endSwitching, m_endTx, m_startCcaBusy, m_stateLogger, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToOff(), SwitchToRx(), SwitchToSleep(), and SwitchToTx().

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

◆ NotifyListeners()

template<typename FUNC , typename... Ts>
void ns3::WifiPhyStateHelper::NotifyListeners ( FUNC f,
Ts &&... args )

Notify all WifiPhyListener objects of the given PHY event.

Template Parameters
FUNC[deduced] Member function type
Ts[deduced] Function argument types
Parameters
fthe member function to invoke
argsarguments to pass to the member function

Definition at line 417 of file wifi-phy-state-helper.h.

References m_listeners, and NS_LOG_FUNCTION.

Referenced by SwitchFromOff(), SwitchFromRxAbort(), SwitchFromRxEndError(), SwitchFromRxEndOk(), SwitchFromSleep(), SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToOff(), SwitchToRx(), SwitchToSleep(), and SwitchToTx().

+ Here is the caller graph for this function:

◆ NotifyRxMpdu()

void ns3::WifiPhyStateHelper::NotifyRxMpdu ( Ptr< const WifiPsdu > psdu,
RxSignalInfo rxSignalInfo,
const WifiTxVector & txVector )

Notify the reception of an MPDU included in an A-MPDU.

Parameters
psduthe successfully received PSDU
rxSignalInfothe info on the received signal (
See also
RxSignalInfo)
Parameters
txVectorTXVECTOR of the PSDU

Definition at line 414 of file wifi-phy-state-helper.cc.

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

+ Here is the call graph for this function:

◆ NotifyRxPpduOutcome()

void ns3::WifiPhyStateHelper::NotifyRxPpduOutcome ( Ptr< const WifiPpdu > ppdu,
RxSignalInfo rxSignalInfo,
const WifiTxVector & txVector,
uint16_t staId,
const std::vector< bool > & statusPerMpdu )

Handle the outcome of a reception of a PPDU.

Parameters
ppduthe received PPDU
rxSignalInfothe info on the received signal (
See also
RxSignalInfo)
Parameters
txVectorTXVECTOR of the PSDU
staIdthe station ID of the PSDU (only used for MU)
statusPerMpdureception status per MPDU

Definition at line 465 of file wifi-phy-state-helper.cc.

References m_rxOutcomeTrace.

◆ NotifyRxPsduFailed()

void ns3::WifiPhyStateHelper::NotifyRxPsduFailed ( Ptr< const WifiPsdu > psdu,
double snr )

Handle the unsuccessful reception of a PSDU.

Parameters
psduthe PSDU that we failed to received
snrthe SNR of the received PSDU in linear scale

Definition at line 451 of file wifi-phy-state-helper.cc.

References ns3::Callback< R, UArgs >::IsNull(), m_rxErrorCallback, m_rxErrorTrace, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyRxPsduSucceeded()

void ns3::WifiPhyStateHelper::NotifyRxPsduSucceeded ( Ptr< const WifiPsdu > psdu,
RxSignalInfo rxSignalInfo,
const WifiTxVector & txVector,
uint16_t staId,
const std::vector< bool > & statusPerMpdu )

Handle the successful reception of a PSDU.

Parameters
psduthe successfully received PSDU
rxSignalInfothe info on the received signal (
See also
RxSignalInfo)
Parameters
txVectorTXVECTOR of the PSDU
staIdthe station ID of the PSDU (only used for MU)
statusPerMpdureception status per MPDU

Definition at line 426 of file wifi-phy-state-helper.cc.

References ns3::WifiTxVector::GetMode(), ns3::WifiTxVector::GetPreambleType(), ns3::Callback< R, UArgs >::IsNull(), m_rxOkCallback, m_rxOkTrace, NS_ASSERT, NS_LOG_FUNCTION, and ns3::RxSignalInfo::snr.

+ Here is the call graph for this function:

◆ RegisterListener()

void ns3::WifiPhyStateHelper::RegisterListener ( const std::shared_ptr< WifiPhyListener > & listener)

Register WifiPhyListener to this WifiPhyStateHelper.

Parameters
listenerthe WifiPhyListener to register

Definition at line 98 of file wifi-phy-state-helper.cc.

References m_listeners.

◆ SetReceiveErrorCallback()

void ns3::WifiPhyStateHelper::SetReceiveErrorCallback ( RxErrorCallback callback)

Set a callback for a failed reception.

Parameters
callbackthe RxErrorCallback to set

Definition at line 92 of file wifi-phy-state-helper.cc.

References m_rxErrorCallback.

◆ SetReceiveOkCallback()

void ns3::WifiPhyStateHelper::SetReceiveOkCallback ( RxOkCallback callback)

Set a callback for a successful reception.

Parameters
callbackthe RxOkCallback to set

Definition at line 86 of file wifi-phy-state-helper.cc.

References m_rxOkCallback.

◆ SwitchFromOff()

void ns3::WifiPhyStateHelper::SwitchFromOff ( )

Switch from off mode.

Definition at line 626 of file wifi-phy-state-helper.cc.

References IsStateOff(), m_endOff, m_isOff, m_previousStateChangeTime, NotifyListeners(), ns3::WifiPhyListener::NotifyOn(), ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchFromRxAbort()

void ns3::WifiPhyStateHelper::SwitchFromRxAbort ( MHz_u operatingWidth)

Abort current reception following a CCA reset request.

Parameters
operatingWidththe channel width the PHY is operating on

Definition at line 568 of file wifi-phy-state-helper.cc.

References DoSwitchFromRx(), IsStateCcaBusy(), IsStateIdle(), m_endCcaBusy, ns3::WifiPhyListener::NotifyCcaBusyStart(), NotifyListeners(), ns3::WifiPhyListener::NotifyRxEndOk(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Seconds(), and ns3::WIFI_CHANLIST_PRIMARY.

+ Here is the call graph for this function:

◆ SwitchFromRxEndError()

void ns3::WifiPhyStateHelper::SwitchFromRxEndError ( )

Switch from RX after the reception failed.

Definition at line 484 of file wifi-phy-state-helper.cc.

References DoSwitchFromRx(), m_endRx, NotifyListeners(), ns3::WifiPhyListener::NotifyRxEndError(), ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchFromRxEndOk()

void ns3::WifiPhyStateHelper::SwitchFromRxEndOk ( )

Switch from RX after the reception was successful.

Definition at line 475 of file wifi-phy-state-helper.cc.

References DoSwitchFromRx(), m_endRx, NotifyListeners(), ns3::WifiPhyListener::NotifyRxEndOk(), ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchFromSleep()

void ns3::WifiPhyStateHelper::SwitchFromSleep ( )

Switch from sleep mode.

Definition at line 555 of file wifi-phy-state-helper.cc.

References IsStateSleep(), m_endSleep, m_previousStateChangeTime, m_sleeping, m_startSleep, m_stateLogger, NotifyListeners(), ns3::WifiPhyListener::NotifyWakeup(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, and ns3::SLEEP.

+ Here is the call graph for this function:

◆ SwitchMaybeToCcaBusy()

void ns3::WifiPhyStateHelper::SwitchMaybeToCcaBusy ( Time duration,
WifiChannelListType channelType,
const std::vector< Time > & per20MhzDurations )

Switch to CCA busy.

Parameters
durationthe duration of the CCA state
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.

Definition at line 504 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, LogPreviousIdleAndCcaBusyStates(), m_endCcaBusy, m_startCcaBusy, ns3::WifiPhyListener::NotifyCcaBusyStart(), NotifyListeners(), ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::RX, and ns3::WIFI_CHANLIST_PRIMARY.

+ Here is the call graph for this function:

◆ SwitchToChannelSwitching()

void ns3::WifiPhyStateHelper::SwitchToChannelSwitching ( Time switchingDuration)

Switch state to channel switching for the given duration.

Parameters
switchingDurationthe duration of required to switch the channel

Definition at line 378 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, IsStateSwitching(), ns3::Time::IsZero(), LogPreviousIdleAndCcaBusyStates(), m_endCcaBusy, m_endRx, m_endSwitching, m_previousStateChangeTime, m_startRx, m_startSwitching, m_stateLogger, NotifyListeners(), ns3::WifiPhyListener::NotifySwitchingStart(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::RX, and ns3::SWITCHING.

+ Here is the call graph for this function:

◆ SwitchToOff()

void ns3::WifiPhyStateHelper::SwitchToOff ( )

Switch to off mode.

Definition at line 589 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, IsStateOff(), LogPreviousIdleAndCcaBusyStates(), m_endRx, m_endTx, m_isOff, m_previousStateChangeTime, m_startOff, m_startRx, m_startTx, m_stateLogger, NotifyListeners(), ns3::WifiPhyListener::NotifyOff(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::RX, and ns3::TX.

+ Here is the call graph for this function:

◆ SwitchToRx()

void ns3::WifiPhyStateHelper::SwitchToRx ( Time rxDuration)

Switch state to RX for the given duration.

Parameters
rxDurationthe duration of the RX

Definition at line 354 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, IsStateCcaBusy(), IsStateIdle(), IsStateRx(), LogPreviousIdleAndCcaBusyStates(), m_endRx, m_previousStateChangeTime, m_startRx, NotifyListeners(), ns3::WifiPhyListener::NotifyRxStart(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchToSleep()

void ns3::WifiPhyStateHelper::SwitchToSleep ( )

Switch to sleep mode.

Definition at line 532 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, GetState(), ns3::IDLE, IsStateSleep(), LogPreviousIdleAndCcaBusyStates(), m_previousStateChangeTime, m_sleeping, m_startSleep, NotifyListeners(), ns3::WifiPhyListener::NotifySleep(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SwitchToTx()

void ns3::WifiPhyStateHelper::SwitchToTx ( Time txDuration,
const WifiConstPsduMap & psdus,
dBm_u txPower,
const WifiTxVector & txVector )

Switch state to TX for the given duration.

Parameters
txDurationthe duration of the PPDU to transmit
psdusthe PSDUs in the transmitted PPDU (only one unless it is a MU PPDU)
txPowerthe nominal TX power
txVectorthe TX vector for the transmission

Definition at line 311 of file wifi-phy-state-helper.cc.

References ns3::CCA_BUSY, ns3::WifiTxVector::GetMode(), ns3::WifiTxVector::GetPreambleType(), GetState(), ns3::WifiTxVector::GetTxPowerLevel(), ns3::IDLE, LogPreviousIdleAndCcaBusyStates(), m_endRx, m_endTx, m_previousStateChangeTime, m_startRx, m_startTx, m_stateLogger, m_txTrace, NotifyListeners(), ns3::WifiPhyListener::NotifyTxStart(), ns3::Simulator::Now(), NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::RX, and ns3::TX.

+ Here is the call graph for this function:

◆ UnregisterListener()

void ns3::WifiPhyStateHelper::UnregisterListener ( const std::shared_ptr< WifiPhyListener > & listener)

Remove WifiPhyListener from this WifiPhyStateHelper.

Parameters
listenerthe WifiPhyListener to unregister

Definition at line 104 of file wifi-phy-state-helper.cc.

References m_listeners.

Member Data Documentation

◆ m_endCcaBusy

Time ns3::WifiPhyStateHelper::m_endCcaBusy
private

◆ m_endIdle

Time ns3::WifiPhyStateHelper::m_endIdle
private

end idle

Definition at line 385 of file wifi-phy-state-helper.h.

Referenced by GetLastTime(), and LogPreviousIdleAndCcaBusyStates().

◆ m_endOff

Time ns3::WifiPhyStateHelper::m_endOff
private

end off

Definition at line 384 of file wifi-phy-state-helper.h.

Referenced by GetLastTime(), LogPreviousIdleAndCcaBusyStates(), and SwitchFromOff().

◆ m_endRx

◆ m_endSleep

Time ns3::WifiPhyStateHelper::m_endSleep
private

end sleep

Definition at line 383 of file wifi-phy-state-helper.h.

Referenced by GetLastTime(), LogPreviousIdleAndCcaBusyStates(), and SwitchFromSleep().

◆ m_endSwitching

Time ns3::WifiPhyStateHelper::m_endSwitching
private

◆ m_endTx

Time ns3::WifiPhyStateHelper::m_endTx
private

◆ m_isOff

bool ns3::WifiPhyStateHelper::m_isOff
private

switched off

Definition at line 378 of file wifi-phy-state-helper.h.

Referenced by GetState(), SwitchFromOff(), and SwitchToOff().

◆ m_listeners

Listeners ns3::WifiPhyStateHelper::m_listeners
private

listeners

Definition at line 394 of file wifi-phy-state-helper.h.

Referenced by NotifyListeners(), RegisterListener(), and UnregisterListener().

◆ m_previousStateChangeTime

Time ns3::WifiPhyStateHelper::m_previousStateChangeTime
private

◆ m_rxErrorCallback

RxErrorCallback ns3::WifiPhyStateHelper::m_rxErrorCallback
private

receive error callback

Definition at line 403 of file wifi-phy-state-helper.h.

Referenced by NotifyRxPsduFailed(), and SetReceiveErrorCallback().

◆ m_rxErrorTrace

TracedCallback<Ptr<const Packet>, double> ns3::WifiPhyStateHelper::m_rxErrorTrace
private

receive error trace callback

Definition at line 399 of file wifi-phy-state-helper.h.

Referenced by GetTypeId(), and NotifyRxPsduFailed().

◆ m_rxOkCallback

RxOkCallback ns3::WifiPhyStateHelper::m_rxOkCallback
private

receive OK callback

Definition at line 402 of file wifi-phy-state-helper.h.

Referenced by NotifyRxMpdu(), NotifyRxPsduSucceeded(), and SetReceiveOkCallback().

◆ m_rxOkTrace

TracedCallback<Ptr<const Packet>, double, WifiMode, WifiPreamble> ns3::WifiPhyStateHelper::m_rxOkTrace
private

receive OK trace callback

Definition at line 396 of file wifi-phy-state-helper.h.

Referenced by GetTypeId(), and NotifyRxPsduSucceeded().

◆ m_rxOutcomeTrace

TracedCallback<Ptr<const WifiPpdu>, RxSignalInfo, const WifiTxVector&, const std::vector<bool>&> ns3::WifiPhyStateHelper::m_rxOutcomeTrace
private

receive OK trace callback

Definition at line 398 of file wifi-phy-state-helper.h.

Referenced by GetTypeId(), and NotifyRxPpduOutcome().

◆ m_sleeping

bool ns3::WifiPhyStateHelper::m_sleeping
private

sleeping

Definition at line 377 of file wifi-phy-state-helper.h.

Referenced by GetState(), SwitchFromSleep(), and SwitchToSleep().

◆ m_startCcaBusy

Time ns3::WifiPhyStateHelper::m_startCcaBusy
private

start CCA busy

Definition at line 388 of file wifi-phy-state-helper.h.

Referenced by LogPreviousIdleAndCcaBusyStates(), and SwitchMaybeToCcaBusy().

◆ m_startOff

Time ns3::WifiPhyStateHelper::m_startOff
private

start off

Definition at line 391 of file wifi-phy-state-helper.h.

Referenced by SwitchToOff().

◆ m_startRx

Time ns3::WifiPhyStateHelper::m_startRx
private

◆ m_startSleep

Time ns3::WifiPhyStateHelper::m_startSleep
private

start sleep

Definition at line 390 of file wifi-phy-state-helper.h.

Referenced by SwitchFromSleep(), and SwitchToSleep().

◆ m_startSwitching

Time ns3::WifiPhyStateHelper::m_startSwitching
private

start switching

Definition at line 389 of file wifi-phy-state-helper.h.

Referenced by SwitchToChannelSwitching().

◆ m_startTx

Time ns3::WifiPhyStateHelper::m_startTx
private

start transmit

Definition at line 386 of file wifi-phy-state-helper.h.

Referenced by SwitchToOff(), and SwitchToTx().

◆ m_stateLogger

TracedCallback<Time, Time, WifiPhyState> ns3::WifiPhyStateHelper::m_stateLogger
private

The trace source fired when state is changed.

Definition at line 374 of file wifi-phy-state-helper.h.

Referenced by DoSwitchFromRx(), GetTypeId(), LogPreviousIdleAndCcaBusyStates(), SwitchFromSleep(), SwitchToChannelSwitching(), SwitchToOff(), and SwitchToTx().

◆ m_txTrace

TracedCallback<Ptr<const Packet>, WifiMode, WifiPreamble, uint8_t> ns3::WifiPhyStateHelper::m_txTrace
private

transmit trace callback

Definition at line 401 of file wifi-phy-state-helper.h.

Referenced by GetTypeId(), and SwitchToTx().

◆ NS_LOG_TEMPLATE_DECLARE

ns3::WifiPhyStateHelper::NS_LOG_TEMPLATE_DECLARE
private

the log component

Definition at line 376 of file wifi-phy-state-helper.h.


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