From 5c44a7ea014ad64f95d22176543445740ebc3cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 15 Nov 2022 21:27:45 +0100 Subject: [PATCH] wifi: Use spectrum PHY interface for TX --- src/wifi/model/spectrum-wifi-phy.cc | 6 ++---- src/wifi/model/spectrum-wifi-phy.h | 2 +- src/wifi/model/wifi-spectrum-phy-interface.cc | 8 ++++++++ src/wifi/model/wifi-spectrum-phy-interface.h | 7 +++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index b9c7ec52e..ff7a0bb6e 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -426,7 +426,7 @@ SpectrumWifiPhy::GetRxPpduFromTxPpdu(Ptr ppdu) return GetPhyEntityForPpdu(ppdu)->GetRxPpduFromTxPpdu(ppdu); } -Ptr +Ptr SpectrumWifiPhy::GetAntenna() const { return m_antenna; @@ -460,9 +460,7 @@ void SpectrumWifiPhy::Transmit(Ptr txParams) { NS_LOG_FUNCTION(this << txParams); - txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject(); - txParams->txAntenna = m_antenna; - m_channel->StartTx(txParams); + m_wifiSpectrumPhyInterface->StartTx(txParams); } uint32_t diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 60e14d747..343e8bd41 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -107,7 +107,7 @@ class SpectrumWifiPhy : public WifiPhy * * \return the AntennaModel used for reception */ - Ptr GetAntenna() const; + Ptr GetAntenna() const; /** * \return the SpectrumModel that this SpectrumPhy expects to be used * for all SpectrumValues that are passed to StartRx. If 0 is diff --git a/src/wifi/model/wifi-spectrum-phy-interface.cc b/src/wifi/model/wifi-spectrum-phy-interface.cc index 46c2727cc..aa3f86be6 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.cc +++ b/src/wifi/model/wifi-spectrum-phy-interface.cc @@ -110,4 +110,12 @@ WifiSpectrumPhyInterface::StartRx(Ptr params) m_spectrumWifiPhy->StartRx(params); } +void +WifiSpectrumPhyInterface::StartTx(Ptr params) +{ + params->txPhy = Ptr(this); + params->txAntenna = m_spectrumWifiPhy->GetAntenna(); + m_channel->StartTx(params); +} + } // namespace ns3 diff --git a/src/wifi/model/wifi-spectrum-phy-interface.h b/src/wifi/model/wifi-spectrum-phy-interface.h index 9ff2596da..f2db0b677 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.h +++ b/src/wifi/model/wifi-spectrum-phy-interface.h @@ -62,6 +62,13 @@ class WifiSpectrumPhyInterface : public SpectrumPhy Ptr GetAntenna() const override; void StartRx(Ptr params) override; + /** + * Start transmission over the spectrum channel + * + * \param params the parameters of the signal to transmit + */ + void StartTx(Ptr params); + private: void DoDispose() override;