diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index a85fb9409..1f00eee07 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -227,7 +227,7 @@ SpectrumWifiPhy::AddChannel(const Ptr channel, const FrequencyR "Added a wifi spectrum channel that overlaps with another existing wifi " "spectrum channel"); - auto wifiSpectrumPhyInterface = CreateObject(); + auto wifiSpectrumPhyInterface = CreateObject(freqRange); wifiSpectrumPhyInterface->SetSpectrumWifiPhy(this); wifiSpectrumPhyInterface->SetChannel(channel); if (GetDevice()) diff --git a/src/wifi/model/wifi-spectrum-phy-interface.cc b/src/wifi/model/wifi-spectrum-phy-interface.cc index 10a313ad2..c38e6659f 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.cc +++ b/src/wifi/model/wifi-spectrum-phy-interface.cc @@ -19,8 +19,6 @@ #include "wifi-spectrum-phy-interface.h" -#include "spectrum-wifi-phy.h" - #include "ns3/log.h" #include "ns3/mobility-model.h" #include "ns3/net-device.h" @@ -42,9 +40,10 @@ WifiSpectrumPhyInterface::GetTypeId() return tid; } -WifiSpectrumPhyInterface::WifiSpectrumPhyInterface() +WifiSpectrumPhyInterface::WifiSpectrumPhyInterface(FrequencyRange range) + : m_range{range} { - NS_LOG_FUNCTION(this); + NS_LOG_FUNCTION(this << range); } void @@ -120,6 +119,12 @@ WifiSpectrumPhyInterface::GetAntenna() const return m_spectrumWifiPhy->GetAntenna(); } +const FrequencyRange& +WifiSpectrumPhyInterface::GetFrequencyRange() const +{ + return m_range; +} + void WifiSpectrumPhyInterface::StartRx(Ptr params) { diff --git a/src/wifi/model/wifi-spectrum-phy-interface.h b/src/wifi/model/wifi-spectrum-phy-interface.h index 566b9242e..5fd51fe1c 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.h +++ b/src/wifi/model/wifi-spectrum-phy-interface.h @@ -20,6 +20,8 @@ #ifndef WIFI_SPECTRUM_PHY_INTERFACE_H #define WIFI_SPECTRUM_PHY_INTERFACE_H +#include "spectrum-wifi-phy.h" + #include "ns3/spectrum-phy.h" namespace ns3 @@ -46,7 +48,12 @@ class WifiSpectrumPhyInterface : public SpectrumPhy * \return the object TypeId */ static TypeId GetTypeId(); - WifiSpectrumPhyInterface(); + /** + * Constructor + * + * \param range the frequency range covered by the interface + */ + WifiSpectrumPhyInterface(FrequencyRange range); /** * Connect SpectrumWifiPhy object * \param phy SpectrumWifiPhy object to be connected to this object @@ -69,6 +76,13 @@ class WifiSpectrumPhyInterface : public SpectrumPhy */ Ptr GetChannel() const; + /** + * Get the frequency range covered by the spectrum channel this interface is attached to + * + * \return the frequency range covered by the spectrum channel this interface is attached to + */ + const FrequencyRange& GetFrequencyRange() const; + /** * Start transmission over the spectrum channel * @@ -86,6 +100,7 @@ class WifiSpectrumPhyInterface : public SpectrumPhy private: void DoDispose() override; + FrequencyRange m_range; ///< frequency range Ptr m_spectrumWifiPhy; ///< spectrum PHY Ptr m_netDevice; ///< the device Ptr m_channel; ///< spectrum channel