Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(222)

Side by Side Diff: src/devices/uan/uan-transducer.h

Issue 1350041: UAN module addition
Patch Set: Created 13 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 #ifndef UANTRANSDUCER_H_
21 #define UANTRANSDUCER_H_
22
23 #include "ns3/object.h"
24 #include "ns3/packet.h"
25 #include "uan-tx-mode.h"
26 #include "ns3/uan-prop-model.h"
27 // #include "uan-channel.h"
28 // #include "uan-phy.h"
Josh Pelkey 2010/06/08 19:24:26 remove
29
30 #include <list>
31 namespace ns3 {
32
33 class UanPhy;
34 class UanChannel;
35
36
37 /**
38 * \class UanPacketArrival
39 *
40 * \brief Class consisting of packet arrival information (Time, RxPower, mode, P DP)
41 */
42 class UanPacketArrival
43 {
44 public:
45 UanPacketArrival (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanP dp pdp, Time arrTime)
46 : m_packet (packet),
47 m_rxPowerDb (rxPowerDb),
48 m_txMode (txMode),
49 m_pdp (pdp),
50 m_arrTime (arrTime)
51 {
52 }
53
54 ~UanPacketArrival()
55 {
56 m_packet = 0;
57 }
58
59 /**
60 * \returns Pointer to packet that arrived
61 */
62 inline Ptr<Packet> GetPacket (void) const
63 {
64 return m_packet;
65 }
66 /**
67 * \returns Received signal strength in dB re 1uPa
68 */
69 inline double GetRxPowerDb (void) const
70 {
71 return m_rxPowerDb;
72 }
73 /**
74 * \returns UanTxMode used to transmit packet
75 */
76 inline const UanTxMode &GetTxMode (void) const
77 {
78 return m_txMode;
79 }
80 /**
81 * \returns Arrival time of packet
82 */
83 inline Time GetArrivalTime (void) const
84 {
85 return m_arrTime;
86 }
87 /**
88 * \returns PDP of arriving signal
89 */
90 inline UanPdp GetPdp (void) const
91 {
92 return m_pdp;
93 }
94 private:
95 Ptr<Packet> m_packet;
96 double m_rxPowerDb;
97 UanTxMode m_txMode;
98 UanPdp m_pdp;
99 Time m_arrTime;
100 };
101
102 /**
103 * \class UanTransducer
104 * \brief Virtual base for Transducer objects
105 *
106 * The Transducer was added to support classes such as UanPhyDual.
107 * In a generic Phy setting, this class functions to hold information about all
108 * possibly interfering packets.
109 */
110 class UanTransducer : public ns3::Object
111 {
112 public:
113 enum State {
114 TX, RX
115 };
116
117 typedef std::list<UanPacketArrival> ArrivalList;
118 typedef std::list<Ptr<UanPhy> > UanPhyList;
119
120 /**
121 * \returns State (TX or RX) of this transducer
122 */
123 virtual State GetState (void) const = 0;
124
125 /**
126 * \returns True if this transducer is available for receiving an incoming pac ket.
127 */
128 virtual bool IsRx (void) const = 0;
129 /**
130 * \returns True if there is a packet being transmitted from this transducer.
131 */
132 virtual bool IsTx (void) const = 0;
133 /**
134 * \returns List of all packets currently crossing this node in the water.
135 */
136 virtual const ArrivalList &GetArrivalList (void) const = 0;
137 /**
138 * \brief Receive Notify this object that a new packet has arrived at this nod es location
139 * \param packet Packet arriving
140 * \param rxPowerDb Signal power in dB of arriving packet
141 * \param txMode Mode arriving packet is using
142 * \param pdp PDP of arriving signal
143 */
144 virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
145 /**
146 * \brief Transmit a packet from this transducer
147 * \param src Source PHY
148 * \param packet Packet to transmit
149 * \param txPowerDb Outgoing Tx power of packet
150 * \param txMode Mode to transmit packet with.
151 */
152 virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) = 0;
153 /**
154 * \param chan Channel this transducer is attached to
155 */
156 virtual void SetChannel (Ptr<UanChannel> chan) = 0;
157 /**
158 * \returns Channel this transducer is attached to
159 */
160 virtual Ptr<UanChannel> GetChannel (void) const = 0;
161 /**
162 * \param phy Add phy above this transducer (may connect > 1 Phy to a transduc er)
163 */
164 virtual void AddPhy (Ptr<UanPhy> phy) = 0;
165 /**
166 * \returns List of all Phy's this transducer sends packets to.
167 */
168 virtual const UanPhyList &GetPhyList (void) const = 0;
169 };
170
171 } // namespace ns3
172
173 #endif /*UANTRANSDUCER_H_*/
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b