A Discrete-Event Network Simulator
API
channel-manager.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Author: Junling Bu <linlinjavaer@gmail.com>
16  */
17 #ifndef CHANNEL_MANAGER_H
18 #define CHANNEL_MANAGER_H
19 #include "ns3/object.h"
20 #include "ns3/wifi-mode.h"
21 #include "ns3/wifi-phy-common.h"
22 
23 #include <map>
24 #include <vector>
25 
26 namespace ns3
27 {
28 
42 #define CH172 172
43 #define CH174 174
44 #define CH176 176
45 #define CH178 178
46 #define CH180 180
47 #define CH182 182
48 #define CH184 184
49 
50 #define SCH1 172
51 #define SCH2 174
52 #define SCH3 176
53 #define CCH 178
54 #define SCH4 180
55 #define SCH5 182
56 #define SCH6 184
57 
63 class ChannelManager : public Object
64 {
65  public:
70  static TypeId GetTypeId();
72  ~ChannelManager() override;
73 
77  static uint32_t GetCch();
81  static std::vector<uint32_t> GetSchs();
87  static std::vector<uint32_t> GetWaveChannels();
91  static uint32_t GetNumberOfWaveChannels();
96  static bool IsCch(uint32_t channelNumber);
101  static bool IsSch(uint32_t channelNumber);
106  static bool IsWaveChannel(uint32_t channelNumber);
107 
114  uint32_t GetOperatingClass(uint32_t channelNumber);
119  bool GetManagementAdaptable(uint32_t channelNumber);
124  WifiMode GetManagementDataRate(uint32_t channelNumber);
129  WifiPreamble GetManagementPreamble(uint32_t channelNumber);
134  uint32_t GetManagementPowerLevel(uint32_t channelNumber);
135 
136  protected:
137  void DoDispose() override;
138 
139  private:
141  static const uint32_t DEFAULT_OPERATING_CLASS = 17;
142 
144  struct WaveChannel
145  {
146  uint32_t channelNumber;
147  uint32_t operatingClass;
148  bool adaptable;
151  uint32_t txPowerLevel;
152 
160  adaptable(true),
161  dataRate(WifiMode("OfdmRate6MbpsBW10MHz")),
163  txPowerLevel(4)
164  {
165  }
166  };
167 
168  std::map<uint32_t, WaveChannel*> m_channels;
169 };
170 
171 } // namespace ns3
172 #endif /* CHANNEL_MANAGER_H */
manage 7 WaveChannels and the tx information such as data rate and txPowerLevel.
static TypeId GetTypeId()
Get the type ID.
static std::vector< uint32_t > GetSchs()
static bool IsCch(uint32_t channelNumber)
static std::vector< uint32_t > GetWaveChannels()
bool GetManagementAdaptable(uint32_t channelNumber)
static uint32_t GetNumberOfWaveChannels()
void DoDispose() override
Destructor implementation.
WifiPreamble GetManagementPreamble(uint32_t channelNumber)
static const uint32_t DEFAULT_OPERATING_CLASS
1609.4-2010 Annex H
static uint32_t GetCch()
uint32_t GetManagementPowerLevel(uint32_t channelNumber)
WifiMode GetManagementDataRate(uint32_t channelNumber)
static bool IsSch(uint32_t channelNumber)
uint32_t GetOperatingClass(uint32_t channelNumber)
std::map< uint32_t, WaveChannel * > m_channels
list of channels
static bool IsWaveChannel(uint32_t channelNumber)
~ChannelManager() override
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:60
represent a single transmission mode
Definition: wifi-mode.h:50
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
@ WIFI_PREAMBLE_LONG
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:81
uint32_t operatingClass
operating class
uint32_t channelNumber
channel number
WaveChannel(uint32_t channel)
initializor
uint32_t txPowerLevel
transmit power level