wifi: NetDevice pointed to by WifiPhy is a WifiNetDevice

This commit is contained in:
Stefano Avallone
2021-11-10 11:00:30 +01:00
parent 2c66c3bd68
commit 1be4f3ae27
8 changed files with 16 additions and 17 deletions

View File

@@ -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<WifiPhy>
SpectrumWifiPhyHelper::Create (Ptr<Node> node, Ptr<NetDevice> device) const
SpectrumWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
{
Ptr<SpectrumWifiPhy> phy = m_phy.Create<SpectrumWifiPhy> ();
phy->CreateWifiSpectrumPhyInterface (device);

View File

@@ -63,7 +63,7 @@ private:
*
* This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper.
*/
Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const override;
Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const override;
Ptr<SpectrumChannel> m_channel; ///< the channel
};

View File

@@ -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<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const = 0;
virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const = 0;
/**
* \param name the name of the attribute to set

View File

@@ -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<WifiPhy>
YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<NetDevice> device) const
YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
{
Ptr<YansWifiPhy> phy = m_phy.Create<YansWifiPhy> ();
Ptr<ErrorRateModel> error = m_errorRateModel.Create<ErrorRateModel> ();

View File

@@ -186,7 +186,7 @@ private:
*
* This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper.
*/
Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const override;
Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const override;
Ptr<YansWifiChannel> m_channel; ///< YANS wifi channel
};

View File

@@ -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<NetDevice> device)
WifiPhy::SetDevice (const Ptr<WifiNetDevice> device)
{
m_device = device;
}
Ptr<NetDevice>
Ptr<WifiNetDevice>
WifiPhy::GetDevice (void) const
{
return m_device;

View File

@@ -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<NetDevice> device);
void SetDevice (const Ptr<WifiNetDevice> device);
/**
* Return the device this PHY is associated with
*
* \return the device this PHY is associated with
*/
Ptr<NetDevice> GetDevice (void) const;
Ptr<WifiNetDevice> 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<NetDevice> m_device; //!< Pointer to the device
Ptr<WifiNetDevice> m_device; //!< Pointer to the device
Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model
Ptr<FrameCaptureModel> m_frameCaptureModel; //!< Frame capture model

View File

@@ -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<NetDevice>
YansWifiChannel::GetDevice (std::size_t i) const
{
return m_phyList[i]->GetDevice ()->GetObject<NetDevice> ();
return m_phyList[i]->GetDevice ();
}
void