wifi: Add function to retrieve the latest entity supported by the PHY based on the configured standard

This commit is contained in:
Sébastien Deronne
2022-11-21 20:57:32 +01:00
committed by Sebastien Deronne
parent e09b7db4e7
commit 7bfc04fa6c
5 changed files with 21 additions and 9 deletions

View File

@@ -270,7 +270,7 @@ SpectrumWifiPhy::DoChannelSwitch()
bool
SpectrumWifiPhy::CanStartRx(Ptr<const WifiPpdu> ppdu) const
{
return GetPhyEntity(GetStandard())->CanStartRx(ppdu);
return GetLatestPhyEntity()->CanStartRx(ppdu);
}
void

View File

@@ -713,6 +713,12 @@ WifiPhy::GetPhyEntity(WifiStandard standard) const
return GetPhyEntity(GetModulationClassForStandard(standard));
}
Ptr<PhyEntity>
WifiPhy::GetLatestPhyEntity() const
{
return GetPhyEntity(m_standard);
}
void
WifiPhy::AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity)
{
@@ -2029,14 +2035,14 @@ void
WifiPhy::SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu)
{
NS_LOG_FUNCTION(this);
GetPhyEntity(m_standard)->SwitchMaybeToCcaBusy(ppdu);
GetLatestPhyEntity()->SwitchMaybeToCcaBusy(ppdu);
}
void
WifiPhy::NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration)
{
NS_LOG_FUNCTION(this << duration);
GetPhyEntity(m_standard)->NotifyCcaBusy(ppdu, duration, WIFI_CHANLIST_PRIMARY);
GetLatestPhyEntity()->NotifyCcaBusy(ppdu, duration, WIFI_CHANLIST_PRIMARY);
}
void
@@ -2139,7 +2145,7 @@ Ptr<const WifiPsdu>
WifiPhy::GetAddressedPsduInPpdu(Ptr<const WifiPpdu> ppdu) const
{
// TODO: wrapper. See if still needed
return GetPhyEntity(ppdu->GetModulation())->GetAddressedPsduInPpdu(ppdu);
return GetLatestPhyEntity()->GetAddressedPsduInPpdu(ppdu);
}
WifiSpectrumBand

View File

@@ -1083,6 +1083,12 @@ class WifiPhy : public Object
* \return the pointer to the supported PHY entity
*/
Ptr<PhyEntity> GetPhyEntity(WifiStandard standard) const;
/**
* Get the latest PHY entity supported by this PHY instance.
*
* \return the latest PHY entity supported by this PHY instance
*/
Ptr<PhyEntity> GetLatestPhyEntity() const;
/**
* \return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)

View File

@@ -285,7 +285,7 @@ OfdmaSpectrumWifiPhy::GetEnergyDuration(double energyW, WifiSpectrumBand band)
Ptr<const HePhy>
OfdmaSpectrumWifiPhy::GetHePhy() const
{
return DynamicCast<const HePhy>(GetPhyEntity(WIFI_MOD_CLASS_HE));
return DynamicCast<const HePhy>(GetLatestPhyEntity());
}
/**
@@ -2450,7 +2450,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
HePhy::ConvertHeTbPpduDurationToLSigLength(ppduDuration, txVector, m_phy->GetPhyBand());
txVector.SetLength(length);
m_trigVector.SetLength(length);
auto hePhy = DynamicCast<HePhy>(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE));
auto hePhy = DynamicCast<HePhy>(m_phy->GetLatestPhyEntity());
hePhy->SetTrigVector(m_trigVector, ppduDuration);
ppdu->ResetTxVector();
m_phy->StartRx(rxParams);
@@ -3383,7 +3383,7 @@ TestUlOfdmaPhyTransmission::SetTrigVector(uint8_t bssColor, TrigVectorInfo error
++length;
}
txVector.SetLength(length);
auto hePhyAp = DynamicCast<HePhy>(m_phyAp->GetPhyEntity(WIFI_MOD_CLASS_HE));
auto hePhyAp = DynamicCast<HePhy>(m_phyAp->GetLatestPhyEntity());
hePhyAp->SetTrigVector(txVector, m_expectedPpduDuration);
}
@@ -5241,7 +5241,7 @@ TestPhyPaddingExclusion::SetTrigVector(Time ppduDuration)
std::tie(length, ppduDuration) =
HePhy::ConvertHeTbPpduDurationToLSigLength(ppduDuration, trigVector, m_phyAp->GetPhyBand());
trigVector.SetLength(length);
auto hePhyAp = DynamicCast<HePhy>(m_phyAp->GetPhyEntity(WIFI_MOD_CLASS_HE));
auto hePhyAp = DynamicCast<HePhy>(m_phyAp->GetLatestPhyEntity());
hePhyAp->SetTrigVector(trigVector, ppduDuration);
}

View File

@@ -954,7 +954,7 @@ WifiPrimaryChannelsTest::DoSendHeTbPpdu(uint8_t bss,
// AP's PHY expects to receive a TRIGVECTOR (just once)
trigVector.SetLength(length);
auto apHePhy = StaticCast<HePhy>(apDev->GetPhy()->GetPhyEntity(WIFI_MOD_CLASS_HE));
auto apHePhy = StaticCast<HePhy>(apDev->GetPhy()->GetLatestPhyEntity());
apHePhy->SetTrigVector(trigVector, duration);
}