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 Member Functions | |
| WifiPhyStateHelper () | |
| Time | GetDelayUntilIdle (void) |
| Return the time before the state is back to IDLE. More... | |
| Time | GetLastRxStartTime (void) const |
| Return the time the last RX start. More... | |
| enum WifiPhy::State | GetState (void) |
| Return the current state of WifiPhy. More... | |
| Time | GetStateDuration (void) |
| Return the elapsed time of the current state. More... | |
| bool | IsStateBusy (void) |
| Check whether the current state is not IDLE. More... | |
| bool | IsStateCcaBusy (void) |
| Check whether the current state is CCA busy. More... | |
| bool | IsStateIdle (void) |
| Check whether the current state is IDLE. More... | |
| bool | IsStateRx (void) |
| Check whether the current state is RX. More... | |
| bool | IsStateSwitching (void) |
| Check whether the current state is SWITCHING. More... | |
| bool | IsStateTx (void) |
| Check whether the current state is TX. More... | |
| void | RegisterListener (WifiPhyListener *listener) |
| Register WifiPhyListener to this WifiPhyStateHelper. More... | |
| void | SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback) |
| Set a callback for a failed reception. More... | |
| void | SetReceiveOkCallback (WifiPhy::RxOkCallback callback) |
| Set a callback for a successful reception. More... | |
| void | SwitchFromRxEndError (Ptr< const Packet > packet, double snr) |
| Switch from RX after the reception failed. More... | |
| void | SwitchFromRxEndOk (Ptr< Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble) |
| Switch from RX after the reception was successful. More... | |
| void | SwitchMaybeToCcaBusy (Time duration) |
| Switch to CCA busy. More... | |
| void | SwitchToChannelSwitching (Time switchingDuration) |
| Switch state to channel switching for the given duration. More... | |
| void | SwitchToRx (Time rxDuration) |
| Switch state to RX for the given duration. More... | |
| void | SwitchToTx (Time txDuration, Ptr< const Packet > packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower) |
| Switch state to TX for the given duration. More... | |
Public Member Functions inherited from ns3::Object | |
| Object () | |
| virtual | ~Object () |
| void | AggregateObject (Ptr< Object > other) |
| void | Dispose (void) |
| Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
| AggregateIterator | GetAggregateIterator (void) const |
| virtual TypeId | GetInstanceTypeId (void) const |
| template<typename T > | |
| Ptr< T > | GetObject (void) const |
| template<typename T > | |
| Ptr< T > | GetObject (TypeId tid) const |
| void | Initialize (void) |
| This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Constructor. More... | |
| SimpleRefCount (const SimpleRefCount &o) | |
| Copy constructor. More... | |
| uint32_t | GetReferenceCount (void) const |
| Get the reference count of the object. More... | |
| SimpleRefCount & | operator= (const SimpleRefCount &o) |
| Assignment. More... | |
| void | Ref (void) const |
| Increment the reference count. More... | |
| void | Unref (void) const |
| Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
| virtual | ~ObjectBase () |
| Virtual destructor. More... | |
| void | GetAttribute (std::string name, AttributeValue &value) const |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
| void | SetAttribute (std::string name, const AttributeValue &value) |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
| static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId (void) |
| Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| static void | Cleanup (void) |
| Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId (void) |
| Get the type ID. More... | |
Public Attributes | |
| TracedCallback< Time, Time, enum WifiPhy::State > | m_stateLogger |
Private Types | |
| typedef std::vector < WifiPhyListener * > | Listeners |
| typedef for a list of WifiPhyListeners More... | |
Private Member Functions | |
| void | DoSwitchFromRx (void) |
| Switch the state from RX. More... | |
| void | LogPreviousIdleAndCcaBusyStates (void) |
| Log the ideal and CCA states. More... | |
| void | NotifyMaybeCcaBusyStart (Time duration) |
| Notify all WifiPhyListener that the CCA has started for the given duration. More... | |
| void | NotifyRxEndError (void) |
| Notify all WifiPhyListener that the reception was not successful. More... | |
| void | NotifyRxEndOk (void) |
| Notify all WifiPhyListener that the reception was successful. More... | |
| void | NotifyRxStart (Time duration) |
| Notify all WifiPhyListener that the reception has started for the given duration. More... | |
| void | NotifySwitchingStart (Time duration) |
| Notify all WifiPhyListener that we are switching channel with the given channel switching delay. More... | |
| void | NotifyTxStart (Time duration) |
| Notify all WifiPhyListener that the transmission has started for the given duration. More... | |
Private Attributes | |
| Time | m_endCcaBusy |
| Time | m_endRx |
| Time | m_endSwitching |
| Time | m_endTx |
| Listeners | m_listeners |
| Time | m_previousStateChangeTime |
| WifiPhy::RxErrorCallback | m_rxErrorCallback |
| TracedCallback< Ptr< const Packet >, double > | m_rxErrorTrace |
| bool | m_rxing |
| WifiPhy::RxOkCallback | m_rxOkCallback |
| TracedCallback< Ptr< const Packet >, double, WifiMode, enum WifiPreamble > | m_rxOkTrace |
| Time | m_startCcaBusy |
| Time | m_startRx |
| Time | m_startSwitching |
| Time | m_startTx |
| TracedCallback< Ptr< const Packet >, WifiMode, WifiPreamble, uint8_t > | m_txTrace |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| virtual void | DoDispose (void) |
| This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
| virtual void | DoInitialize (void) |
| This method is called only once by Object::Initialize. More... | |
| virtual void | NotifyNewAggregate (void) |
| This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) |
| virtual void | NotifyConstructionCompleted (void) |
| This method is invoked once all member attributes have been initialized. More... | |
This objects implements the PHY state machine of the Wifi device.
ns3::WifiPhyStateHelper is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
Definition at line 35 of file wifi-phy-state-helper.h.
|
private |
typedef for a list of WifiPhyListeners
Definition at line 171 of file wifi-phy-state-helper.h.
| ns3::WifiPhyStateHelper::WifiPhyStateHelper | ( | ) |
Definition at line 52 of file wifi-phy-state-helper.cc.
References NS_LOG_FUNCTION.
|
private |
Switch the state from RX.
Definition at line 392 of file wifi-phy-state-helper.cc.
References IsStateCcaBusy(), IsStateIdle(), IsStateRx(), m_previousStateChangeTime, m_rxing, m_startRx, m_stateLogger, ns3::Simulator::Now(), NS_ASSERT, and ns3::WifiPhy::RX.
Referenced by SwitchFromRxEndError(), and SwitchFromRxEndOk().
Here is the call graph for this function:
Here is the caller graph for this function:| Time ns3::WifiPhyStateHelper::GetDelayUntilIdle | ( | void | ) |
Return the time before the state is back to IDLE.
Definition at line 123 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, GetState(), ns3::WifiPhy::IDLE, m_endCcaBusy, m_endRx, m_endSwitching, m_endTx, ns3::Max(), ns3::Simulator::Now(), NS_FATAL_ERROR, ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Here is the call graph for this function:| Time ns3::WifiPhyStateHelper::GetLastRxStartTime | ( | void | ) | const |
Return the time the last RX start.
Definition at line 154 of file wifi-phy-state-helper.cc.
References m_startRx.
| enum WifiPhy::State ns3::WifiPhyStateHelper::GetState | ( | void | ) |
Return the current state of WifiPhy.
Definition at line 160 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, ns3::WifiPhy::IDLE, m_endCcaBusy, m_endSwitching, m_endTx, m_rxing, ns3::Simulator::Now(), ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Referenced by GetDelayUntilIdle(), IsStateBusy(), IsStateCcaBusy(), IsStateIdle(), IsStateRx(), IsStateSwitching(), IsStateTx(), SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
Here is the call graph for this function:
Here is the caller graph for this function:| Time ns3::WifiPhyStateHelper::GetStateDuration | ( | void | ) |
Return the elapsed time of the current state.
Definition at line 117 of file wifi-phy-state-helper.cc.
References m_previousStateChangeTime, and ns3::Simulator::Now().
Here is the call graph for this function:
|
static |
Definition at line 32 of file wifi-phy-state-helper.cc.
References m_rxErrorTrace, m_rxOkTrace, m_stateLogger, m_txTrace, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
Here is the call graph for this function:| bool ns3::WifiPhyStateHelper::IsStateBusy | ( | void | ) |
Check whether the current state is not IDLE.
Definition at line 89 of file wifi-phy-state-helper.cc.
References GetState(), and ns3::WifiPhy::IDLE.
Here is the call graph for this function:| bool ns3::WifiPhyStateHelper::IsStateCcaBusy | ( | void | ) |
Check whether the current state is CCA busy.
Definition at line 94 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, and GetState().
Referenced by DoSwitchFromRx(), and SwitchToRx().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ns3::WifiPhyStateHelper::IsStateIdle | ( | void | ) |
Check whether the current state is IDLE.
Definition at line 84 of file wifi-phy-state-helper.cc.
References GetState(), and ns3::WifiPhy::IDLE.
Referenced by DoSwitchFromRx(), and SwitchToRx().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ns3::WifiPhyStateHelper::IsStateRx | ( | void | ) |
Check whether the current state is RX.
Definition at line 99 of file wifi-phy-state-helper.cc.
References GetState(), and ns3::WifiPhy::RX.
Referenced by DoSwitchFromRx(), and SwitchToRx().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ns3::WifiPhyStateHelper::IsStateSwitching | ( | void | ) |
Check whether the current state is SWITCHING.
Definition at line 109 of file wifi-phy-state-helper.cc.
References GetState(), and ns3::WifiPhy::SWITCHING.
Referenced by SwitchToChannelSwitching().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ns3::WifiPhyStateHelper::IsStateTx | ( | void | ) |
Check whether the current state is TX.
Definition at line 104 of file wifi-phy-state-helper.cc.
References GetState(), and ns3::WifiPhy::TX.
Here is the call graph for this function:
|
private |
Log the ideal and CCA states.
Definition at line 235 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, ns3::WifiPhy::IDLE, m_endCcaBusy, m_endRx, m_endSwitching, m_endTx, m_startCcaBusy, m_stateLogger, ns3::Max(), ns3::Simulator::Now(), and NS_ASSERT.
Referenced by SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that the CCA has started for the given duration.
| duration | the duration of the CCA state |
Definition at line 218 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchMaybeToCcaBusy().
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that the reception was not successful.
Definition at line 210 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchFromRxEndError().
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that the reception was successful.
Definition at line 202 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchFromRxEndOk().
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that the reception has started for the given duration.
| duration | the duration of the reception |
Definition at line 194 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchToRx().
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that we are switching channel with the given channel switching delay.
| duration | the delay to switch the channel |
Definition at line 226 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchToChannelSwitching().
Here is the caller graph for this function:
|
private |
Notify all WifiPhyListener that the transmission has started for the given duration.
| duration | the duration of the transmission |
Definition at line 186 of file wifi-phy-state-helper.cc.
References m_listeners.
Referenced by SwitchToTx().
Here is the caller graph for this function:| void ns3::WifiPhyStateHelper::RegisterListener | ( | WifiPhyListener * | listener | ) |
Register WifiPhyListener to this WifiPhyStateHelper.
| listener |
Definition at line 78 of file wifi-phy-state-helper.cc.
References m_listeners.
| void ns3::WifiPhyStateHelper::SetReceiveErrorCallback | ( | WifiPhy::RxErrorCallback | callback | ) |
Set a callback for a failed reception.
| callback |
Definition at line 73 of file wifi-phy-state-helper.cc.
References m_rxErrorCallback.
| void ns3::WifiPhyStateHelper::SetReceiveOkCallback | ( | WifiPhy::RxOkCallback | callback | ) |
Set a callback for a successful reception.
| callback |
Definition at line 68 of file wifi-phy-state-helper.cc.
References m_rxOkCallback.
Switch from RX after the reception failed.
| packet | the packet that we failed to received |
| snr | the SNR of the received packet |
Definition at line 380 of file wifi-phy-state-helper.cc.
References DoSwitchFromRx(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_rxErrorCallback, m_rxErrorTrace, and NotifyRxEndError().
Here is the call graph for this function:| void ns3::WifiPhyStateHelper::SwitchFromRxEndOk | ( | Ptr< Packet > | packet, |
| double | snr, | ||
| WifiMode | mode, | ||
| enum WifiPreamble | preamble | ||
| ) |
Switch from RX after the reception was successful.
| packet | the successfully received packet |
| snr | the SNR of the received packet |
| mode | the transmission mode of the packet |
| preamble | the preamble of the received packet |
Definition at line 368 of file wifi-phy-state-helper.cc.
References DoSwitchFromRx(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_rxOkCallback, m_rxOkTrace, and NotifyRxEndOk().
Here is the call graph for this function:| void ns3::WifiPhyStateHelper::SwitchMaybeToCcaBusy | ( | Time | duration | ) |
Switch to CCA busy.
| duration | the duration of CCA busy state |
Definition at line 405 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, GetState(), ns3::WifiPhy::IDLE, LogPreviousIdleAndCcaBusyStates(), m_endCcaBusy, m_startCcaBusy, NotifyMaybeCcaBusyStart(), ns3::Simulator::Now(), ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Here is the call graph for this function:| void ns3::WifiPhyStateHelper::SwitchToChannelSwitching | ( | Time | switchingDuration | ) |
Switch state to channel switching for the given duration.
| switchingDuration | the duration of required to switch the channel |
Definition at line 324 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, GetState(), ns3::WifiPhy::IDLE, IsStateSwitching(), LogPreviousIdleAndCcaBusyStates(), m_endCcaBusy, m_endRx, m_endSwitching, m_endTx, m_previousStateChangeTime, m_rxing, m_startCcaBusy, m_startRx, m_startSwitching, m_stateLogger, ns3::Max(), NotifySwitchingStart(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Here is the call graph for this function:| void ns3::WifiPhyStateHelper::SwitchToRx | ( | Time | rxDuration | ) |
Switch state to RX for the given duration.
| rxDuration | the duration of the RX |
Definition at line 292 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, GetState(), ns3::WifiPhy::IDLE, IsStateCcaBusy(), IsStateIdle(), IsStateRx(), LogPreviousIdleAndCcaBusyStates(), m_endRx, m_endSwitching, m_endTx, m_previousStateChangeTime, m_rxing, m_startCcaBusy, m_startRx, m_stateLogger, ns3::Max(), NotifyRxStart(), ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Here is the call graph for this function:| void ns3::WifiPhyStateHelper::SwitchToTx | ( | Time | txDuration, |
| Ptr< const Packet > | packet, | ||
| WifiMode | txMode, | ||
| WifiPreamble | preamble, | ||
| uint8_t | txPower | ||
| ) |
Switch state to TX for the given duration.
| txDuration | the duration of the TX |
| packet | the packet |
| txMode | the transmission mode of the packet |
| preamble | the preamble of the packet |
| txPower | the transmission power |
Definition at line 255 of file wifi-phy-state-helper.cc.
References ns3::WifiPhy::CCA_BUSY, GetState(), ns3::WifiPhy::IDLE, LogPreviousIdleAndCcaBusyStates(), m_endRx, m_endSwitching, m_endTx, m_previousStateChangeTime, m_rxing, m_startCcaBusy, m_startRx, m_startTx, m_stateLogger, m_txTrace, ns3::Max(), NotifyTxStart(), ns3::Simulator::Now(), NS_FATAL_ERROR, ns3::WifiPhy::RX, ns3::WifiPhy::SWITCHING, and ns3::WifiPhy::TX.
Here is the call graph for this function:
|
private |
Definition at line 220 of file wifi-phy-state-helper.h.
Referenced by GetDelayUntilIdle(), GetState(), LogPreviousIdleAndCcaBusyStates(), SwitchMaybeToCcaBusy(), and SwitchToChannelSwitching().
|
private |
Definition at line 219 of file wifi-phy-state-helper.h.
Referenced by GetDelayUntilIdle(), LogPreviousIdleAndCcaBusyStates(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 221 of file wifi-phy-state-helper.h.
Referenced by GetDelayUntilIdle(), GetState(), LogPreviousIdleAndCcaBusyStates(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 218 of file wifi-phy-state-helper.h.
Referenced by GetDelayUntilIdle(), GetState(), LogPreviousIdleAndCcaBusyStates(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 228 of file wifi-phy-state-helper.h.
Referenced by NotifyMaybeCcaBusyStart(), NotifyRxEndError(), NotifyRxEndOk(), NotifyRxStart(), NotifySwitchingStart(), NotifyTxStart(), and RegisterListener().
|
private |
Definition at line 226 of file wifi-phy-state-helper.h.
Referenced by DoSwitchFromRx(), GetStateDuration(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 233 of file wifi-phy-state-helper.h.
Referenced by SetReceiveErrorCallback(), and SwitchFromRxEndError().
|
private |
Definition at line 230 of file wifi-phy-state-helper.h.
Referenced by GetTypeId(), and SwitchFromRxEndError().
|
private |
Definition at line 217 of file wifi-phy-state-helper.h.
Referenced by DoSwitchFromRx(), GetState(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 232 of file wifi-phy-state-helper.h.
Referenced by SetReceiveOkCallback(), and SwitchFromRxEndOk().
|
private |
Definition at line 229 of file wifi-phy-state-helper.h.
Referenced by GetTypeId(), and SwitchFromRxEndOk().
|
private |
Definition at line 224 of file wifi-phy-state-helper.h.
Referenced by LogPreviousIdleAndCcaBusyStates(), SwitchMaybeToCcaBusy(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 223 of file wifi-phy-state-helper.h.
Referenced by DoSwitchFromRx(), GetLastRxStartTime(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 225 of file wifi-phy-state-helper.h.
Referenced by SwitchToChannelSwitching().
|
private |
Definition at line 222 of file wifi-phy-state-helper.h.
Referenced by SwitchToTx().
| TracedCallback<Time,Time,enum WifiPhy::State> ns3::WifiPhyStateHelper::m_stateLogger |
Definition at line 166 of file wifi-phy-state-helper.h.
Referenced by DoSwitchFromRx(), GetTypeId(), LogPreviousIdleAndCcaBusyStates(), SwitchToChannelSwitching(), SwitchToRx(), and SwitchToTx().
|
private |
Definition at line 231 of file wifi-phy-state-helper.h.
Referenced by GetTypeId(), and SwitchToTx().