A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
wifi-phy-state-helper.h
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
40
WifiPhyStateHelper
();
41
42
void
SetReceiveOkCallback (
WifiPhy::RxOkCallback
callback);
43
void
SetReceiveErrorCallback (
WifiPhy::RxErrorCallback
callback);
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
bool
IsStateSensing (
void
);
53
Time
GetStateDuration (
void
);
54
Time
GetDelayUntilIdle (
void
);
55
Time
GetLastRxStartTime (
void
)
const
;
56
57
void
SwitchToTx (
Time
txDuration,
Ptr<const Packet>
packet,
WifiMode
txMode,
WifiPreamble
preamble, uint8_t txPower);
58
void
SwitchToRx (
Time
rxDuration);
59
void
SwitchToChannelSwitching (
Time
switchingDuration, uint16_t toChannel);
60
void
SwitchToChannelSensing (
Time
sensingDuration);
61
void
SwitchFromRxEndOk (
Ptr<Packet>
packet,
double
snr,
WifiMode
mode,
enum
WifiPreamble
preamble);
62
void
SwitchFromRxEndError (
Ptr<const Packet>
packet,
double
snr);
63
void
SwitchMaybeToCcaBusy (
Time
duration);
64
65
TracedCallback<Time,Time,enum WifiPhy::State>
m_stateLogger;
66
private
:
67
typedef
std::vector<WifiPhyListener *> Listeners;
68
69
void
LogPreviousIdleAndCcaBusyStates (
void
);
70
71
void
NotifyTxStart (
Time
duration);
72
void
NotifyWakeup (
void
);
73
void
NotifyRxStart (
Time
duration);
74
void
NotifyRxEndOk (
void
);
75
void
NotifyRxEndError (
void
);
76
void
NotifyMaybeCcaBusyStart (
Time
duration);
77
void
NotifySwitchingStart (
Time
duration, uint16_t toChannel);
78
void
NotifySensingStart (
Time
duration);
79
void
DoSwitchFromRx (
void
);
80
81
bool
m_rxing;
82
Time
m_endTx;
83
Time
m_endRx;
84
Time
m_endCcaBusy;
85
Time
m_endSwitching;
86
Time
m_endSensing;
87
Time
m_startTx;
88
Time
m_startRx;
89
Time
m_startCcaBusy;
90
Time
m_startSwitching;
91
Time
m_startSensing;
92
Time
m_previousStateChangeTime;
93
94
Listeners m_listeners;
95
TracedCallback<Ptr<const Packet>
, double,
WifiMode
,
enum
WifiPreamble
> m_rxOkTrace;
96
TracedCallback<Ptr<const Packet>
,
double
> m_rxErrorTrace;
97
TracedCallback<Ptr<const Packet>
,
WifiMode
,
WifiPreamble
,uint8_t> m_txTrace;
98
WifiPhy::RxOkCallback
m_rxOkCallback;
99
WifiPhy::RxErrorCallback
m_rxErrorCallback;
100
};
101
102
}
// namespace ns3
103
104
#endif
/* WIFI_PHY_STATE_HELPER_H */
ns3::Time
keep track of time unit.
Definition:
nstime.h:149
ns3::Ptr< const Packet >
ns3::Callback< void, Ptr< Packet >, double, WifiMode, enum WifiPreamble >
ns3::WifiPhy::State
State
Definition:
wifi-phy.h:127
ns3::TracedCallback
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
Definition:
traced-callback.h:43
ns3::WifiMode
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition:
wifi-mode.h:88
ns3::WifiPreamble
WifiPreamble
Definition:
wifi-preamble.h:29
ns3::WifiPhyListener
receive notifications about phy events.
Definition:
wifi-phy.h:44
ns3::WifiPhyStateHelper
Definition:
wifi-phy-state-helper.h:35
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
src
wifi
model
wifi-phy-state-helper.h
Generated on Sun Mar 16 2014 11:25:12 for ns-3 by
1.8.6