A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
uan-transducer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Leonard Tracy <lentracy@gmail.com>
18  */
19 
20 #ifndef UAN_TRANSDUCER_H
21 #define UAN_TRANSDUCER_H
22 
23 #include "uan-prop-model.h"
24 #include "uan-tx-mode.h"
25 
26 #include "ns3/object.h"
27 #include "ns3/packet.h"
28 
29 #include <list>
30 
31 namespace ns3
32 {
33 
34 class UanPhy;
35 class UanChannel;
36 
43 {
44  public:
47  {
48  }
49 
60  double rxPowerDb,
61  UanTxMode txMode,
62  UanPdp pdp,
63  Time arrTime)
64  : m_packet(packet),
65  m_rxPowerDb(rxPowerDb),
66  m_txMode(txMode),
67  m_pdp(pdp),
68  m_arrTime(arrTime)
69  {
70  }
71 
74  {
75  m_packet = nullptr;
76  }
77 
83  inline Ptr<Packet> GetPacket() const
84  {
85  return m_packet;
86  }
87 
93  inline double GetRxPowerDb() const
94  {
95  return m_rxPowerDb;
96  }
97 
103  inline const UanTxMode& GetTxMode() const
104  {
105  return m_txMode;
106  }
107 
113  inline Time GetArrivalTime() const
114  {
115  return m_arrTime;
116  }
117 
123  inline UanPdp GetPdp() const
124  {
125  return m_pdp;
126  }
127 
128  private:
130  double m_rxPowerDb;
134 
135 }; // class UanPacketArrival
136 
146 class UanTransducer : public Object
147 {
148  public:
153  static TypeId GetTypeId();
154 
156  enum State
157  {
158  TX,
159  RX
160  };
161 
163  typedef std::list<UanPacketArrival> ArrivalList;
165  typedef std::list<Ptr<UanPhy>> UanPhyList;
166 
172  virtual State GetState() const = 0;
173 
180  virtual bool IsRx() const = 0;
186  virtual bool IsTx() const = 0;
192  virtual const ArrivalList& GetArrivalList() const = 0;
198  virtual void SetRxGainDb(double gainDb) = 0;
204  virtual double GetRxGainDb() = 0;
212  virtual double ApplyRxGainDb(double rxPowerDb, UanTxMode mode) = 0;
221  virtual void Receive(Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
230  virtual void Transmit(Ptr<UanPhy> src,
231  Ptr<Packet> packet,
232  double txPowerDb,
233  UanTxMode txMode) = 0;
239  virtual void SetChannel(Ptr<UanChannel> chan) = 0;
245  virtual Ptr<UanChannel> GetChannel() const = 0;
253  virtual void AddPhy(Ptr<UanPhy> phy) = 0;
259  virtual const UanPhyList& GetPhyList() const = 0;
263  virtual void Clear() = 0;
264 
265 }; // class UanTransducer
266 
267 } // namespace ns3
268 
269 #endif /* UAN_TRANSDUCER_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Class consisting of packet arrival information (Time, RxPower, mode, PDP).
Ptr< Packet > m_packet
The arrived packet.
UanPdp m_pdp
The propagation delay profile.
Time GetArrivalTime() const
Get the packet arrival time.
double m_rxPowerDb
The received power, in dB.
double GetRxPowerDb() const
Get the received signal strength.
UanPacketArrival(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
Constructor.
UanPdp GetPdp() const
Get the propagation delay profile.
~UanPacketArrival()
Destructor.
Time m_arrTime
The arrival time.
UanTxMode m_txMode
The transmission mode.
Ptr< Packet > GetPacket() const
Get the arriving packet.
const UanTxMode & GetTxMode() const
Get the transmission mode of the packet.
UanPacketArrival()
Default constructor.
The power delay profile returned by propagation models.
Virtual base for Transducer objects.
State
Transducer state.
@ TX
Transmitting.
virtual bool IsRx() const =0
Is the state receiving (or available for reception)?
virtual void AddPhy(Ptr< UanPhy > phy)=0
Attach a physical network layer above this transducer.
virtual double ApplyRxGainDb(double rxPowerDb, UanTxMode mode)=0
Apply receiver gain in dB to the received power.
std::list< Ptr< UanPhy > > UanPhyList
List of UanPhy objects.
virtual Ptr< UanChannel > GetChannel() const =0
Get the attached channel.
virtual double GetRxGainDb()=0
Get the receiver gain added to signal at receiver in dB.
virtual bool IsTx() const =0
Is the state transmitting?
virtual const ArrivalList & GetArrivalList() const =0
Get the list of overlapped (in time) packets at this transducer.
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
virtual void Receive(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)=0
Notify this object that a new packet has arrived at this nodes location.
virtual const UanPhyList & GetPhyList() const =0
Get the list of physical layer above this transducer.
virtual void Transmit(Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
Transmit a packet from this transducer.
virtual void Clear()=0
Clears all pointer references.
virtual void SetChannel(Ptr< UanChannel > chan)=0
Attach this transducer to a channel.
virtual void SetRxGainDb(double gainDb)=0
Set the receiver gain.
static TypeId GetTypeId()
Register this type.
virtual State GetState() const =0
Get the transducer state.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:89