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) 2014 Universidad de la República - Uruguay | 3 * Copyright (c) 2014 Universidad de la República - Uruguay |
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 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 ParfWifiManager::~ParfWifiManager () | 90 ParfWifiManager::~ParfWifiManager () |
91 { | 91 { |
92 NS_LOG_FUNCTION (this); | 92 NS_LOG_FUNCTION (this); |
93 } | 93 } |
94 | 94 |
95 void | 95 void |
96 ParfWifiManager::SetupPhy (const Ptr<WifiPhy> phy) | 96 ParfWifiManager::SetupPhy (const Ptr<WifiPhy> phy) |
97 { | 97 { |
98 m_minPower = phy->GetTxPowerStart (); | 98 m_minPower = static_cast<uint8_t>(phy->GetTxPowerStart ()); |
99 m_maxPower = phy->GetTxPowerEnd (); | 99 m_maxPower = static_cast<uint8_t>(phy->GetTxPowerEnd ()); |
100 WifiRemoteStationManager::SetupPhy (phy); | 100 WifiRemoteStationManager::SetupPhy (phy); |
101 } | 101 } |
102 | 102 |
103 WifiRemoteStation * | 103 WifiRemoteStation * |
104 ParfWifiManager::DoCreateStation (void) const | 104 ParfWifiManager::DoCreateStation (void) const |
105 { | 105 { |
106 NS_LOG_FUNCTION (this); | 106 NS_LOG_FUNCTION (this); |
107 ParfWifiRemoteStation *station = new ParfWifiRemoteStation (); | 107 ParfWifiRemoteStation *station = new ParfWifiRemoteStation (); |
108 | 108 |
109 station->m_nSuccess = 0; | 109 station->m_nSuccess = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
121 } | 121 } |
122 | 122 |
123 void | 123 void |
124 ParfWifiManager::CheckInit (ParfWifiRemoteStation *station) | 124 ParfWifiManager::CheckInit (ParfWifiRemoteStation *station) |
125 { | 125 { |
126 if (!station->m_initialized) | 126 if (!station->m_initialized) |
127 { | 127 { |
128 station->m_nSupported = GetNSupported (station); | 128 station->m_nSupported = GetNSupported (station); |
129 station->m_rateIndex = station->m_nSupported - 1; | 129 station->m_rateIndex = station->m_nSupported - 1; |
130 station->m_prevRateIndex = station->m_nSupported - 1; | 130 station->m_prevRateIndex = station->m_nSupported - 1; |
131 station->m_powerLevel = m_maxPower; | 131 station->m_powerLevel = static_cast<uint8_t>(m_maxPower); |
132 station->m_prevPowerLevel = m_maxPower; | 132 station->m_prevPowerLevel = static_cast<uint8_t>(m_maxPower); |
133 WifiMode mode = GetSupported (station, station->m_rateIndex); | 133 WifiMode mode = GetSupported (station, station->m_rateIndex); |
134 uint8_t channelWidth = GetChannelWidth (station); | 134 uint8_t channelWidth = GetChannelWidth (station); |
135 DataRate rate = DataRate (mode.GetDataRate (channelWidth)); | 135 DataRate rate = DataRate (mode.GetDataRate (channelWidth)); |
136 double power = GetPhy ()->GetPowerDbm (m_maxPower); | 136 double power = GetPhy ()->GetPowerDbm (static_cast<uint8_t>(m_maxPower)); |
137 m_powerChange (power, power, station->m_state->m_address); | 137 m_powerChange (power, power, station->m_state->m_address); |
138 m_rateChange (rate, rate, station->m_state->m_address); | 138 m_rateChange (rate, rate, station->m_state->m_address); |
139 station->m_initialized = true; | 139 station->m_initialized = true; |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void | 143 void |
144 ParfWifiManager::DoReportRtsFailed (WifiRemoteStation *station) | 144 ParfWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
145 { | 145 { |
146 NS_LOG_FUNCTION (this << station); | 146 NS_LOG_FUNCTION (this << station); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 NS_LOG_FUNCTION (this << st); | 294 NS_LOG_FUNCTION (this << st); |
295 ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st; | 295 ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st; |
296 uint8_t channelWidth = GetChannelWidth (station); | 296 uint8_t channelWidth = GetChannelWidth (station); |
297 if (channelWidth > 20 && channelWidth != 22) | 297 if (channelWidth > 20 && channelWidth != 22) |
298 { | 298 { |
299 //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac | 299 //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac |
300 channelWidth = 20; | 300 channelWidth = 20; |
301 } | 301 } |
302 CheckInit (station); | 302 CheckInit (station); |
303 WifiMode mode = GetSupported (station, station->m_rateIndex); | 303 WifiMode mode = GetSupported (station, station->m_rateIndex); |
304 DataRate rate = DataRate (mode.GetDataRate (channelWidth)); | 304 DataRate rate = DataRate (mode.GetDataRate (static_cast<uint8_t>(channelWidth)
)); |
305 DataRate prevRate = DataRate (GetSupported (station, station->m_prevRateIndex)
.GetDataRate (channelWidth)); | 305 DataRate prevRate = DataRate (GetSupported (station, station->m_prevRateIndex)
.GetDataRate (static_cast<uint8_t>(channelWidth))); |
306 double power = GetPhy ()->GetPowerDbm (station->m_powerLevel); | 306 double power = GetPhy ()->GetPowerDbm (station->m_powerLevel); |
307 double prevPower = GetPhy ()->GetPowerDbm (station->m_prevPowerLevel); | 307 double prevPower = GetPhy ()->GetPowerDbm (station->m_prevPowerLevel); |
308 if (station->m_prevPowerLevel != station->m_powerLevel) | 308 if (station->m_prevPowerLevel != station->m_powerLevel) |
309 { | 309 { |
310 m_powerChange (prevPower, power, station->m_state->m_address); | 310 m_powerChange (prevPower, power, station->m_state->m_address); |
311 station->m_prevPowerLevel = station->m_powerLevel; | 311 station->m_prevPowerLevel = station->m_powerLevel; |
312 } | 312 } |
313 if (station->m_prevRateIndex != station->m_rateIndex) | 313 if (station->m_prevRateIndex != station->m_rateIndex) |
314 { | 314 { |
315 m_rateChange (prevRate, rate, station->m_state->m_address); | 315 m_rateChange (prevRate, rate, station->m_state->m_address); |
316 station->m_prevRateIndex = station->m_rateIndex; | 316 station->m_prevRateIndex = station->m_rateIndex; |
317 } | 317 } |
318 return WifiTxVector (mode, station->m_powerLevel, GetLongRetryCount (station),
GetPreambleForTransmission (mode, GetAddress (station)), 800, 1, 1, 0, channelW
idth, GetAggregation (station), false); | 318 return WifiTxVector (mode, station->m_powerLevel, static_cast<uint8_t>(GetLong
RetryCount (station)), GetPreambleForTransmission (mode, GetAddress (station)),
800, 1, 1, 0, static_cast<uint8_t>(channelWidth), GetAggregation (station), fals
e); |
319 } | 319 } |
320 | 320 |
321 WifiTxVector | 321 WifiTxVector |
322 ParfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) | 322 ParfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
323 { | 323 { |
324 NS_LOG_FUNCTION (this << st); | 324 NS_LOG_FUNCTION (this << st); |
325 /// \todo we could/should implement the Arf algorithm for | 325 /// \todo we could/should implement the Arf algorithm for |
326 /// RTS only by picking a single rate within the BasicRateSet. | 326 /// RTS only by picking a single rate within the BasicRateSet. |
327 ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st; | 327 ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st; |
328 uint8_t channelWidth = GetChannelWidth (station); | 328 uint8_t channelWidth = GetChannelWidth (station); |
329 if (channelWidth > 20 && channelWidth != 22) | 329 if (channelWidth > 20 && channelWidth != 22) |
330 { | 330 { |
331 //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac | 331 //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac |
332 channelWidth = 20; | 332 channelWidth = 20; |
333 } | 333 } |
334 WifiTxVector rtsTxVector; | 334 WifiTxVector rtsTxVector; |
335 WifiMode mode; | 335 WifiMode mode; |
336 if (GetUseNonErpProtection () == false) | 336 if (GetUseNonErpProtection () == false) |
337 { | 337 { |
338 mode = GetSupported (station, 0); | 338 mode = GetSupported (station, 0); |
339 } | 339 } |
340 else | 340 else |
341 { | 341 { |
342 mode = GetNonErpSupported (station, 0); | 342 mode = GetNonErpSupported (station, 0); |
343 } | 343 } |
344 rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCoun
t (station), GetPreambleForTransmission (mode, GetAddress (station)), 800, 1, 1,
0, channelWidth, GetAggregation (station), false); | 344 rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), static_cast<uint8
_t>(GetShortRetryCount (station)), GetPreambleForTransmission (mode, GetAddress
(station)), 800, 1, 1, 0, (uint8_t)channelWidth, GetAggregation (station), false
); |
345 return rtsTxVector; | 345 return rtsTxVector; |
346 } | 346 } |
347 | 347 |
348 bool | 348 bool |
349 ParfWifiManager::IsLowLatency (void) const | 349 ParfWifiManager::IsLowLatency (void) const |
350 { | 350 { |
351 NS_LOG_FUNCTION (this); | 351 NS_LOG_FUNCTION (this); |
352 return true; | 352 return true; |
353 } | 353 } |
354 | 354 |
(...skipping 21 matching lines...) Expand all Loading... |
376 ParfWifiManager::SetHeSupported (bool enable) | 376 ParfWifiManager::SetHeSupported (bool enable) |
377 { | 377 { |
378 //HE is not supported by this algorithm. | 378 //HE is not supported by this algorithm. |
379 if (enable) | 379 if (enable) |
380 { | 380 { |
381 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat
es"); | 381 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat
es"); |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 } //namespace ns3 | 385 } //namespace ns3 |
OLD | NEW |