A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
wifi-phy-state-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef WIFI_PHY_STATE_HELPER_H
21 #define WIFI_PHY_STATE_HELPER_H
22 
23 #include "wifi-phy.h"
24 #include "ns3/traced-callback.h"
25 #include "ns3/object.h"
26 #include <vector>
27 
28 namespace ns3 {
29 
35 class WifiPhyStateHelper : public Object
36 {
37 public:
38  static TypeId GetTypeId (void);
39 
41 
44  void RegisterListener (WifiPhyListener *listener);
45  enum WifiPhy::State GetState (void);
46  bool IsStateCcaBusy (void);
47  bool IsStateIdle (void);
48  bool IsStateBusy (void);
49  bool IsStateRx (void);
50  bool IsStateTx (void);
51  bool IsStateSwitching (void);
52  Time GetStateDuration (void);
53  Time GetDelayUntilIdle (void);
54  Time GetLastRxStartTime (void) const;
55 
56  void SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower);
57  void SwitchToRx (Time rxDuration);
58  void SwitchToChannelSwitching (Time switchingDuration);
59  void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
60  void SwitchFromRxEndError (Ptr<const Packet> packet, double snr);
61  void SwitchMaybeToCcaBusy (Time duration);
62 
64 private:
65  typedef std::vector<WifiPhyListener *> Listeners;
66 
68 
69  void NotifyTxStart (Time duration);
70  void NotifyWakeup (void);
71  void NotifyRxStart (Time duration);
72  void NotifyRxEndOk (void);
73  void NotifyRxEndError (void);
74  void NotifyMaybeCcaBusyStart (Time duration);
75  void NotifySwitchingStart (Time duration);
76  void DoSwitchFromRx (void);
77 
78  bool m_rxing;
88 
95 };
96 
97 } // namespace ns3
98 
99 #endif /* WIFI_PHY_STATE_HELPER_H */
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
TracedCallback< Time, Time, enum WifiPhy::State > m_stateLogger
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
void SwitchToChannelSwitching(Time switchingDuration)
void SetReceiveOkCallback(WifiPhy::RxOkCallback callback)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
std::vector< WifiPhyListener * > Listeners
void SwitchToTx(Time txDuration, Ptr< const Packet > packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower)
WifiPreamble
Definition: wifi-preamble.h:29
TracedCallback< Ptr< const Packet >, double, WifiMode, enum WifiPreamble > m_rxOkTrace
void NotifyTxStart(Time duration)
receive notifications about phy events.
Definition: wifi-phy.h:44
void NotifySwitchingStart(Time duration)
void SetReceiveErrorCallback(WifiPhy::RxErrorCallback callback)
void NotifyMaybeCcaBusyStart(Time duration)
WifiPhy::RxErrorCallback m_rxErrorCallback
void SwitchFromRxEndError(Ptr< const Packet > packet, double snr)
void SwitchFromRxEndOk(Ptr< Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble)
static TypeId GetTypeId(void)
enum WifiPhy::State GetState(void)
TracedCallback< Ptr< const Packet >, WifiMode, WifiPreamble, uint8_t > m_txTrace
TracedCallback< Ptr< const Packet >, double > m_rxErrorTrace
a base class which provides memory management and object aggregation
Definition: object.h:63
void SwitchToRx(Time rxDuration)
Time GetLastRxStartTime(void) const
void NotifyRxStart(Time duration)
a unique identifier for an interface.
Definition: type-id.h:49
void RegisterListener(WifiPhyListener *listener)
void SwitchMaybeToCcaBusy(Time duration)
WifiPhy::RxOkCallback m_rxOkCallback