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
uan-phy-dual.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 University of Washington
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: Leonard Tracy <lentracy@gmail.com>
19
* Andrea Sacco <andrea.sacco85@gmail.com>
20
*/
21
22
#ifndef UAN_PHY_DUAL_H
23
#define UAN_PHY_DUAL_H
24
25
#include "ns3/uan-phy.h"
26
27
28
29
namespace
ns3 {
30
31
class
UanTxMode;
32
class
UanModesList;
33
34
43
class
UanPhyCalcSinrDual
:
public
UanPhyCalcSinr
44
{
45
public
:
46
UanPhyCalcSinrDual
();
47
virtual
~UanPhyCalcSinrDual
();
48
static
TypeId
GetTypeId
(
void
);
49
virtual
double
CalcSinrDb
(
Ptr<Packet>
pkt,
50
Time
arrTime,
51
double
rxPowerDb,
52
double
ambNoiseDb,
53
UanTxMode
mode,
54
UanPdp
pdp,
55
const
UanTransducer::ArrivalList
&arrivalList
56
)
const
;
57
};
58
72
class
UanPhyDual
:
public
UanPhy
73
{
74
public
:
75
UanPhyDual
();
76
virtual
~UanPhyDual
();
77
78
static
TypeId
GetTypeId
();
79
80
virtual
void
SetEnergyModelCallback
(
DeviceEnergyModel::ChangeStateCallback
callback);
81
virtual
void
EnergyDepletionHandler
(
void
);
82
virtual
void
SendPacket
(
Ptr<Packet>
pkt, uint32_t modeNum);
83
92
virtual
void
RegisterListener
(
UanPhyListener
*listener);
93
virtual
void
StartRxPacket
(
Ptr<Packet>
pkt,
double
rxPowerDb,
UanTxMode
txMode,
UanPdp
pdp);
94
virtual
void
SetReceiveOkCallback
(
RxOkCallback
cb);
95
virtual
void
SetReceiveErrorCallback
(
RxErrCallback
cb);
96
virtual
void
SetRxGainDb
(
double
gain);
97
virtual
void
SetTxPowerDb
(
double
txpwr);
98
virtual
void
SetRxThresholdDb
(
double
thresh);
99
virtual
void
SetCcaThresholdDb
(
double
thresh);
100
virtual
double
GetRxGainDb
(
void
);
101
virtual
double
GetTxPowerDb
(
void
);
102
virtual
double
GetRxThresholdDb
(
void
);
103
virtual
double
GetCcaThresholdDb
(
void
);
104
virtual
bool
IsStateSleep
(
void
);
105
virtual
bool
IsStateIdle
(
void
);
106
virtual
bool
IsStateBusy
(
void
);
107
virtual
bool
IsStateRx
(
void
);
108
virtual
bool
IsStateTx
(
void
);
109
virtual
bool
IsStateCcaBusy
(
void
);
110
virtual
Ptr<UanChannel>
GetChannel
(
void
)
const
;
111
virtual
Ptr<UanNetDevice>
GetDevice
(
void
);
112
virtual
void
SetChannel
(
Ptr<UanChannel>
channel);
113
virtual
void
SetDevice
(
Ptr<UanNetDevice>
device);
114
virtual
void
SetMac
(
Ptr<UanMac>
mac);
115
virtual
void
NotifyTransStartTx
(
Ptr<Packet>
packet,
double
txPowerDb,
UanTxMode
txMode);
116
virtual
void
NotifyIntChange
(
void
);
117
virtual
void
SetTransducer
(
Ptr<UanTransducer>
trans);
118
virtual
Ptr<UanTransducer>
GetTransducer
(
void
);
119
virtual
uint32_t
GetNModes
(
void
);
120
virtual
UanTxMode
GetMode
(uint32_t n);
121
virtual
void
Clear
(
void
);
122
126
bool
IsPhy1Idle
(
void
);
130
bool
IsPhy2Idle
(
void
);
134
bool
IsPhy1Rx
(
void
);
138
bool
IsPhy2Rx
(
void
);
142
bool
IsPhy1Tx
(
void
);
146
bool
IsPhy2Tx
(
void
);
147
148
// Attribute getters and setters
152
double
GetCcaThresholdPhy1
(
void
)
const
;
156
double
GetCcaThresholdPhy2
(
void
)
const
;
160
void
SetCcaThresholdPhy1
(
double
thresh);
164
void
SetCcaThresholdPhy2
(
double
thresh);
165
169
double
GetTxPowerDbPhy1
(
void
)
const
;
173
double
GetTxPowerDbPhy2
(
void
)
const
;
177
void
SetTxPowerDbPhy1
(
double
);
181
void
SetTxPowerDbPhy2
(
double
);
182
186
double
GetRxGainDbPhy1
(
void
)
const
;
190
double
GetRxGainDbPhy2
(
void
)
const
;
194
void
SetRxGainDbPhy1
(
double
gain);
198
void
SetRxGainDbPhy2
(
double
gain);
199
203
UanModesList
GetModesPhy1
(
void
)
const
;
207
UanModesList
GetModesPhy2
(
void
)
const
;
211
void
SetModesPhy1
(
UanModesList
modes);
215
void
SetModesPhy2
(
UanModesList
modes);
216
220
Ptr<UanPhyPer>
GetPerModelPhy1
(
void
)
const
;
224
Ptr<UanPhyPer>
GetPerModelPhy2
(
void
)
const
;
228
void
SetPerModelPhy1
(
Ptr<UanPhyPer>
per);
232
void
SetPerModelPhy2
(
Ptr<UanPhyPer>
per);
233
237
Ptr<UanPhyCalcSinr>
GetSinrModelPhy1
(
void
)
const
;
241
Ptr<UanPhyCalcSinr>
GetSinrModelPhy2
(
void
)
const
;
245
void
SetSinrModelPhy1
(
Ptr<UanPhyCalcSinr>
calcSinr);
249
void
SetSinrModelPhy2
(
Ptr<UanPhyCalcSinr>
calcSinr);
250
251
virtual
void
SetSleepMode
(
bool
sleep)
252
{
253
//TODO This method has to be implemented
254
}
255
259
Ptr<Packet>
GetPhy1PacketRx
(
void
)
const
;
263
Ptr<Packet>
GetPhy2PacketRx
(
void
)
const
;
267
Ptr<Packet>
GetPacketRx
(
void
)
const
;
268
277
int64_t
AssignStreams
(int64_t stream);
278
279
private
:
280
Ptr<UanPhy>
m_phy1
;
281
Ptr<UanPhy>
m_phy2
;
282
TracedCallback<Ptr<const Packet>
, double,
UanTxMode
>
m_rxOkLogger
;
283
TracedCallback<Ptr<const Packet>
, double,
UanTxMode
>
m_rxErrLogger
;
284
TracedCallback<Ptr<const Packet>
, double,
UanTxMode
>
m_txLogger
;
285
RxOkCallback
m_recOkCb
;
286
RxErrCallback
m_recErrCb
;
287
288
289
void
RxOkFromSubPhy
(
Ptr<Packet>
pkt,
double
sinr,
UanTxMode
mode);
290
void
RxErrFromSubPhy
(
Ptr<Packet>
pkt,
double
sinr);
291
protected
:
292
virtual
void
DoDispose
();
293
};
294
295
}
296
297
#endif
/* UAN_PHY_DUAL_H */
src
uan
model
uan-phy-dual.h
Generated on Tue May 14 2013 11:08:34 for ns-3 by
1.8.1.2