From 1be4f3ae273b16d8fbca5fb9c17f07298df3d250 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 10 Nov 2021 11:00:30 +0100 Subject: [PATCH] wifi: NetDevice pointed to by WifiPhy is a WifiNetDevice --- src/wifi/helper/spectrum-wifi-helper.cc | 3 ++- src/wifi/helper/spectrum-wifi-helper.h | 2 +- src/wifi/helper/wifi-helper.h | 6 +----- src/wifi/helper/yans-wifi-helper.cc | 3 ++- src/wifi/helper/yans-wifi-helper.h | 2 +- src/wifi/model/wifi-phy.cc | 5 +++-- src/wifi/model/wifi-phy.h | 8 ++++---- src/wifi/model/yans-wifi-channel.cc | 4 ++-- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/wifi/helper/spectrum-wifi-helper.cc b/src/wifi/helper/spectrum-wifi-helper.cc index 238d46011..c881331e9 100644 --- a/src/wifi/helper/spectrum-wifi-helper.cc +++ b/src/wifi/helper/spectrum-wifi-helper.cc @@ -26,6 +26,7 @@ #include "ns3/frame-capture-model.h" #include "ns3/preamble-detection-model.h" #include "ns3/mobility-model.h" +#include "ns3/wifi-net-device.h" #include "spectrum-wifi-helper.h" namespace ns3 { @@ -53,7 +54,7 @@ SpectrumWifiPhyHelper::SetChannel (std::string channelName) } Ptr -SpectrumWifiPhyHelper::Create (Ptr node, Ptr device) const +SpectrumWifiPhyHelper::Create (Ptr node, Ptr device) const { Ptr phy = m_phy.Create (); phy->CreateWifiSpectrumPhyInterface (device); diff --git a/src/wifi/helper/spectrum-wifi-helper.h b/src/wifi/helper/spectrum-wifi-helper.h index 537f43faa..b1b7d105a 100644 --- a/src/wifi/helper/spectrum-wifi-helper.h +++ b/src/wifi/helper/spectrum-wifi-helper.h @@ -63,7 +63,7 @@ private: * * This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper. */ - Ptr Create (Ptr node, Ptr device) const override; + Ptr Create (Ptr node, Ptr device) const override; Ptr m_channel; ///< the channel }; diff --git a/src/wifi/helper/wifi-helper.h b/src/wifi/helper/wifi-helper.h index 9166353fa..f4bfcd11e 100644 --- a/src/wifi/helper/wifi-helper.h +++ b/src/wifi/helper/wifi-helper.h @@ -58,12 +58,8 @@ public: * * Subclasses must implement this method to allow the ns3::WifiHelper class * to create PHY objects from ns3::WifiHelper::Install. - * - * Typically the device type will be of class WifiNetDevice but the - * type of the pointer is generalized so that this method may be used - * by other Wifi device variants such as WaveNetDevice. */ - virtual Ptr Create (Ptr node, Ptr device) const = 0; + virtual Ptr Create (Ptr node, Ptr device) const = 0; /** * \param name the name of the attribute to set diff --git a/src/wifi/helper/yans-wifi-helper.cc b/src/wifi/helper/yans-wifi-helper.cc index 921a3b634..7621df218 100644 --- a/src/wifi/helper/yans-wifi-helper.cc +++ b/src/wifi/helper/yans-wifi-helper.cc @@ -27,6 +27,7 @@ #include "ns3/frame-capture-model.h" #include "ns3/preamble-detection-model.h" #include "ns3/yans-wifi-phy.h" +#include "ns3/wifi-net-device.h" #include "yans-wifi-helper.h" namespace ns3 { @@ -144,7 +145,7 @@ YansWifiPhyHelper::SetChannel (std::string channelName) } Ptr -YansWifiPhyHelper::Create (Ptr node, Ptr device) const +YansWifiPhyHelper::Create (Ptr node, Ptr device) const { Ptr phy = m_phy.Create (); Ptr error = m_errorRateModel.Create (); diff --git a/src/wifi/helper/yans-wifi-helper.h b/src/wifi/helper/yans-wifi-helper.h index 3c679ee35..967df1d41 100644 --- a/src/wifi/helper/yans-wifi-helper.h +++ b/src/wifi/helper/yans-wifi-helper.h @@ -186,7 +186,7 @@ private: * * This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper. */ - Ptr Create (Ptr node, Ptr device) const override; + Ptr Create (Ptr node, Ptr device) const override; Ptr m_channel; ///< YANS wifi channel }; diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index b47b5c55a..5b2f6bfc2 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -26,6 +26,7 @@ #include "ns3/mobility-model.h" #include "ns3/random-variable-stream.h" #include "ns3/error-model.h" +#include "wifi-net-device.h" #include "wifi-phy.h" #include "wifi-utils.h" #include "frame-capture-model.h" @@ -768,12 +769,12 @@ WifiPhy::GetShortPhyPreambleSupported (void) const } void -WifiPhy::SetDevice (const Ptr device) +WifiPhy::SetDevice (const Ptr device) { m_device = device; } -Ptr +Ptr WifiPhy::GetDevice (void) const { return m_device; diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 6dba65eb8..22643534f 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -32,7 +32,7 @@ namespace ns3 { class Channel; -class NetDevice; +class WifiNetDevice; class MobilityModel; class WifiPhyStateHelper; class FrameCaptureModel; @@ -823,13 +823,13 @@ public: * * \param device the device this PHY is associated with */ - void SetDevice (const Ptr device); + void SetDevice (const Ptr device); /** * Return the device this PHY is associated with * * \return the device this PHY is associated with */ - Ptr GetDevice (void) const; + Ptr GetDevice (void) const; /** * \brief assign a mobility model to this device * @@ -1420,7 +1420,7 @@ private: Time m_channelSwitchDelay; //!< Time required to switch between channel - Ptr m_device; //!< Pointer to the device + Ptr m_device; //!< Pointer to the device Ptr m_mobility; //!< Pointer to the mobility model Ptr m_frameCaptureModel; //!< Frame capture model diff --git a/src/wifi/model/yans-wifi-channel.cc b/src/wifi/model/yans-wifi-channel.cc index ecb841d41..d45cfa2b3 100644 --- a/src/wifi/model/yans-wifi-channel.cc +++ b/src/wifi/model/yans-wifi-channel.cc @@ -21,7 +21,7 @@ #include "ns3/simulator.h" #include "ns3/log.h" #include "ns3/pointer.h" -#include "ns3/net-device.h" +#include "ns3/wifi-net-device.h" #include "ns3/node.h" #include "ns3/propagation-loss-model.h" #include "ns3/propagation-delay-model.h" @@ -147,7 +147,7 @@ YansWifiChannel::GetNDevices (void) const Ptr YansWifiChannel::GetDevice (std::size_t i) const { - return m_phyList[i]->GetDevice ()->GetObject (); + return m_phyList[i]->GetDevice (); } void