A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy-state.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Sébastien Deronne <sebastien.deronne@gmail.com>
8 */
9
10#ifndef WIFI_PHY_STATE_H
11#define WIFI_PHY_STATE_H
12
13#include "ns3/deprecated.h"
14#include "ns3/fatal-error.h"
15
16namespace ns3
17{
18
19/**
20 * The state of the PHY layer.
21 */
22/// State enumeration
23enum class WifiPhyState
24{
25 /**
26 * The PHY layer is IDLE.
27 */
28 IDLE = 0,
29 /**
30 * The PHY layer has sense the medium busy through the CCA mechanism
31 */
33 /**
34 * The PHY layer is sending a packet.
35 */
36 TX,
37 /**
38 * The PHY layer is receiving a packet.
39 */
40 RX,
41 /**
42 * The PHY layer is switching to other channel.
43 */
45 /**
46 * The PHY layer is sleeping.
47 */
48 SLEEP,
49 /**
50 * The PHY layer is switched off.
51 */
52 OFF
53};
54
55/**
56 * \brief Stream insertion operator.
57 *
58 * \param os the stream
59 * \param state the state
60 * \returns a reference to the stream
61 */
62inline std::ostream&
63operator<<(std::ostream& os, WifiPhyState state)
64{
65 switch (state)
66 {
68 return (os << "IDLE");
70 return (os << "CCA_BUSY");
72 return (os << "TX");
74 return (os << "RX");
76 return (os << "SWITCHING");
78 return (os << "SLEEP");
80 return (os << "OFF");
81 default:
82 NS_FATAL_ERROR("Invalid state");
83 return (os << "INVALID");
84 }
85}
86
87} // namespace ns3
88
89/**
90 * Deprecated WifiPhyState enums.
91 *
92 * Use WifiPhyState class enum symbols instead.
93 * @{
94 */
95NS_DEPRECATED_3_42("Use WifiPhyState::IDLE instead")
96static constexpr auto IDLE = ns3::WifiPhyState::IDLE;
97NS_DEPRECATED_3_42("Use WifiPhyState::CCA_BUSY instead")
98static constexpr auto CCA_BUSY = ns3::WifiPhyState::CCA_BUSY;
99NS_DEPRECATED_3_42("Use WifiPhyState::TX instead")
100static constexpr auto TX = ns3::WifiPhyState::TX;
101NS_DEPRECATED_3_42("Use WifiPhyState::RX instead")
102static constexpr auto RX = ns3::WifiPhyState::RX;
103NS_DEPRECATED_3_42("Use WifiPhyState::SWITCHING instead")
104static constexpr auto SWITCHING = ns3::WifiPhyState::SWITCHING;
105NS_DEPRECATED_3_42("Use WifiPhyState::SLEEP instead")
106static constexpr auto SLEEP = ns3::WifiPhyState::SLEEP;
107NS_DEPRECATED_3_42("Use WifiPhyState::OFF instead")
108static constexpr auto OFF = ns3::WifiPhyState::OFF;
109/**@}*/
110
111#endif /* WIFI_PHY_STATE_H */
#define NS_DEPRECATED_3_42(msg)
Tag for things deprecated in version ns-3.42.
Definition deprecated.h:98
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
@ SWITCHING
The PHY layer is switching to other channel.
@ TX
The PHY layer is sending a packet.
@ OFF
The PHY layer is switched off.
@ IDLE
The PHY layer is IDLE.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ SLEEP
The PHY layer is sleeping.
@ RX
The PHY layer is receiving a packet.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
@ IDLE
Channel is IDLE, no packet is being transmitted.
static constexpr auto SWITCHING
static constexpr auto TX
static constexpr auto SLEEP
static constexpr auto CCA_BUSY
static constexpr auto RX
static constexpr auto IDLE
Deprecated WifiPhyState enums.
static constexpr auto OFF