author | Daniel Lertpratchya <nikkipui@gmail.com> |
Tue, 10 Dec 2013 10:48:51 -0500 | |
changeset 10483 | e3a02ed14587 |
parent 10139 | 17a71cd49da3 |
child 11083 | 96e983e7cd5d |
permissions | -rw-r--r-- |
10139 | 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 |
#ifndef WIFI_TX_VECTOR_H |
|
23 |
#define WIFI_TX_VECTOR_H |
|
24 |
||
25 |
#include <ns3/wifi-mode.h> |
|
26 |
#include <ostream> |
|
27 |
||
28 |
namespace ns3 { |
|
29 |
||
30 |
||
31 |
/** |
|
32 |
* This class mimics the TXVECTOR which is to be |
|
33 |
* passed to the PHY in order to define the parameters which are to be |
|
34 |
* used for a transmission. See IEEE 802.11-2007 15.2.6 "Transmit PLCP", |
|
35 |
* and also 15.4.4.2 "PMD_SAP peer-to-peer service primitive |
|
36 |
* parameters". |
|
37 |
* |
|
38 |
* \note the above reference is valid for the DSSS PHY only (clause |
|
39 |
* 15). TXVECTOR is defined also for the other PHYs, however they |
|
40 |
* don't include the TXPWRLVL explicitly in the TXVECTOR. This is |
|
41 |
* somewhat strange, since all PHYs actually have a |
|
42 |
* PMD_TXPWRLVL.request primitive. We decide to include the power |
|
43 |
* level in WifiTxVector for all PHYs, since it serves better our |
|
44 |
* purposes, and furthermore it seems close to the way real devices |
|
45 |
* work (e.g., madwifi). |
|
46 |
*/ |
|
47 |
class WifiTxVector |
|
48 |
{ |
|
49 |
public: |
|
50 |
WifiTxVector (); |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
51 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
52 |
* Create a TXVECTOR with the given parameters. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
53 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
54 |
* \param mode WifiMode |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
55 |
* \param powerLevel transmission power level |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
56 |
* \param retries retries |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
57 |
* \param shortGuardInterval enable or disable short guard interval |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
58 |
* \param nss the number of spatial STBC streams (NSS) |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
59 |
* \param ness the number of extension spatial streams (NESS) |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
60 |
* \param stbc enable or disable STBC |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
61 |
*/ |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
62 |
WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc); |
10139 | 63 |
/** |
64 |
* \returns the txvector payload mode |
|
65 |
*/ |
|
66 |
WifiMode GetMode (void) const; |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
67 |
/** |
10139 | 68 |
* Sets the selected payload transmission mode |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
69 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
70 |
* \param mode |
10139 | 71 |
*/ |
72 |
void SetMode (WifiMode mode); |
|
73 |
/** |
|
74 |
* \returns the transmission power level |
|
75 |
*/ |
|
76 |
uint8_t GetTxPowerLevel (void) const; |
|
77 |
/** |
|
78 |
* Sets the selected transmission power level |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
79 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
80 |
* \param powerlevel |
10139 | 81 |
*/ |
82 |
void SetTxPowerLevel (uint8_t powerlevel); |
|
83 |
/** |
|
84 |
* \returns the number of retries |
|
85 |
*/ |
|
86 |
uint8_t GetRetries (void) const; |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
87 |
/** |
10139 | 88 |
* Sets the number of retries |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
89 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
90 |
* \param retries |
10139 | 91 |
*/ |
92 |
void SetRetries (uint8_t retries); |
|
93 |
/** |
|
94 |
* \returns if ShortGuardInterval is used or not |
|
95 |
*/ |
|
96 |
bool IsShortGuardInterval (void) const; |
|
97 |
/** |
|
98 |
* Sets if short gurad interval is being used |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
99 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
100 |
* \param guardinterval enable or disable short guard interval |
10139 | 101 |
*/ |
102 |
void SetShortGuardInterval (bool guardinterval); |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
103 |
/** |
10139 | 104 |
* \returns the number of Nss |
105 |
*/ |
|
106 |
uint8_t GetNss (void) const; |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
107 |
/** |
10139 | 108 |
* Sets the number of Nss refer to IEEE802.11n Table 20-28 for explanation and range |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
109 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
110 |
* \param nss |
10139 | 111 |
*/ |
112 |
void SetNss (uint8_t nss); |
|
113 |
/** |
|
114 |
* \returns the number of Ness |
|
115 |
*/ |
|
116 |
uint8_t GetNess (void) const; |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
117 |
/** |
10139 | 118 |
* Sets the Ness number refer to IEEE802.11n Table 20-6 for explanation |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
119 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
120 |
* \param ness |
10139 | 121 |
*/ |
122 |
void SetNess (uint8_t ness); |
|
123 |
/** |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
124 |
* Check if STBC is used or not |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
125 |
* \returns true if STBC is used, |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
126 |
* false otherwise |
10139 | 127 |
*/ |
128 |
bool IsStbc (void) const; |
|
129 |
/** |
|
130 |
* Sets if STBC is being used |
|
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
131 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
132 |
* \param stbc enable or disable STBC |
10139 | 133 |
*/ |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
134 |
void SetStbc (bool stbc); |
10139 | 135 |
|
136 |
||
137 |
private: |
|
138 |
||
139 |
WifiMode m_mode; /**< The DATARATE parameter in Table 15-4. |
|
140 |
It is the value that will be passed |
|
141 |
to PMD_RATE.request */ |
|
142 |
uint8_t m_txPowerLevel; /**< The TXPWR_LEVEL parameter in Table 15-4. |
|
143 |
It is the value that will be passed |
|
144 |
to PMD_TXPWRLVL.request */ |
|
145 |
uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter |
|
146 |
for Click radiotap information */ |
|
147 |
bool m_shortGuardInterval; //true if short GI is going to be used |
|
148 |
uint8_t m_nss; //number of streams |
|
149 |
uint8_t m_ness; //number of stream in beamforming |
|
150 |
bool m_stbc; //STBC used or not |
|
151 |
||
152 |
}; |
|
153 |
||
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
154 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
155 |
* Serialize WifiTxVector to the given ostream. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
156 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
157 |
* \param os |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
158 |
* \param v |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
159 |
* \return ostream |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
160 |
*/ |
10139 | 161 |
std::ostream & operator << (std::ostream & os,const WifiTxVector &v); |
162 |
||
163 |
} // namespace ns3 |
|
164 |
||
165 |
#endif // WIFI_TX_VECTOR_H |