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 */
ns3::HalfDuplexIdealPhy::SetRate
void SetRate(DataRate rate)
Definition:
half-duplex-ideal-phy.cc:201
ns3::HalfDuplexIdealPhy::SetGenericPhyTxEndCallback
void SetGenericPhyTxEndCallback(GenericPhyTxEndCallback c)
Definition:
half-duplex-ideal-phy.cc:216
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::HalfDuplexIdealPhy::m_mobility
Ptr< MobilityModel > m_mobility
Definition:
half-duplex-ideal-phy.h:196
ns3::SpectrumPhy
Definition:
spectrum-phy.h:45
ns3::Callback< void, Ptr< const Packet > >
ns3::HalfDuplexIdealPhy::StartTx
bool StartTx(Ptr< Packet > p)
Definition:
half-duplex-ideal-phy.cc:267
ns3::HalfDuplexIdealPhy::State
State
Definition:
half-duplex-ideal-phy.h:89
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::HalfDuplexIdealPhy::m_state
State m_state
Definition:
half-duplex-ideal-phy.h:208
ns3::HalfDuplexIdealPhy::m_endRxEventId
EventId m_endRxEventId
Definition:
half-duplex-ideal-phy.h:194
ns3::HalfDuplexIdealPhy::SetGenericPhyRxStartCallback
void SetGenericPhyRxStartCallback(GenericPhyRxStartCallback c)
Definition:
half-duplex-ideal-phy.cc:223
ns3::HalfDuplexIdealPhy::m_interference
SpectrumInterference m_interference
Definition:
half-duplex-ideal-phy.h:222
ns3::HalfDuplexIdealPhy::m_phyMacRxEndErrorCallback
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback
Definition:
half-duplex-ideal-phy.h:219
ns3::HalfDuplexIdealPhy::GetMobility
Ptr< MobilityModel > GetMobility()
Definition:
half-duplex-ideal-phy.cc:140
ns3::HalfDuplexIdealPhy::m_rxPsd
Ptr< const SpectrumValue > m_rxPsd
Definition:
half-duplex-ideal-phy.h:202
ns3::HalfDuplexIdealPhy::m_phyTxEndTrace
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
Definition:
half-duplex-ideal-phy.h:211
ns3::HalfDuplexIdealPhy::StartRx
void StartRx(Ptr< SpectrumSignalParameters > params)
Definition:
half-duplex-ideal-phy.cc:328
ns3::HalfDuplexIdealPhy::m_phyRxStartTrace
TracedCallback< Ptr< const Packet > > m_phyRxStartTrace
Definition:
half-duplex-ideal-phy.h:212
ns3::HalfDuplexIdealPhy::m_phyRxAbortTrace
TracedCallback< Ptr< const Packet > > m_phyRxAbortTrace
Definition:
half-duplex-ideal-phy.h:213
ns3::DataRate
Class for representing data rates.
Definition:
data-rate.h:71
ns3::HalfDuplexIdealPhy::m_phyTxStartTrace
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
Definition:
half-duplex-ideal-phy.h:210
ns3::HalfDuplexIdealPhy::SetDevice
void SetDevice(Ptr< NetDevice > d)
Definition:
half-duplex-ideal-phy.cc:148
ns3::HalfDuplexIdealPhy::SetAntenna
void SetAntenna(Ptr< AntennaModel > a)
Definition:
half-duplex-ideal-phy.cc:253
ns3::HalfDuplexIdealPhy::m_txPsd
Ptr< SpectrumValue > m_txPsd
Definition:
half-duplex-ideal-phy.h:201
ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndOkCallback
void SetGenericPhyRxEndOkCallback(GenericPhyRxEndOkCallback c)
Definition:
half-duplex-ideal-phy.cc:239
ns3::HalfDuplexIdealPhy::AbortRx
void AbortRx()
Definition:
half-duplex-ideal-phy.cc:393
ns3::HalfDuplexIdealPhy::~HalfDuplexIdealPhy
virtual ~HalfDuplexIdealPhy()
Definition:
half-duplex-ideal-phy.cc:52
ns3::HalfDuplexIdealPhy::m_phyMacRxEndOkCallback
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback
Definition:
half-duplex-ideal-phy.h:220
ns3::HalfDuplexIdealPhy::DoDispose
virtual void DoDispose(void)
Definition:
half-duplex-ideal-phy.cc:57
ns3::HalfDuplexIdealPhy::GetRxAntenna
Ptr< AntennaModel > GetRxAntenna()
Definition:
half-duplex-ideal-phy.cc:246
ns3::HalfDuplexIdealPhy::m_channel
Ptr< SpectrumChannel > m_channel
Definition:
half-duplex-ideal-phy.h:199
ns3::HalfDuplexIdealPhy
Definition:
half-duplex-ideal-phy.h:78
ns3::HalfDuplexIdealPhy::TX
Definition:
half-duplex-ideal-phy.h:91
ns3::HalfDuplexIdealPhy::HalfDuplexIdealPhy
HalfDuplexIdealPhy()
Definition:
half-duplex-ideal-phy.cc:41
ns3::HalfDuplexIdealPhy::SetNoisePowerSpectralDensity
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Definition:
half-duplex-ideal-phy.cc:193
ns3::HalfDuplexIdealPhy::GetDevice
Ptr< NetDevice > GetDevice()
Definition:
half-duplex-ideal-phy.cc:132
ns3::HalfDuplexIdealPhy::EndRx
void EndRx()
Definition:
half-duplex-ideal-phy.cc:408
ns3::HalfDuplexIdealPhy::IDLE
Definition:
half-duplex-ideal-phy.h:91
ns3::HalfDuplexIdealPhy::ChangeState
void ChangeState(State newState)
Definition:
half-duplex-ideal-phy.cc:260
ns3::SpectrumInterference
Definition:
spectrum-interference.h:46
ns3::HalfDuplexIdealPhy::m_rate
DataRate m_rate
Definition:
half-duplex-ideal-phy.h:206
ns3::HalfDuplexIdealPhy::m_netDevice
Ptr< NetDevice > m_netDevice
Definition:
half-duplex-ideal-phy.h:198
ns3::HalfDuplexIdealPhy::m_rxPacket
Ptr< Packet > m_rxPacket
Definition:
half-duplex-ideal-phy.h:204
ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndErrorCallback
void SetGenericPhyRxEndErrorCallback(GenericPhyRxEndErrorCallback c)
Definition:
half-duplex-ideal-phy.cc:231
ns3::HalfDuplexIdealPhy::m_antenna
Ptr< AntennaModel > m_antenna
Definition:
half-duplex-ideal-phy.h:197
ns3::EventId
an identifier for simulation events.
Definition:
event-id.h:46
ns3::HalfDuplexIdealPhy::m_phyRxEndErrorTrace
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
Definition:
half-duplex-ideal-phy.h:215
ns3::HalfDuplexIdealPhy::m_phyMacRxStartCallback
GenericPhyRxStartCallback m_phyMacRxStartCallback
Definition:
half-duplex-ideal-phy.h:218
ns3::HalfDuplexIdealPhy::GetTypeId
static TypeId GetTypeId(void)
Definition:
half-duplex-ideal-phy.cc:96
ns3::HalfDuplexIdealPhy::RX
Definition:
half-duplex-ideal-phy.h:91
ns3::HalfDuplexIdealPhy::m_txPacket
Ptr< Packet > m_txPacket
Definition:
half-duplex-ideal-phy.h:203
ns3::HalfDuplexIdealPhy::SetChannel
void SetChannel(Ptr< SpectrumChannel > c)
Definition:
half-duplex-ideal-phy.cc:164
ns3::HalfDuplexIdealPhy::EndTx
void EndTx()
Definition:
half-duplex-ideal-phy.cc:308
ns3::HalfDuplexIdealPhy::GetRate
DataRate GetRate() const
Definition:
half-duplex-ideal-phy.cc:208
ns3::HalfDuplexIdealPhy::m_phyRxEndOkTrace
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
Definition:
half-duplex-ideal-phy.h:214
ns3::HalfDuplexIdealPhy::SetMobility
void SetMobility(Ptr< MobilityModel > m)
Definition:
half-duplex-ideal-phy.cc:156
ns3::HalfDuplexIdealPhy::m_phyMacTxEndCallback
GenericPhyTxEndCallback m_phyMacTxEndCallback
Definition:
half-duplex-ideal-phy.h:217
ns3::HalfDuplexIdealPhy::SetTxPowerSpectralDensity
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
Definition:
half-duplex-ideal-phy.cc:184
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::HalfDuplexIdealPhy::GetRxSpectrumModel
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Definition:
half-duplex-ideal-phy.cc:171
src
spectrum
model
half-duplex-ideal-phy.h
Generated on Sat Nov 16 2013 16:17:51 for ns-3 by
1.8.5