OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2015 University of Washington | 3 * Copyright (c) 2015 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 */ | 17 */ |
18 | 18 |
19 #include "ns3/test.h" | 19 #include "ns3/test.h" |
20 #include "ns3/spectrum-wifi-helper.h" | 20 #include "ns3/spectrum-wifi-helper.h" |
21 #include "ns3/wifi-spectrum-value-helper.h" | 21 #include "ns3/wifi-spectrum-value-helper.h" |
22 #include "ns3/spectrum-wifi-phy.h" | 22 #include "ns3/spectrum-wifi-phy.h" |
23 #include "ns3/nist-error-rate-model.h" | 23 #include "ns3/nist-error-rate-model.h" |
24 #include "ns3/wifi-mac-header.h" | 24 #include "ns3/wifi-mac-header.h" |
25 #include "ns3/wifi-mac-trailer.h" | 25 #include "ns3/wifi-mac-trailer.h" |
26 #include "ns3/wifi-phy-tag.h" | 26 #include "ns3/wifi-phy-tag.h" |
27 #include "ns3/wifi-spectrum-signal-parameters.h" | 27 #include "ns3/wifi-spectrum-signal-parameters.h" |
| 28 #include "ns3/log.h" |
28 | 29 |
29 using namespace ns3; | 30 using namespace ns3; |
30 | 31 |
| 32 NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhyBasicTest"); |
| 33 |
31 static const uint8_t CHANNEL_NUMBER = 36; | 34 static const uint8_t CHANNEL_NUMBER = 36; |
32 static const uint32_t FREQUENCY = 5180; // MHz | 35 static const uint32_t FREQUENCY = 5180; // MHz |
33 static const uint8_t CHANNEL_WIDTH = 20; // MHz | 36 static const uint8_t CHANNEL_WIDTH = 20; // MHz |
34 static const uint8_t GUARD_WIDTH = 10; // MHz | 37 static const uint8_t GUARD_WIDTH = 10; // MHz |
35 | 38 |
36 /** | 39 /** |
37 * \ingroup wifi-test | 40 * \ingroup wifi-test |
38 * \ingroup tests | 41 * \ingroup tests |
39 * | 42 * |
40 * \brief Spectrum Wifi Phy Basic Test | 43 * \brief Spectrum Wifi Phy Basic Test |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Make a Wi-Fi signal to inject directly to the StartRx() method | 130 // Make a Wi-Fi signal to inject directly to the StartRx() method |
128 void | 131 void |
129 SpectrumWifiPhyBasicTest::SendSignal (double txPowerWatts) | 132 SpectrumWifiPhyBasicTest::SendSignal (double txPowerWatts) |
130 { | 133 { |
131 m_phy->StartRx (MakeSignal (txPowerWatts)); | 134 m_phy->StartRx (MakeSignal (txPowerWatts)); |
132 } | 135 } |
133 | 136 |
134 void | 137 void |
135 SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, W
ifiTxVector txVector) | 138 SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, W
ifiTxVector txVector) |
136 { | 139 { |
| 140 NS_LOG_FUNCTION(this << snr << txVector); |
137 m_count++; | 141 m_count++; |
138 } | 142 } |
139 | 143 |
140 void | 144 void |
141 SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure (Ptr<Packet> p, double snr) | 145 SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure (Ptr<Packet> p, double snr) |
142 { | 146 { |
| 147 NS_LOG_FUNCTION(this << snr); |
143 m_count++; | 148 m_count++; |
144 } | 149 } |
145 | 150 |
146 SpectrumWifiPhyBasicTest::~SpectrumWifiPhyBasicTest () | 151 SpectrumWifiPhyBasicTest::~SpectrumWifiPhyBasicTest () |
147 { | 152 { |
148 } | 153 } |
149 | 154 |
150 // Create necessary objects, and inject signals. Test that the expected | 155 // Create necessary objects, and inject signals. Test that the expected |
151 // number of packet receptions occur. | 156 // number of packet receptions occur. |
152 void | 157 void |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 virtual void NotifyRxEndOk (void) | 217 virtual void NotifyRxEndOk (void) |
213 { | 218 { |
214 ++m_notifyRxEndOk; | 219 ++m_notifyRxEndOk; |
215 } | 220 } |
216 virtual void NotifyRxEndError (void) | 221 virtual void NotifyRxEndError (void) |
217 { | 222 { |
218 ++m_notifyRxEndError; | 223 ++m_notifyRxEndError; |
219 } | 224 } |
220 virtual void NotifyTxStart (Time duration, double txPowerDbm) | 225 virtual void NotifyTxStart (Time duration, double txPowerDbm) |
221 { | 226 { |
| 227 NS_LOG_FUNCTION(this << txPowerDbm); |
222 } | 228 } |
223 virtual void NotifyMaybeCcaBusyStart (Time duration) | 229 virtual void NotifyMaybeCcaBusyStart (Time duration) |
224 { | 230 { |
225 ++m_notifyMaybeCcaBusyStart; | 231 ++m_notifyMaybeCcaBusyStart; |
226 } | 232 } |
227 virtual void NotifySwitchingStart (Time duration) | 233 virtual void NotifySwitchingStart (Time duration) |
228 { | 234 { |
229 } | 235 } |
230 virtual void NotifySleep (void) | 236 virtual void NotifySleep (void) |
231 { | 237 { |
232 } | 238 } |
233 virtual void NotifyOff (void) | 239 virtual void NotifyOff (void) |
234 { | 240 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 }; | 312 }; |
307 | 313 |
308 SpectrumWifiPhyTestSuite::SpectrumWifiPhyTestSuite () | 314 SpectrumWifiPhyTestSuite::SpectrumWifiPhyTestSuite () |
309 : TestSuite ("spectrum-wifi-phy", UNIT) | 315 : TestSuite ("spectrum-wifi-phy", UNIT) |
310 { | 316 { |
311 AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK); | 317 AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK); |
312 AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK); | 318 AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK); |
313 } | 319 } |
314 | 320 |
315 static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite; ///< the test suite | 321 static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite; ///< the test suite |
OLD | NEW |