A Discrete-Event Network Simulator
API
wifi-spectrum-phy-interface.cc
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 #include <ns3/ptr.h>
22 #include <ns3/object.h>
23 #include <ns3/net-device.h>
24 #include <ns3/mobility-model.h>
25 #include <ns3/wifi-phy.h>
26 #include <ns3/spectrum-phy.h>
27 #include <ns3/spectrum-signal-parameters.h>
28 #include <ns3/log.h>
29 #include <ns3/spectrum-value.h>
30 #include <ns3/antenna-model.h>
31 
33 #include "spectrum-wifi-phy.h"
34 
35 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPhyInterface");
36 
37 namespace ns3 {
38 
39 NS_OBJECT_ENSURE_REGISTERED (WifiSpectrumPhyInterface);
40 
41 TypeId
43 {
44  static TypeId tid = TypeId ("ns3::WifiSpectrumPhyInterface")
46  .SetGroupName ("Wifi");
47  return tid;
48 }
49 
51 {
52  NS_LOG_FUNCTION (this);
53 }
54 
55 void
57 {
58  NS_LOG_FUNCTION (this);
60  m_netDevice = 0;
61  m_channel = 0;
62 }
63 
65 {
66  m_spectrumWifiPhy = spectrumWifiPhy;
67 }
68 
71 {
72  return m_netDevice;
73 }
74 
77 {
78  return m_spectrumWifiPhy->GetMobility ();
79 }
80 
81 void
83 {
84  m_netDevice = d;
85 }
86 
87 void
89 {
91 }
92 
93 void
95 {
96  NS_LOG_FUNCTION (this << c);
97  m_channel = c;
98 }
99 
102 {
104 }
105 
108 {
109  NS_LOG_FUNCTION (this);
110  return m_spectrumWifiPhy->GetRxAntenna ();
111 }
112 
113 void
115 {
116  m_spectrumWifiPhy->StartRx (params);
117 }
118 
119 
120 } //namespace ns3
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
virtual Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level Phy interface to this Sp...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
virtual void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
virtual Ptr< MobilityModel > GetMobility()
Get the associated MobilityModel instance.
virtual void DoDispose(void)
Destructor implementation.
Ptr< AntennaModel > GetRxAntenna(void) const
Get the antenna model used for reception.
virtual void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetMobility(Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:610
Ptr< MobilityModel > GetMobility(void)
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:616
void SetSpectrumWifiPhy(Ptr< SpectrumWifiPhy > phy)
Connect SpectrumWifiPhy object.
virtual Ptr< AntennaModel > GetRxAntenna()
Get the AntennaModel used by the NetDevice for reception.
virtual void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
virtual void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
virtual Ptr< const SpectrumModel > GetRxSpectrumModel() const
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904