|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #ifndef WIFI_PHY_STATE_HELPER_H
22 #define WIFI_PHY_STATE_HELPER_H
24 #include "ns3/object.h"
25 #include "ns3/callback.h"
26 #include "ns3/traced-callback.h"
27 #include "ns3/nstime.h"
34 class WifiPhyListener;
51 typedef Callback<void, Ptr<WifiPsdu>, RxSignalInfo,
206 uint16_t staId, std::vector<bool> statusPerMpdu);
a unique identifier for an interface.
bool IsStateSwitching(void) const
Check whether the current state is SWITCHING.
void LogPreviousIdleAndCcaBusyStates(void)
Log the ideal and CCA states.
bool IsStateSleep(void) const
Check whether the current state is SLEEP.
void SwitchFromOff(Time duration)
Switch from off mode.
TracedCallback< Ptr< const Packet >, double > m_rxErrorTrace
receive error trace callback
TracedCallback< Ptr< const Packet >, WifiMode, WifiPreamble, uint8_t > m_txTrace
transmit trace callback
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
void SwitchToSleep(void)
Switch to sleep mode.
void SetReceiveErrorCallback(RxErrorCallback callback)
Set a callback for a failed reception.
bool IsStateCcaBusy(void) const
Check whether the current state is CCA busy.
TracedCallback< Ptr< const Packet >, double, WifiMode, WifiPreamble > m_rxOkTrace
receive OK trace callback
receive notifications about PHY events.
WifiPhyState GetState(void) const
Return the current state of WifiPhy.
Listeners m_listeners
listeners
Callback< void, Ptr< WifiPsdu >, RxSignalInfo, WifiTxVector, std::vector< bool > > RxOkCallback
Callback if PSDU successfully received (i.e.
void NotifyRxEndOk(void)
Notify all WifiPhyListener that the reception was successful.
Declaration of the following enums:
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Time m_startSwitching
start switching
void RegisterListener(WifiPhyListener *listener)
Register WifiPhyListener to this WifiPhyStateHelper.
void SwitchToOff(void)
Switch to off mode.
void SwitchToRx(Time rxDuration)
Switch state to RX for the given duration.
void UnregisterListener(WifiPhyListener *listener)
Remove WifiPhyListener from this WifiPhyStateHelper.
void NotifyOff(void)
Notify all WifiPhyListener that we are going to switch off.
void(* RxEndErrorTracedCallback)(Ptr< const Packet > packet, double snr)
TracedCallback signature for receive end error event.
bool IsStateIdle(void) const
Check whether the current state is IDLE.
void SetReceiveOkCallback(RxOkCallback callback)
Set a callback for a successful reception.
Time m_startTx
start transmit
This objects implements the PHY state machine of the Wifi device.
void NotifyTxStart(Time duration, double txPowerDbm)
Notify all WifiPhyListener that the transmission has started for the given duration.
void SwitchMaybeToCcaBusy(Time duration)
Switch to CCA busy.
void SwitchFromSleep(Time duration)
Switch from sleep mode.
Time GetDelayUntilIdle(void) const
Return the time before the state is back to IDLE.
represent a single transmission mode
Time m_startSleep
start sleep
A base class which provides memory management and object aggregation.
void(* StateTracedCallback)(Time start, Time duration, WifiPhyState state)
TracedCallback signature for state changes.
void SwitchFromRxAbort(void)
Abort current reception.
std::vector< WifiPhyListener * >::iterator ListenersI
typedef for a list of WifiPhyListeners iterator
void DoSwitchFromRx(void)
Switch the state from RX.
Time m_startCcaBusy
start CCA busy
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.
void SwitchFromRxEndError(Ptr< WifiPsdu > psdu, double snr)
Switch from RX after the reception failed.
void(* RxOkTracedCallback)(Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
TracedCallback signature for receive end OK event.
TracedCallback< Time, Time, WifiPhyState > m_stateLogger
The trace source fired when state is changed.
RxOkCallback m_rxOkCallback
receive OK callback
Simulation virtual time values and global simulation resolution.
Time m_endCcaBusy
end CCA busy
void SwitchToTx(Time txDuration, WifiConstPsduMap psdus, double txPowerDbm, WifiTxVector txVector)
Switch state to TX for the given duration.
Time m_previousStateChangeTime
previous state change time
void NotifySleep(void)
Notify all WifiPhyListener that we are going to sleep.
WifiPhyState
The state of the PHY layer.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
bool IsStateOff(void) const
Check whether the current state is OFF.
std::vector< WifiPhyListener * > Listeners
typedef for a list of WifiPhyListeners
void NotifyOn(void)
Notify all WifiPhyListener that we are going to switch on.
RxSignalInfo structure containing info on the received signal.
void NotifyMaybeCcaBusyStart(Time duration)
Notify all WifiPhyListener that the CCA has started for the given duration.
void NotifyRxStart(Time duration)
Notify all WifiPhyListener that the reception has started for the given duration.
void SwitchFromRxEndOk(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, uint16_t staId, std::vector< bool > statusPerMpdu)
Switch from RX after the reception was successful.
bool IsStateTx(void) const
Check whether the current state is TX.
void SwitchToChannelSwitching(Time switchingDuration)
Switch state to channel switching for the given duration.
Forward calls to a chain of Callback.
Callback< void, Ptr< WifiPsdu > > RxErrorCallback
Callback if PSDU unsuccessfully received.
void NotifyWakeup(void)
Notify all WifiPhyListener that we woke up.
void ContinueRxNextMpdu(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
Continue RX after the reception of an MPDU in an A-MPDU was successful.
Time m_startRx
start receive
Time GetLastRxStartTime(void) const
Return the time the last RX start.
bool IsStateRx(void) const
Check whether the current state is RX.
void NotifyRxEndError(void)
Notify all WifiPhyListener that the reception was not successful.
Time GetLastRxEndTime(void) const
Return the time the last RX end.
Time m_endSwitching
end switching
void(* TxTracedCallback)(Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t power)
TracedCallback signature for transmit event.
RxErrorCallback m_rxErrorCallback
receive error callback
void NotifySwitchingStart(Time duration)
Notify all WifiPhyListener that we are switching channel with the given channel switching delay.