A Discrete-Event Network Simulator
API
spectrum-wifi-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include "spectrum-wifi-helper.h"
23 #include "ns3/spectrum-wifi-phy.h"
24 #include "ns3/names.h"
25 #include "ns3/log.h"
26 
27 namespace ns3 {
28 
29 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiHelper");
30 
32  : m_channel (0)
33 {
34  m_phy.SetTypeId ("ns3::SpectrumWifiPhy");
35 }
36 
39 {
40  SpectrumWifiPhyHelper helper;
41  helper.SetErrorRateModel ("ns3::NistErrorRateModel");
42  return helper;
43 }
44 
45 void
47 {
49 }
50 
51 void
52 SpectrumWifiPhyHelper::SetChannel (std::string channelName)
53 {
54  Ptr<SpectrumChannel> channel = Names::Find<SpectrumChannel> (channelName);
56 }
57 
60 {
62  phy->CreateWifiSpectrumPhyInterface (device);
64  phy->SetErrorRateModel (error);
65  phy->SetChannel (m_channel);
66  phy->SetDevice (device);
67  phy->SetMobility (node->GetObject<MobilityModel> ());
68  return phy;
69 }
70 
71 } //namespace ns3
tuple channel
Definition: third.py:85
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:682
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:167
SpectrumWifiPhyHelper()
Create a phy helper without any parameter set.
the interface for Wifi's error models
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:670
Keep track of the current position and velocity of an object.
tuple phy
Definition: third.py:86
static SpectrumWifiPhyHelper Default(void)
Create a phy helper in a default working state.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetChannel(Ptr< SpectrumChannel > channel)
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:701
Ptr< SpectrumChannel > m_channel
the channel
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:138
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:166
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
Make it easy to create and manage PHY objects for the spectrum model.