diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index ce8d66324..f452aedc8 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1842,17 +1842,23 @@ WifiPhy::Send(WifiConstPsduMap psdus, const WifiTxVector& txVector) } m_endTxEvent = - Simulator::Schedule(txDuration, &WifiPhy::NotifyTxEnd, this, psdus); // TODO: fix for MU + Simulator::Schedule(txDuration, &WifiPhy::TxDone, this, psdus); // TODO: fix for MU StartTx(ppdu); ppdu->ResetTxVector(); m_channelAccessRequested = false; m_powerRestricted = false; +} - Simulator::Schedule(txDuration, &WifiPhy::Reset, this); - - Simulator::Schedule(txDuration, &WifiPhy::SwitchMaybeToCcaBusy, this, nullptr); +void +WifiPhy::TxDone(const WifiConstPsduMap& psdus) +{ + NS_LOG_FUNCTION(this << psdus); + NotifyTxEnd(psdus); + Reset(); + // we might have received signals during TX + SwitchMaybeToCcaBusy(); } uint64_t diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index ee40675ee..8aea6a5ff 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1389,6 +1389,12 @@ class WifiPhy : public Object */ void AbortCurrentReception(WifiPhyRxfailureReason reason); + /** + * Callback function when a transmission is completed + * \param psdus the PSDUs that have been sent + */ + void TxDone(const WifiConstPsduMap& psdus); + /** * Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU). *