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 */