wifi: Generate PHY-CCA.indication upon channel switching

This commit is contained in:
Sébastien Deronne
2023-02-05 14:25:24 +01:00
committed by Sebastien Deronne
parent 08f3373bbe
commit 3256ecabfe

View File

@@ -272,17 +272,19 @@ SpectrumWifiPhy::DoChannelSwitch()
if ((frequencyBefore == frequencyAfter) && (widthBefore == widthAfter))
{
NS_LOG_DEBUG("Same RF channel as before, do nothing");
SwitchMaybeToCcaBusy(nullptr);
return;
}
auto newSpectrumPhyInterface = GetInterfaceCoveringChannelBand(frequencyAfter, widthAfter);
const auto interfaceChanged = (newSpectrumPhyInterface != m_currentSpectrumPhyInterface);
NS_ABORT_MSG_IF(!newSpectrumPhyInterface,
"No spectrum channel covers frequency range ["
<< frequencyAfter - (widthAfter / 2) << " MHz - "
<< frequencyAfter + (widthAfter / 2) << " MHz]");
if (newSpectrumPhyInterface != m_currentSpectrumPhyInterface)
if (interfaceChanged)
{
NS_LOG_DEBUG("Switch to existing RF interface with frequency/width pair of ("
<< frequencyAfter << ", " << widthAfter << ")");
@@ -301,6 +303,8 @@ SpectrumWifiPhy::DoChannelSwitch()
// it again in the entry associated with the new RX spectrum model UID)
m_currentSpectrumPhyInterface = newSpectrumPhyInterface;
ResetSpectrumModel();
SwitchMaybeToCcaBusy(nullptr);
}
bool