A Discrete-Event Network Simulator
API
wifi-tx-vector.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  * : Ghada Badawy <gbadawy@gmail.com>
20  */
21 
22 #include "ns3/wifi-tx-vector.h"
23 #include "ns3/fatal-error.h"
24 
25 namespace ns3 {
26 
28  : m_retries (0),
29  m_shortGuardInterval (false),
30  m_nss (1),
31  m_ness (0),
32  m_stbc (false),
33  m_modeInitialized (false),
34  m_txPowerLevelInitialized (false)
35 {
36 }
37 
38 WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries,
39  bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc)
40  : m_mode (mode),
41  m_txPowerLevel (powerLevel),
42  m_retries (retries),
43  m_shortGuardInterval(shortGuardInterval),
44  m_nss(nss),
45  m_ness(ness),
46  m_stbc(stbc),
47  m_modeInitialized (true),
48  m_txPowerLevelInitialized (true)
49 {
50 }
51 
54 {
55  if (!m_modeInitialized)
56  {
57  NS_FATAL_ERROR ("WifiTxVector mode must be set before using");
58  }
59  return m_mode;
60 }
61 uint8_t
63 {
65  {
66  NS_FATAL_ERROR ("WifiTxVector txPowerLevel must be set before using");
67  }
68  return m_txPowerLevel;
69 }
70 uint8_t
72 {
73  return m_retries;
74 }
75 bool
77 {
78  return m_shortGuardInterval;
79 }
80 uint8_t
82 {
83  return m_nss;
84 }
85 uint8_t
87 {
88  return m_ness;
89 }
90 bool
92 {
93  return m_stbc;
94 }
95 
96 void
98 {
99  m_mode=mode;
100  m_modeInitialized = true;
101 }
102 void
103 WifiTxVector::SetTxPowerLevel (uint8_t powerlevel)
104 {
105  m_txPowerLevel=powerlevel;
107 }
108 void
109 WifiTxVector::SetRetries (uint8_t retries)
110 {
111  m_retries = retries;
112 }
113 void
115 {
116  m_shortGuardInterval=guardinterval;
117 }
118 void
119 WifiTxVector::SetNss (uint8_t nss)
120 {
121  m_nss= nss;
122 }
123 void
124 WifiTxVector::SetNess (uint8_t ness)
125 {
126  m_ness=ness;
127 }
128 void
130 {
131  m_stbc=stbc;
132 }
133 
134 std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
135 {
136  os << "mode:" << v.GetMode() <<
137  " txpwrlvl:" << (uint32_t)v.GetTxPowerLevel() <<
138  " retries:" << (uint32_t)v.GetRetries() <<
139  " Short GI: " << v.IsShortGuardInterval() <<
140  " Nss: " << (uint32_t)v.GetNss() <<
141  " Ness: " << (uint32_t)v.GetNess() <<
142  " STBC: " << v.IsStbc();
143  return os;
144 }
145 
146 } // namespace ns3
void SetShortGuardInterval(bool guardinterval)
Sets if short gurad interval is being used.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
bool m_shortGuardInterval
true if short GI is going to be used
void SetStbc(bool stbc)
Sets if STBC is being used.
bool IsShortGuardInterval(void) const
#define NS_FATAL_ERROR(msg)
Fatal error handling.
Definition: fatal-error.h:100
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
uint8_t GetTxPowerLevel(void) const
uint8_t m_nss
number of streams
uint8_t GetNess(void) const
bool IsStbc(void) const
Check if STBC is used or not.
uint8_t m_retries
The DATA_RETRIES/RTS_RETRIES parameter for Click radiotap information.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
bool m_stbc
STBC used or not.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
uint8_t GetNss(void) const
void SetNess(uint8_t ness)
Sets the Ness number refer to IEEE 802.11n Table 20-6 for explanation.
void SetRetries(uint8_t retries)
Sets the number of retries.
uint8_t GetRetries(void) const
uint8_t m_ness
number of streams in beamforming
WifiMode GetMode(void) const
uint8_t m_txPowerLevel
The TXPWR_LEVEL parameter in Table 15-4.
WifiMode m_mode
The DATARATE parameter in Table 15-4.