wifi: Hold frequency range in spectrum PHY interface

This commit is contained in:
Sébastien Deronne
2023-01-24 22:17:37 +01:00
committed by Sebastien Deronne
parent 2df30d6838
commit c219b17016
3 changed files with 26 additions and 6 deletions

View File

@@ -227,7 +227,7 @@ SpectrumWifiPhy::AddChannel(const Ptr<SpectrumChannel> channel, const FrequencyR
"Added a wifi spectrum channel that overlaps with another existing wifi "
"spectrum channel");
auto wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface>();
auto wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface>(freqRange);
wifiSpectrumPhyInterface->SetSpectrumWifiPhy(this);
wifiSpectrumPhyInterface->SetChannel(channel);
if (GetDevice())

View File

@@ -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<SpectrumSignalParameters> params)
{

View File

@@ -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<SpectrumChannel> 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<SpectrumWifiPhy> m_spectrumWifiPhy; ///< spectrum PHY
Ptr<NetDevice> m_netDevice; ///< the device
Ptr<SpectrumChannel> m_channel; ///< spectrum channel