A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
waveform-generator.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 WAVEFORM_GENERATOR_H
22 #define WAVEFORM_GENERATOR_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/trace-source-accessor.h>
33 
34 namespace ns3 {
35 
36 
37 class AntennaModel;
38 
53 {
54 
55 public:
57  virtual ~WaveformGenerator ();
58 
59  static TypeId GetTypeId (void);
60 
61  // inherited from SpectrumPhy
64  void SetDevice (Ptr<NetDevice> d);
70 
71 
78 
85  void SetPeriod (Time period);
86 
87 
93  Time GetPeriod () const;
94 
95 
100  void SetDutyCycle (double value);
101 
106  double GetDutyCycle () const;
107 
113  void SetAntenna (Ptr<AntennaModel> a);
114 
119  virtual void Start ();
120 
125  virtual void Stop ();
126 
127 
128 private:
129  virtual void DoDispose (void);
130 
135 
136  virtual void GenerateWaveform ();
137 
140  double m_dutyCycle;
142  bool m_active;
143 
146 };
147 
148 
149 
150 
151 
152 
153 } // namespace ns3
154 
155 
156 
157 
158 
159 #endif /* WAVEFORM_GENERATOR_H */
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
void SetDevice(Ptr< NetDevice > d)
set the associated NetDevice instance
Ptr< AntennaModel > m_antenna
Ptr< MobilityModel > m_mobility
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
Ptr< SpectrumValue > m_txPowerSpectralDensity
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txs)
Set the Power Spectral Density used for outgoing waveforms.
void SetDutyCycle(double value)
virtual void Start()
Start the waveform generator.
Simple SpectrumPhy implementation that sends customizable waveform.
Ptr< AntennaModel > GetRxAntenna()
get the AntennaModel used by the NetDevice for reception
static TypeId GetTypeId(void)
void SetPeriod(Time period)
Set the period according to which the WaveformGenerator switches on and off.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
virtual void Stop()
Stop the waveform generator.
Ptr< MobilityModel > GetMobility()
get the associated MobilityModel instance
Ptr< SpectrumChannel > m_channel
Ptr< NetDevice > m_netDevice
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
Ptr< NetDevice > GetDevice()
get the associated NetDevice instance
a unique identifier for an interface.
Definition: type-id.h:49
Ptr< const SpectrumModel > GetRxSpectrumModel() const