LEFT | RIGHT |
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) 2010 Network Security Lab, University of Washington, Seattle. | 3 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle. |
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 { | 220 { |
221 NS_LOG_FUNCTION (this); | 221 NS_LOG_FUNCTION (this); |
222 if (callback.IsNull ()) | 222 if (callback.IsNull ()) |
223 { | 223 { |
224 NS_LOG_DEBUG ("WifiRadioEnergyModel:Setting NULL energy depletion callback
!"); | 224 NS_LOG_DEBUG ("WifiRadioEnergyModel:Setting NULL energy depletion callback
!"); |
225 } | 225 } |
226 m_energyDepletionCallback = callback; | 226 m_energyDepletionCallback = callback; |
227 } | 227 } |
228 | 228 |
229 void | 229 void |
| 230 WifiRadioEnergyModel::SetEnergyRechargedCallback ( |
| 231 WifiRadioEnergyRechargedCallback callback) |
| 232 { |
| 233 NS_LOG_FUNCTION (this); |
| 234 if (callback.IsNull ()) |
| 235 { |
| 236 NS_LOG_DEBUG ("WifiRadioEnergyModel:Setting NULL energy recharged callback
!"); |
| 237 } |
| 238 m_energyRechargedCallback = callback; |
| 239 } |
| 240 |
| 241 void |
230 WifiRadioEnergyModel::SetTxCurrentModel (Ptr<WifiTxCurrentModel> model) | 242 WifiRadioEnergyModel::SetTxCurrentModel (Ptr<WifiTxCurrentModel> model) |
231 { | 243 { |
232 m_txCurrentModel = model; | 244 m_txCurrentModel = model; |
233 } | 245 } |
234 | 246 |
235 void | 247 void |
236 WifiRadioEnergyModel::SetTxCurrentFromModel (double txPowerDbm) | 248 WifiRadioEnergyModel::SetTxCurrentFromModel (double txPowerDbm) |
237 { | 249 { |
238 if (m_txCurrentModel) | 250 if (m_txCurrentModel) |
239 { | 251 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 323 |
312 void | 324 void |
313 WifiRadioEnergyModel::HandleEnergyDepletion (void) | 325 WifiRadioEnergyModel::HandleEnergyDepletion (void) |
314 { | 326 { |
315 NS_LOG_FUNCTION (this); | 327 NS_LOG_FUNCTION (this); |
316 NS_LOG_DEBUG ("WifiRadioEnergyModel:Energy is depleted!"); | 328 NS_LOG_DEBUG ("WifiRadioEnergyModel:Energy is depleted!"); |
317 // invoke energy depletion callback, if set. | 329 // invoke energy depletion callback, if set. |
318 if (!m_energyDepletionCallback.IsNull ()) | 330 if (!m_energyDepletionCallback.IsNull ()) |
319 { | 331 { |
320 m_energyDepletionCallback (); | 332 m_energyDepletionCallback (); |
| 333 } |
| 334 } |
| 335 |
| 336 void |
| 337 WifiRadioEnergyModel::HandleEnergyRecharged (void) |
| 338 { |
| 339 NS_LOG_FUNCTION (this); |
| 340 NS_LOG_DEBUG ("WifiRadioEnergyModel:Energy is recharged!"); |
| 341 // invoke energy recharged callback, if set. |
| 342 if (!m_energyRechargedCallback.IsNull ()) |
| 343 { |
| 344 m_energyRechargedCallback (); |
321 } | 345 } |
322 } | 346 } |
323 | 347 |
324 WifiRadioEnergyModelPhyListener * | 348 WifiRadioEnergyModelPhyListener * |
325 WifiRadioEnergyModel::GetPhyListener (void) | 349 WifiRadioEnergyModel::GetPhyListener (void) |
326 { | 350 { |
327 NS_LOG_FUNCTION (this); | 351 NS_LOG_FUNCTION (this); |
328 return m_listener; | 352 return m_listener; |
329 } | 353 } |
330 | 354 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 { | 561 { |
538 NS_LOG_FUNCTION (this); | 562 NS_LOG_FUNCTION (this); |
539 if (m_changeStateCallback.IsNull ()) | 563 if (m_changeStateCallback.IsNull ()) |
540 { | 564 { |
541 NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not
set!"); | 565 NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not
set!"); |
542 } | 566 } |
543 m_changeStateCallback (WifiPhy::IDLE); | 567 m_changeStateCallback (WifiPhy::IDLE); |
544 } | 568 } |
545 | 569 |
546 } // namespace ns3 | 570 } // namespace ns3 |
LEFT | RIGHT |