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
File Members
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
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
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
63
TracedCallback<Time,Time,enum WifiPhy::State>
m_stateLogger
;
64
private
:
65
typedef
std::vector<WifiPhyListener *>
Listeners
;
66
67
void
LogPreviousIdleAndCcaBusyStates
(
void
);
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
;
79
Time
m_endTx
;
80
Time
m_endRx
;
81
Time
m_endCcaBusy
;
82
Time
m_endSwitching
;
83
Time
m_startTx
;
84
Time
m_startRx
;
85
Time
m_startCcaBusy
;
86
Time
m_startSwitching
;
87
Time
m_previousStateChangeTime
;
88
89
Listeners
m_listeners
;
90
TracedCallback<Ptr<const Packet>
, double,
WifiMode
,
enum
WifiPreamble
>
m_rxOkTrace
;
91
TracedCallback<Ptr<const Packet>
,
double
>
m_rxErrorTrace
;
92
TracedCallback<Ptr<const Packet>
,
WifiMode
,
WifiPreamble
,uint8_t>
m_txTrace
;
93
WifiPhy::RxOkCallback
m_rxOkCallback
;
94
WifiPhy::RxErrorCallback
m_rxErrorCallback
;
95
};
96
97
}
// namespace ns3
98
99
#endif
/* WIFI_PHY_STATE_HELPER_H */
src
wifi
model
wifi-phy-state-helper.h
Generated on Tue Oct 9 2012 16:45:49 for ns-3 by
1.8.1.2