A Discrete-Event Network Simulator
API
uan-transducer.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  */
20 
21 #ifndef UAN_TRANSDUCER_H
22 #define UAN_TRANSDUCER_H
23 
24 #include "ns3/object.h"
25 #include "ns3/packet.h"
26 #include "uan-tx-mode.h"
27 #include "ns3/uan-prop-model.h"
28 
29 #include <list>
30 
31 namespace ns3 {
32 
33 class UanPhy;
34 class UanChannel;
35 
36 
43 {
44 public:
45 
48  {
49  }
50 
60  UanPacketArrival (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
61  : m_packet (packet),
62  m_rxPowerDb (rxPowerDb),
63  m_txMode (txMode),
64  m_pdp (pdp),
65  m_arrTime (arrTime)
66  {
67  }
68 
71  {
72  m_packet = 0;
73  }
74 
80  inline Ptr<Packet> GetPacket (void) const
81  {
82  return m_packet;
83  }
89  inline double GetRxPowerDb (void) const
90  {
91  return m_rxPowerDb;
92  }
98  inline const UanTxMode &GetTxMode (void) const
99  {
100  return m_txMode;
101  }
107  inline Time GetArrivalTime (void) const
108  {
109  return m_arrTime;
110  }
116  inline UanPdp GetPdp (void) const
117  {
118  return m_pdp;
119  }
120 private:
122  double m_rxPowerDb;
126 
127 }; // class UanPacketArrival
128 
138 class UanTransducer : public Object
139 {
140 public:
145  static TypeId GetTypeId (void);
146 
148  enum State {
149  TX,
150  RX
151  };
152 
154  typedef std::list<UanPacketArrival> ArrivalList;
156  typedef std::list<Ptr<UanPhy> > UanPhyList;
157 
163  virtual State GetState (void) const = 0;
164 
171  virtual bool IsRx (void) const = 0;
177  virtual bool IsTx (void) const = 0;
183  virtual const ArrivalList &GetArrivalList (void) const = 0;
189  virtual void SetRxGainDb (double gainDb) = 0;
195  virtual double GetRxGainDb (void) = 0;
203  virtual double ApplyRxGainDb (double rxPowerDb, UanTxMode mode) = 0;
212  virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
221  virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) = 0;
227  virtual void SetChannel (Ptr<UanChannel> chan) = 0;
233  virtual Ptr<UanChannel> GetChannel (void) const = 0;
241  virtual void AddPhy (Ptr<UanPhy> phy) = 0;
247  virtual const UanPhyList &GetPhyList (void) const = 0;
251  virtual void Clear (void) = 0;
252 
253 }; // class UanTransducer
254 
255 } // namespace ns3
256 
257 #endif /* UAN_TRANSDUCER_H */
A base class which provides memory management and object aggregation.
Definition: object.h:88
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Class consisting of packet arrival information (Time, RxPower, mode, PDP).
Time GetArrivalTime(void) const
Get the packet arrival time.
Ptr< Packet > m_packet
The arrived packet.
UanPdp m_pdp
The propagation delay profile.
double GetRxPowerDb(void) const
Get the received signal strength.
const UanTxMode & GetTxMode(void) const
Get the transmission mode of the packet.
Ptr< Packet > GetPacket(void) const
Get the arriving packet.
double m_rxPowerDb
The received power, in dB.
UanPacketArrival(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
Constructor.
~UanPacketArrival()
Destructor.
Time m_arrTime
The arrival time.
UanTxMode m_txMode
The transmission mode.
UanPacketArrival()
Default constructor.
UanPdp GetPdp(void) const
Get the propagation delay profile.
The power delay profile returned by propagation models.
Virtual base for Transducer objects.
virtual bool IsTx(void) const =0
Is the state transmitting?
State
Transducer state.
@ TX
Transmitting.
virtual double GetRxGainDb(void)=0
Get the receiver gain added to signal at receiver in dB.
virtual bool IsRx(void) const =0
Is the state receiving (or available for reception)?
virtual const UanPhyList & GetPhyList(void) const =0
Get the list of physical layer above this transducer.
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.
static TypeId GetTypeId(void)
Register this type.
virtual State GetState(void) const =0
Get the transducer state.
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 void Transmit(Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
Transmit a packet from this transducer.
virtual const ArrivalList & GetArrivalList(void) const =0
Get the list of overlapped (in time) packets at this transducer.
virtual void SetChannel(Ptr< UanChannel > chan)=0
Attach this transducer to a channel.
virtual Ptr< UanChannel > GetChannel(void) const =0
Get the attached channel.
virtual void SetRxGainDb(double gainDb)=0
Set the receiver gain.
virtual void Clear(void)=0
Clears all pointer references.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93