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/log.h"
22 #include "ns3/spectrum-value.h"
23 #include "ns3/mobility-model.h"
24 #include "ns3/net-device.h"
26 #include "spectrum-wifi-phy.h"
27 
28 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPhyInterface");
29 
30 namespace ns3 {
31 
32 NS_OBJECT_ENSURE_REGISTERED (WifiSpectrumPhyInterface);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId ("ns3::WifiSpectrumPhyInterface")
39  .SetGroupName ("Wifi");
40  return tid;
41 }
42 
44 {
45  NS_LOG_FUNCTION (this);
46 }
47 
48 void
50 {
51  NS_LOG_FUNCTION (this);
53  m_netDevice = 0;
54  m_channel = 0;
55 }
56 
58 {
59  m_spectrumWifiPhy = spectrumWifiPhy;
60 }
61 
64 {
65  return m_netDevice;
66 }
67 
70 {
71  return m_spectrumWifiPhy->GetMobility ();
72 }
73 
74 void
76 {
77  m_netDevice = d;
78 }
79 
80 void
82 {
84 }
85 
86 void
88 {
89  NS_LOG_FUNCTION (this << c);
90  m_channel = c;
91 }
92 
95 {
97 }
98 
101 {
102  NS_LOG_FUNCTION (this);
103  return m_spectrumWifiPhy->GetRxAntenna ();
104 }
105 
106 void
108 {
109  m_spectrumWifiPhy->StartRx (params);
110 }
111 
112 } //namespace ns3
void SetDevice(const Ptr< NetDevice > d)
Set the associated NetDevice instance.
#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
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level Phy interface to this Sp...
void SetSpectrumWifiPhy(const Ptr< SpectrumWifiPhy > phy)
Connect SpectrumWifiPhy object.
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
Ptr< SpectrumChannel > m_channel
spectrum channel
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:662
static TypeId GetTypeId(void)
Get the type ID.
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< NetDevice > m_netDevice
the device
Ptr< MobilityModel > GetMobility()
Get the associated MobilityModel instance.
virtual void DoDispose(void)
Destructor implementation.
void SetChannel(const Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:668
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< AntennaModel > GetRxAntenna()
Get the AntennaModel used by the NetDevice for reception.
Ptr< AntennaModel > GetRxAntenna(void) const
Get the antenna model used for reception.
Ptr< SpectrumWifiPhy > m_spectrumWifiPhy
spectrum phy
void SetMobility(const Ptr< MobilityModel > m)
Set the mobility model associated with this device.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915