author | Maja Grubišić <maja.grubisic@live.com> |
Sat, 01 Dec 2012 20:05:49 +0100 | |
changeset 9157 | 2d4305dd159a |
parent 9144 | 6a15c50388bc |
child 10410 | 4d4eb8097fa3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7256
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6009 | 2 |
/* |
3 |
* Copyright (c) 2009 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, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Nicola Baldo <nbaldo@cttc.es> |
|
19 |
*/ |
|
20 |
||
21 |
#include <iomanip> |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7704
diff
changeset
|
22 |
#include <cmath> |
6009 | 23 |
#include "ns3/log.h" |
24 |
#include "radiotap-header.h" |
|
25 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
26 |
NS_LOG_COMPONENT_DEFINE ("RadiotapHeader"); |
6009 | 27 |
|
28 |
namespace ns3 { |
|
6393
f7e1f9dfa08d
ensure objects are regsitered
Josh Pelkey <jpelkey@gatech.edu>
parents:
6036
diff
changeset
|
29 |
|
f7e1f9dfa08d
ensure objects are regsitered
Josh Pelkey <jpelkey@gatech.edu>
parents:
6036
diff
changeset
|
30 |
NS_OBJECT_ENSURE_REGISTERED (RadiotapHeader); |
6009 | 31 |
|
32 |
RadiotapHeader::RadiotapHeader() |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
33 |
: m_length (8), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
34 |
m_present (0), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
35 |
m_tsft (0), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
36 |
m_flags (FRAME_FLAG_NONE), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
37 |
m_rate (0), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
38 |
m_channelFreq (0), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
39 |
m_channelFlags (CHANNEL_FLAG_NONE), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
40 |
m_antennaSignal (0), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
41 |
m_antennaNoise (0) |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
42 |
{ |
6009 | 43 |
NS_LOG_FUNCTION (this); |
44 |
} |
|
45 |
||
46 |
TypeId RadiotapHeader::GetTypeId (void) |
|
47 |
{ |
|
6393
f7e1f9dfa08d
ensure objects are regsitered
Josh Pelkey <jpelkey@gatech.edu>
parents:
6036
diff
changeset
|
48 |
static TypeId tid = TypeId ("ns3::RadiotapHeader") |
6009 | 49 |
.SetParent<Header> () |
50 |
.AddConstructor<RadiotapHeader> () |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
51 |
; |
6009 | 52 |
return tid; |
53 |
} |
|
54 |
||
55 |
TypeId |
|
56 |
RadiotapHeader::GetInstanceTypeId (void) const |
|
57 |
{ |
|
58 |
return GetTypeId (); |
|
59 |
} |
|
60 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
61 |
uint32_t |
6009 | 62 |
RadiotapHeader::GetSerializedSize (void) const |
63 |
{ |
|
64 |
NS_LOG_FUNCTION (this); |
|
65 |
return m_length; |
|
66 |
} |
|
67 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
68 |
void |
6009 | 69 |
RadiotapHeader::Serialize (Buffer::Iterator start) const |
70 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9063
diff
changeset
|
71 |
NS_LOG_FUNCTION (this << &start); |
6009 | 72 |
|
73 |
start.WriteU8 (0); // major version of radiotap header |
|
74 |
start.WriteU8 (0); // pad field |
|
75 |
start.WriteU16 (m_length); // entire length of radiotap data + header |
|
76 |
start.WriteU32 (m_present); // bits describing which fields follow header |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
77 |
|
6009 | 78 |
// |
79 |
// Time Synchronization Function Timer (when the first bit of the MPDU |
|
80 |
// arrived at the MAC) |
|
81 |
// |
|
82 |
if (m_present & RADIOTAP_TSFT) // bit 0 |
|
83 |
{ |
|
84 |
start.WriteU64 (m_tsft); |
|
85 |
} |
|
86 |
||
87 |
// |
|
88 |
// Properties of transmitted and received frames. |
|
89 |
// |
|
90 |
if (m_present & RADIOTAP_FLAGS) // bit 1 |
|
91 |
{ |
|
92 |
start.WriteU8 (m_flags); |
|
93 |
} |
|
94 |
||
95 |
// |
|
96 |
// TX/RX data rate in units of 500 kbps |
|
97 |
// |
|
98 |
if (m_present & RADIOTAP_RATE) // bit 2 |
|
99 |
{ |
|
100 |
start.WriteU8 (m_rate); |
|
101 |
} |
|
102 |
||
103 |
// |
|
104 |
// Tx/Rx frequency in MHz, followed by flags. |
|
105 |
// |
|
106 |
if (m_present & RADIOTAP_CHANNEL) // bit 3 |
|
107 |
{ |
|
108 |
start.WriteU16 (m_channelFreq); |
|
109 |
start.WriteU16 (m_channelFlags); |
|
110 |
} |
|
111 |
||
112 |
// |
|
113 |
// RF signal power at the antenna, decibel difference from an arbitrary, fixed |
|
114 |
// reference. |
|
115 |
// |
|
116 |
if (m_present & RADIOTAP_DBM_ANTSIGNAL) // bit 5 |
|
117 |
{ |
|
118 |
start.WriteU8 (m_antennaSignal); |
|
119 |
} |
|
120 |
||
121 |
// |
|
122 |
// RF noise power at the antenna, decibel difference from an arbitrary, fixed |
|
123 |
// reference. |
|
124 |
// |
|
125 |
if (m_present & RADIOTAP_DBM_ANTNOISE) // bit 6 |
|
126 |
{ |
|
127 |
start.WriteU8 (m_antennaNoise); |
|
128 |
} |
|
129 |
} |
|
130 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
131 |
uint32_t |
6009 | 132 |
RadiotapHeader::Deserialize (Buffer::Iterator start) |
133 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9063
diff
changeset
|
134 |
NS_LOG_FUNCTION (this << &start); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
135 |
|
7704
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7385
diff
changeset
|
136 |
uint8_t tmp = start.ReadU8 (); // major version of radiotap header |
6009 | 137 |
NS_ASSERT_MSG (tmp == 0x00, "RadiotapHeader::Deserialize(): Unexpected major version"); |
138 |
start.ReadU8 (); // pad field |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
139 |
|
6009 | 140 |
m_length = start.ReadU16 (); // entire length of radiotap data + header |
141 |
m_present = start.ReadU32 (); // bits describing which fields follow header |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
142 |
|
6009 | 143 |
uint32_t bytesRead = 8; |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
144 |
|
6009 | 145 |
// |
146 |
// Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC) |
|
147 |
// |
|
148 |
if (m_present & RADIOTAP_TSFT) // bit 0 |
|
149 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
150 |
m_tsft = start.ReadU64 (); |
6009 | 151 |
bytesRead += 8; |
152 |
} |
|
153 |
||
154 |
// |
|
155 |
// Properties of transmitted and received frames. |
|
156 |
// |
|
157 |
if (m_present & RADIOTAP_FLAGS) // bit 1 |
|
158 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
159 |
m_flags = start.ReadU8 (); |
6009 | 160 |
++bytesRead; |
161 |
} |
|
162 |
||
163 |
// |
|
164 |
// TX/RX data rate in units of 500 kbps |
|
165 |
// |
|
166 |
if (m_present & RADIOTAP_RATE) // bit 2 |
|
167 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
168 |
m_rate = start.ReadU8 (); |
6009 | 169 |
++bytesRead; |
170 |
} |
|
171 |
||
172 |
// |
|
173 |
// Tx/Rx frequency in MHz, followed by flags. |
|
174 |
// |
|
175 |
if (m_present & RADIOTAP_CHANNEL) // bit 3 |
|
176 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
177 |
m_channelFreq = start.ReadU16 (); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
178 |
m_channelFlags = start.ReadU16 (); |
6009 | 179 |
bytesRead += 4; |
180 |
} |
|
181 |
||
182 |
// |
|
183 |
// The hop set and pattern for frequency-hopping radios. We don't need it but |
|
184 |
// still need to account for it. |
|
185 |
// |
|
186 |
if (m_present & RADIOTAP_FHSS) // bit 4 |
|
187 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
188 |
start.ReadU8 (); |
6009 | 189 |
++bytesRead; |
190 |
} |
|
191 |
||
192 |
// |
|
193 |
// RF signal power at the antenna, decibel difference from an arbitrary, fixed |
|
194 |
// reference. |
|
195 |
// |
|
196 |
if (m_present & RADIOTAP_DBM_ANTSIGNAL) // bit 5 |
|
197 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
198 |
m_antennaSignal = start.ReadU8 (); |
6009 | 199 |
++bytesRead; |
200 |
} |
|
201 |
||
202 |
// |
|
203 |
// RF noise power at the antenna, decibel difference from an arbitrary, fixed |
|
204 |
// reference. |
|
205 |
// |
|
206 |
if (m_present & RADIOTAP_DBM_ANTNOISE) // bit 6 |
|
207 |
{ |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
208 |
m_antennaNoise = start.ReadU8 (); |
6009 | 209 |
++bytesRead; |
210 |
} |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
211 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
212 |
NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent"); |
6009 | 213 |
return bytesRead; |
214 |
} |
|
215 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
216 |
void |
6009 | 217 |
RadiotapHeader::Print (std::ostream &os) const |
218 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9063
diff
changeset
|
219 |
NS_LOG_FUNCTION (this << &os); |
6009 | 220 |
os << " tsft=" << m_tsft |
221 |
<< " flags=" << std::hex << m_flags << std::dec |
|
222 |
<< " rate=" << (uint16_t) m_rate |
|
223 |
<< " freq=" << m_channelFreq |
|
224 |
<< " chflags=" << std::hex << (uint32_t)m_channelFlags << std::dec |
|
225 |
<< " signal=" << (int16_t) m_antennaSignal |
|
226 |
<< " noise=" << (int16_t) m_antennaNoise; |
|
227 |
} |
|
228 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
229 |
void |
6009 | 230 |
RadiotapHeader::SetTsft (uint64_t value) |
231 |
{ |
|
232 |
NS_LOG_FUNCTION (this << value); |
|
233 |
m_tsft = value; |
|
234 |
||
235 |
if (!(m_present & RADIOTAP_TSFT)) |
|
236 |
{ |
|
237 |
m_present |= RADIOTAP_TSFT; |
|
238 |
m_length += 8; |
|
239 |
} |
|
240 |
||
241 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
|
242 |
} |
|
243 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
244 |
uint64_t |
6009 | 245 |
RadiotapHeader::GetTsft () const |
246 |
{ |
|
247 |
NS_LOG_FUNCTION (this); |
|
248 |
return m_tsft; |
|
249 |
} |
|
250 |
||
251 |
void |
|
252 |
RadiotapHeader::SetFrameFlags (uint8_t flags) |
|
253 |
{ |
|
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9144
diff
changeset
|
254 |
NS_LOG_FUNCTION (this << static_cast<uint32_t> (flags)); |
6009 | 255 |
m_flags = flags; |
256 |
||
257 |
if (!(m_present & RADIOTAP_FLAGS)) |
|
258 |
{ |
|
259 |
m_present |= RADIOTAP_FLAGS; |
|
260 |
m_length += 1; |
|
261 |
} |
|
262 |
||
263 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
|
264 |
} |
|
265 |
||
266 |
uint8_t |
|
267 |
RadiotapHeader::GetFrameFlags (void) const |
|
268 |
{ |
|
269 |
NS_LOG_FUNCTION (this); |
|
270 |
return m_flags; |
|
271 |
} |
|
272 |
||
273 |
void |
|
274 |
RadiotapHeader::SetRate (uint8_t rate) |
|
275 |
{ |
|
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9144
diff
changeset
|
276 |
NS_LOG_FUNCTION (this << static_cast<uint32_t> (rate)); |
6009 | 277 |
m_rate = rate; |
278 |
||
279 |
if (!(m_present & RADIOTAP_RATE)) |
|
280 |
{ |
|
281 |
m_present |= RADIOTAP_RATE; |
|
282 |
m_length += 1; |
|
283 |
} |
|
284 |
||
285 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
|
286 |
} |
|
287 |
||
288 |
uint8_t |
|
289 |
RadiotapHeader::GetRate (void) const |
|
290 |
{ |
|
291 |
NS_LOG_FUNCTION (this); |
|
292 |
return m_rate; |
|
293 |
} |
|
294 |
||
295 |
void |
|
296 |
RadiotapHeader::SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags) |
|
297 |
{ |
|
298 |
NS_LOG_FUNCTION (this << frequency << flags); |
|
299 |
m_channelFreq = frequency; |
|
300 |
m_channelFlags = flags; |
|
301 |
||
302 |
if (!(m_present & RADIOTAP_CHANNEL)) |
|
303 |
{ |
|
304 |
m_present |= RADIOTAP_CHANNEL; |
|
305 |
m_length += 4; |
|
306 |
} |
|
307 |
||
308 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
|
309 |
} |
|
310 |
||
311 |
uint16_t |
|
312 |
RadiotapHeader::GetChannelFrequency (void) const |
|
313 |
{ |
|
314 |
NS_LOG_FUNCTION (this); |
|
315 |
return m_channelFreq; |
|
316 |
} |
|
317 |
||
318 |
uint16_t |
|
319 |
RadiotapHeader::GetChannelFlags (void) const |
|
320 |
{ |
|
321 |
NS_LOG_FUNCTION (this); |
|
322 |
return m_channelFlags; |
|
323 |
} |
|
324 |
||
325 |
void |
|
7027
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
326 |
RadiotapHeader::SetAntennaSignalPower (double signal) |
6009 | 327 |
{ |
328 |
NS_LOG_FUNCTION (this << signal); |
|
329 |
||
330 |
if (!(m_present & RADIOTAP_DBM_ANTSIGNAL)) |
|
331 |
{ |
|
332 |
m_present |= RADIOTAP_DBM_ANTSIGNAL; |
|
333 |
m_length += 1; |
|
334 |
} |
|
7027
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
335 |
if (signal > 127) |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
336 |
{ |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
337 |
m_antennaSignal = 127; |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
338 |
} |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
339 |
else if (signal < -128) |
6009 | 340 |
{ |
7027
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
341 |
m_antennaSignal = -128; |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
342 |
} |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
343 |
else |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
344 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7182
diff
changeset
|
345 |
m_antennaSignal = static_cast<int8_t> (floor (signal + 0.5)); |
6009 | 346 |
} |
347 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
348 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
349 |
} |
6009 | 350 |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
351 |
uint8_t |
6009 | 352 |
RadiotapHeader::GetAntennaSignalPower (void) const |
353 |
{ |
|
354 |
NS_LOG_FUNCTION (this); |
|
355 |
return m_antennaSignal; |
|
356 |
} |
|
357 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7027
diff
changeset
|
358 |
void |
7027
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
359 |
RadiotapHeader::SetAntennaNoisePower (double noise) |
6009 | 360 |
{ |
361 |
NS_LOG_FUNCTION (this << noise); |
|
362 |
||
363 |
if (!(m_present & RADIOTAP_DBM_ANTNOISE)) |
|
364 |
{ |
|
365 |
m_present |= RADIOTAP_DBM_ANTNOISE; |
|
366 |
m_length += 1; |
|
367 |
} |
|
7027
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
368 |
if (noise > 127.0) |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
369 |
{ |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
370 |
m_antennaNoise = 127; |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
371 |
} |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
372 |
else if (noise < -128.0) |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
373 |
{ |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
374 |
m_antennaNoise = -128; |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
375 |
} |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
376 |
else |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
377 |
{ |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
378 |
m_antennaNoise = static_cast<int8_t> (floor (noise + 0.5)); |
169e09e9428d
avoid ambiguous method overloads for python bindings
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
6823
diff
changeset
|
379 |
} |
6009 | 380 |
|
381 |
NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); |
|
382 |
} |
|
383 |
||
384 |
uint8_t |
|
385 |
RadiotapHeader::GetAntennaNoisePower (void) const |
|
386 |
{ |
|
387 |
NS_LOG_FUNCTION (this); |
|
388 |
return m_antennaNoise; |
|
389 |
} |
|
390 |
||
391 |
} // namespace ns3 |