Left: | ||
Right: |
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) 2011 The Boeing Company | 3 * Copyright (c) 2011 The Boeing Company |
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 * @param status the status of PlmeSetAttributeRequest | 221 * @param status the status of PlmeSetAttributeRequest |
222 * @param id the identifier of attribute | 222 * @param id the identifier of attribute |
223 */ | 223 */ |
224 typedef Callback< void, LrWpanPhyEnumeration, | 224 typedef Callback< void, LrWpanPhyEnumeration, |
225 LrWpanPibAttributeIdentifier > PlmeSetAttributeConfirmCallback ; | 225 LrWpanPibAttributeIdentifier > PlmeSetAttributeConfirmCallback ; |
226 | 226 |
227 /** | 227 /** |
228 * \ingroup lr-wpan | 228 * \ingroup lr-wpan |
229 * | 229 * |
230 * A LrWpanPhy listener class for notifying listeners of LrWpan radio state chan ge. | |
231 */ | |
232 class LrWpanPhyListener | |
233 { | |
234 public: | |
235 virtual ~LrWpanPhyListener () { } | |
236 virtual void NotifyRx (void) = 0; | |
237 virtual void NotifyRxStart (void) = 0; | |
238 virtual void NotifyTx (void) = 0; | |
239 virtual void NotifyTxStart (void) = 0; | |
240 virtual void NotifySleep (void) = 0; | |
241 virtual void NotifyTransition (int) = 0; | |
Tommaso Pecorella
2015/07/22 15:46:38
Not an int - an enum perhaps
vrege
2015/07/25 10:22:48
Specifying the argument as enum - LrWpanPhy::State
| |
242 }; | |
243 | |
244 /** | |
245 * \ingroup lr-wpan | |
246 * | |
230 * Make LrWpanPhy a SpectrumPhy so we can enable the eventual modeling of | 247 * Make LrWpanPhy a SpectrumPhy so we can enable the eventual modeling of |
231 * device interference | 248 * device interference |
232 */ | 249 */ |
233 class LrWpanPhy : public SpectrumPhy | 250 class LrWpanPhy : public SpectrumPhy |
234 { | 251 { |
235 | 252 |
236 public: | 253 public: |
254 enum State { BUSY_RX, BUSY_TX, TRX_OFF, RX_ON, TX_ON, TRANSITION }; | |
255 | |
237 /** | 256 /** |
238 * Get the type ID. | 257 * Get the type ID. |
239 * | 258 * |
240 * \return the object TypeId | 259 * \return the object TypeId |
241 */ | 260 */ |
242 static TypeId GetTypeId (void); | 261 static TypeId GetTypeId (void); |
243 | 262 |
244 /** | 263 /** |
264 * Get the current transceiver state. | |
265 */ | |
266 LrWpanPhyEnumeration GetTRXState (void); | |
267 | |
268 /** | |
245 * The maximum packet size accepted by the PHY. | 269 * The maximum packet size accepted by the PHY. |
246 * See Table 22 in section 6.4.1 of IEEE 802.15.4-2006 | 270 * See Table 22 in section 6.4.1 of IEEE 802.15.4-2006 |
247 */ | 271 */ |
248 static const uint32_t aMaxPhyPacketSize; | 272 static const uint32_t aMaxPhyPacketSize; |
249 | 273 |
250 /** | 274 /** |
251 * The turnaround time for switching the transceiver from RX to TX or vice | 275 * The turnaround time for switching the transceiver from RX to TX or vice |
252 * versa. | 276 * versa. |
253 * See Table 22 in section 6.4.1 of IEEE 802.15.4-2006 | 277 * See Table 22 in section 6.4.1 of IEEE 802.15.4-2006 |
254 */ | 278 */ |
255 static const uint32_t aTurnaroundTime; | 279 static const uint32_t aTurnaroundTime; |
256 | 280 |
257 /** | 281 /** |
282 * The time for switching the transceiver from OFF to ON or vice | |
283 * versa. | |
284 */ | |
285 Time m_rxSetupTime; | |
Tommaso Pecorella
2015/07/22 15:46:38
Does it have any connection with aTurnAroundTime ?
Tommaso Pecorella
2015/07/22 15:46:38
I'd use a different name, e.g., m_stateChangeTime.
vrege
2015/07/25 10:22:48
This is the time to switch between ON (RX_ON or TX
| |
286 | |
287 /** | |
258 * Default constructor. | 288 * Default constructor. |
259 */ | 289 */ |
260 LrWpanPhy (void); | 290 LrWpanPhy (void); |
261 virtual ~LrWpanPhy (void); | 291 virtual ~LrWpanPhy (void); |
262 | 292 |
293 /** | |
294 * Handle energy depletion event. Referenced by Energy Model. | |
295 */ | |
296 void EnergyDepletionHandler (void); | |
297 | |
298 /** | |
299 * Handle energy recharged event. Referenced by Energy Model. | |
300 */ | |
301 void EnergyRechargedHandler (void); | |
302 | |
303 /** | |
304 * Register a LrWpanPhyListener to be notified of Phy events. | |
305 */ | |
306 void RegisterListener (LrWpanPhyListener *listener); | |
307 | |
263 // inherited from SpectrumPhy | 308 // inherited from SpectrumPhy |
264 void SetMobility (Ptr<MobilityModel> m); | 309 void SetMobility (Ptr<MobilityModel> m); |
265 Ptr<MobilityModel> GetMobility (void); | 310 Ptr<MobilityModel> GetMobility (void); |
266 void SetChannel (Ptr<SpectrumChannel> c); | 311 void SetChannel (Ptr<SpectrumChannel> c); |
267 | 312 |
268 /** | 313 /** |
269 * Get the currently attached channel. | 314 * Get the currently attached channel. |
270 * | 315 * |
271 * \return the channel | 316 * \return the channel |
272 */ | 317 */ |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 * See Table 2 in section 6.1.2 IEEE 802.15.4-2006 | 533 * See Table 2 in section 6.1.2 IEEE 802.15.4-2006 |
489 */ | 534 */ |
490 static const LrWpanPhyDataAndSymbolRates dataSymbolRates[7]; | 535 static const LrWpanPhyDataAndSymbolRates dataSymbolRates[7]; |
491 /** | 536 /** |
492 * The preamble, SFD, and PHR lengths in symbols for the different PHY options . | 537 * The preamble, SFD, and PHR lengths in symbols for the different PHY options . |
493 * See Table 19 and Table 20 in section 6.3 IEEE 802.15.4-2006 | 538 * See Table 19 and Table 20 in section 6.3 IEEE 802.15.4-2006 |
494 */ | 539 */ |
495 static const LrWpanPhyPpduHeaderSymbolNumber ppduHeaderSymbolNumbers[7]; | 540 static const LrWpanPhyPpduHeaderSymbolNumber ppduHeaderSymbolNumbers[7]; |
496 | 541 |
497 private: | 542 private: |
543 | |
544 /** List of Phy Listeners. */ | |
545 typedef std::list<LrWpanPhyListener *> ListenerList; | |
546 ListenerList m_listeners; //!< List of listeners. | |
547 | |
548 bool m_disabled; //!< Energy depleted. | |
549 | |
498 /** | 550 /** |
499 * The second is true if the first is flagged as error/invalid. | 551 * The second is true if the first is flagged as error/invalid. |
500 */ | 552 */ |
501 typedef std::pair<Ptr<Packet>, bool> PacketAndStatus; | 553 typedef std::pair<Ptr<Packet>, bool> PacketAndStatus; |
502 | 554 |
503 // Inherited from Object. | 555 // Inherited from Object. |
504 virtual void DoDispose (void); | 556 virtual void DoDispose (void); |
505 | 557 |
558 /** Call LrWpanPhyListener::NotifyRx on all listeners. */ | |
559 void NotifyListenersRx (void); | |
560 /** Call LrWpanPhyListener::NotifyRxStart on all listeners. */ | |
561 void NotifyListenersRxStart (void); | |
562 /** Call LrWpanPhyListener::NotifyTx on all listeners. */ | |
563 void NotifyListenersTx (void); | |
564 /** Call LrWpanPhyListener::NotifyTxStart on all listeners. */ | |
565 void NotifyListenersTxStart (void); | |
566 /** Call LrWpanPhyListener::NotifySleep on all listeners. */ | |
567 void NotifyListenersSleep (void); | |
568 /** | |
569 * Call LrWpanPhyListener::NotifyTransition on all listeners. | |
570 * | |
571 * \param State Next State. | |
572 */ | |
573 void NotifyListenersTransition (LrWpanPhy::State); | |
574 | |
506 /** | 575 /** |
507 * Change the PHY state to the given new state, firing the state change trace. | 576 * Change the PHY state to the given new state, firing the state change trace. |
508 * | 577 * |
509 * \param newState the new state | 578 * \param newState the new state |
510 */ | 579 */ |
511 void ChangeTrxState (LrWpanPhyEnumeration newState); | 580 void ChangeTrxState (LrWpanPhyEnumeration newState); |
512 | 581 |
513 /** | 582 /** |
514 * Configure the PHY option according to the current channel and channel page. | 583 * Configure the PHY option according to the current channel and channel page. |
515 * See IEEE 802.15.4-2006, section 6.1.2, Table 2. | 584 * See IEEE 802.15.4-2006, section 6.1.2, Table 2. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 /** | 897 /** |
829 * Uniform random variable stream. | 898 * Uniform random variable stream. |
830 */ | 899 */ |
831 Ptr<UniformRandomVariable> m_random; | 900 Ptr<UniformRandomVariable> m_random; |
832 }; | 901 }; |
833 | 902 |
834 | 903 |
835 } // namespace ns3 | 904 } // namespace ns3 |
836 | 905 |
837 #endif /* LR_WPAN_PHY_H */ | 906 #endif /* LR_WPAN_PHY_H */ |
OLD | NEW |