A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
192  virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
201  virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) = 0;
207  virtual void SetChannel (Ptr<UanChannel> chan) = 0;
213  virtual Ptr<UanChannel> GetChannel (void) const = 0;
221  virtual void AddPhy (Ptr<UanPhy> phy) = 0;
227  virtual const UanPhyList &GetPhyList (void) const = 0;
231  virtual void Clear (void) = 0;
232 
233 }; // class UanTransducer
234 
235 } // namespace ns3
236 
237 #endif /* UAN_TRANSDUCER_H */
UanPdp GetPdp(void) const
Get the propagation delay profile.
double m_rxPowerDb
The received power, in dB.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
Time GetArrivalTime(void) const
Get the packet arrival time.
virtual const UanPhyList & GetPhyList(void) const =0
Get the list of physical layer above this transducer.
virtual bool IsRx(void) const =0
Is the state receiving (or available for reception)?
std::list< Ptr< UanPhy > > UanPhyList
List of UanPhy objects.
virtual const ArrivalList & GetArrivalList(void) const =0
Get the list of overlapped (in time) packets at this transducer.
UanPacketArrival(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp, Time arrTime)
Constructor.
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.
~UanPacketArrival()
Destructor.
virtual void AddPhy(Ptr< UanPhy > phy)=0
Attach a physical network layer above this transducer.
virtual State GetState(void) const =0
Get the transducer state.
Ptr< Packet > GetPacket(void) const
Get the arriving packet.
UanTxMode m_txMode
The transmission mode.
virtual void SetChannel(Ptr< UanChannel > chan)=0
Attach this transducer to a channel.
const UanTxMode & GetTxMode(void) const
Get the transmission mode of the packet.
virtual void Clear(void)=0
Clears all pointer references.
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:41
UanPdp m_pdp
The propagation delay profile.
Virtual base for Transducer objects.
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
double GetRxPowerDb(void) const
Get the received signal strength.
UanPacketArrival()
Default constructor.
virtual Ptr< UanChannel > GetChannel(void) const =0
Get the attached channel.
Time m_arrTime
The arrival time.
Ptr< Packet > m_packet
The arrived packet.
virtual bool IsTx(void) const =0
Is the state transmitting?
virtual void Transmit(Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
Transmit a packet from this transducer.
State
Transducer state.
a base class which provides memory management and object aggregation
Definition: object.h:64
a unique identifier for an interface.
Definition: type-id.h:49
Class consisting of packet arrival information (Time, RxPower, mode, PDP).
static TypeId GetTypeId(void)
Register this type.