A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
half-duplex-ideal-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef HALF_DUPLEX_IDEAL_PHY_H
22 #define HALF_DUPLEX_IDEAL_PHY_H
23 
24 
25 #include <ns3/spectrum-value.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/packet.h>
28 #include <ns3/nstime.h>
29 #include <ns3/net-device.h>
30 #include <ns3/spectrum-phy.h>
31 #include <ns3/spectrum-channel.h>
32 #include <ns3/spectrum-interference.h>
33 #include <ns3/data-rate.h>
34 #include <ns3/generic-phy.h>
35 #include <ns3/event-id.h>
36 #include <ns3/spectrum-signal-parameters.h>
37 
38 namespace ns3 {
39 
79 {
80 
81 public:
83  virtual ~HalfDuplexIdealPhy ();
84 
89  enum State
90  {
92  };
93 
94  static TypeId GetTypeId (void);
95 
96  // inherited from SpectrumPhy
99  void SetDevice (Ptr<NetDevice> d);
105 
106 
114 
121 
122 
132  bool StartTx (Ptr<Packet> p);
133 
139  void SetRate (DataRate rate);
140 
145  DataRate GetRate () const;
146 
154 
162 
170 
178 
184  void SetAntenna (Ptr<AntennaModel> a);
185 
186 private:
187  virtual void DoDispose (void);
188 
189  void ChangeState (State newState);
190  void EndTx ();
191  void AbortRx ();
192  void EndRx ();
193 
195 
200 
205 
207 
209 
216 
221 
223 
224 };
225 
226 
227 
228 
229 
230 
231 }
232 
233 
234 
235 
236 
237 #endif /* HALF_DUPLEX_IDEAL_PHY_H */
void SetRate(DataRate rate)
set the PHY rate to be used by this PHY.
void SetGenericPhyTxEndCallback(GenericPhyTxEndCallback c)
set the callback for the end of a TX, as part of the interconnections betweenthe PHY and the MAC ...
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
Ptr< MobilityModel > m_mobility
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
bool StartTx(Ptr< Packet > p)
Start a transmission.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
void SetGenericPhyRxStartCallback(GenericPhyRxStartCallback c)
set the callback for the start of RX, as part of the interconnections betweenthe PHY and the MAC ...
SpectrumInterference m_interference
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback
Ptr< MobilityModel > GetMobility()
get the associated MobilityModel instance
Ptr< const SpectrumValue > m_rxPsd
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
TracedCallback< Ptr< const Packet > > m_phyRxStartTrace
TracedCallback< Ptr< const Packet > > m_phyRxAbortTrace
Class for representing data rates.
Definition: data-rate.h:71
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
void SetDevice(Ptr< NetDevice > d)
set the associated NetDevice instance
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
Ptr< SpectrumValue > m_txPsd
void SetGenericPhyRxEndOkCallback(GenericPhyRxEndOkCallback c)
set the callback for the successful end of a RX, as part of the interconnections betweenthe PHY and t...
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Ptr< AntennaModel > GetRxAntenna()
get the AntennaModel used by the NetDevice for reception
Ptr< SpectrumChannel > m_channel
This PHY layer implementation realizes an ideal OFDM PHY which transmits half-duplex (i...
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Ptr< NetDevice > GetDevice()
get the associated NetDevice instance
void ChangeState(State newState)
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
void SetGenericPhyRxEndErrorCallback(GenericPhyRxEndErrorCallback c)
set the callback for the end of a RX in error, as part of the interconnections betweenthe PHY and the...
Ptr< AntennaModel > m_antenna
an identifier for simulation events.
Definition: event-id.h:46
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
GenericPhyRxStartCallback m_phyMacRxStartCallback
static TypeId GetTypeId(void)
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
GenericPhyTxEndCallback m_phyMacTxEndCallback
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
set the Power Spectral Density of outgoing signals in power units (Watt, Pascal...) per Hz.
a unique identifier for an interface.
Definition: type-id.h:49
Ptr< const SpectrumModel > GetRxSpectrumModel() const