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
half-duplex-ideal-phy.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
#ifndef HALF_DUPLEX_IDEAL_PHY_H
22
#define HALF_DUPLEX_IDEAL_PHY_H
23
24
25
#include <ns3/spectrum-value.h>
26
#include <ns3/mobility-model.h>
27
#include <ns3/packet.h>
28
#include <ns3/nstime.h>
29
#include <ns3/net-device.h>
30
#include <ns3/spectrum-phy.h>
31
#include <ns3/spectrum-channel.h>
32
#include <ns3/spectrum-interference.h>
33
#include <ns3/data-rate.h>
34
#include <ns3/generic-phy.h>
35
#include <ns3/event-id.h>
36
#include <ns3/spectrum-signal-parameters.h>
37
38
namespace
ns3 {
39
78
class
HalfDuplexIdealPhy
:
public
SpectrumPhy
79
{
80
81
public
:
82
HalfDuplexIdealPhy
();
83
virtual
~HalfDuplexIdealPhy
();
84
89
enum
State
90
{
91
IDLE
,
TX
,
RX
92
};
93
94
static
TypeId
GetTypeId
(
void
);
95
96
// inherited from SpectrumPhy
97
void
SetChannel
(
Ptr<SpectrumChannel>
c);
98
void
SetMobility
(
Ptr<MobilityModel>
m);
99
void
SetDevice
(
Ptr<NetDevice>
d);
100
Ptr<MobilityModel>
GetMobility
();
101
Ptr<NetDevice>
GetDevice
();
102
Ptr<const SpectrumModel>
GetRxSpectrumModel
()
const
;
103
Ptr<AntennaModel>
GetRxAntenna
();
104
void
StartRx
(
Ptr<SpectrumSignalParameters>
params);
105
106
113
void
SetTxPowerSpectralDensity
(
Ptr<SpectrumValue>
txPsd);
114
120
void
SetNoisePowerSpectralDensity
(
Ptr<const SpectrumValue>
noisePsd);
121
122
132
bool
StartTx
(
Ptr<Packet>
p);
133
139
void
SetRate
(
DataRate
rate);
140
145
DataRate
GetRate
()
const
;
146
153
void
SetGenericPhyTxEndCallback
(
GenericPhyTxEndCallback
c);
154
161
void
SetGenericPhyRxStartCallback
(
GenericPhyRxStartCallback
c);
162
169
void
SetGenericPhyRxEndErrorCallback
(
GenericPhyRxEndErrorCallback
c);
170
177
void
SetGenericPhyRxEndOkCallback
(
GenericPhyRxEndOkCallback
c);
178
184
void
SetAntenna
(
Ptr<AntennaModel>
a);
185
186
private
:
187
virtual
void
DoDispose
(
void
);
188
189
void
ChangeState
(
State
newState);
190
void
EndTx
();
191
void
AbortRx
();
192
void
EndRx
();
193
194
EventId
m_endRxEventId
;
195
196
Ptr<MobilityModel>
m_mobility
;
197
Ptr<AntennaModel>
m_antenna
;
198
Ptr<NetDevice>
m_netDevice
;
199
Ptr<SpectrumChannel>
m_channel
;
200
201
Ptr<SpectrumValue>
m_txPsd
;
202
Ptr<const SpectrumValue>
m_rxPsd
;
203
Ptr<Packet>
m_txPacket
;
204
Ptr<Packet>
m_rxPacket
;
205
206
DataRate
m_rate
;
207
208
State
m_state
;
209
210
TracedCallback<Ptr<const Packet>
>
m_phyTxStartTrace
;
211
TracedCallback<Ptr<const Packet>
>
m_phyTxEndTrace
;
212
TracedCallback<Ptr<const Packet>
>
m_phyRxStartTrace
;
213
TracedCallback<Ptr<const Packet>
>
m_phyRxAbortTrace
;
214
TracedCallback<Ptr<const Packet>
>
m_phyRxEndOkTrace
;
215
TracedCallback<Ptr<const Packet>
>
m_phyRxEndErrorTrace
;
216
217
GenericPhyTxEndCallback
m_phyMacTxEndCallback
;
218
GenericPhyRxStartCallback
m_phyMacRxStartCallback
;
219
GenericPhyRxEndErrorCallback
m_phyMacRxEndErrorCallback
;
220
GenericPhyRxEndOkCallback
m_phyMacRxEndOkCallback
;
221
222
SpectrumInterference
m_interference
;
223
224
};
225
226
227
228
229
230
231
}
232
233
234
235
236
237
#endif
/* HALF_DUPLEX_IDEAL_PHY_H */
src
spectrum
model
half-duplex-ideal-phy.h
Generated on Tue Oct 9 2012 16:45:46 for ns-3 by
1.8.1.2