wifi: Pass channel type to WifiPhyListener::NotifyCcaBusyStart
This commit is contained in:
committed by
Stefano Avallone
parent
dc6c5c36ec
commit
c1dfb42dcf
@@ -443,7 +443,7 @@ void
|
||||
OcbWifiMac::MakeVirtualBusy (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
m_channelAccessManager->NotifyCcaBusyStartNow (duration);
|
||||
m_channelAccessManager->NotifyCcaBusyStartNow (duration, WIFI_CHANLIST_PRIMARY);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
{
|
||||
m_cam->NotifyTxStartNow (duration);
|
||||
}
|
||||
void NotifyCcaBusyStart (Time duration)
|
||||
void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType)
|
||||
{
|
||||
m_cam->NotifyCcaBusyStartNow (duration);
|
||||
m_cam->NotifyCcaBusyStartNow (duration, channelType);
|
||||
}
|
||||
void NotifySwitchingStart (Time duration)
|
||||
{
|
||||
@@ -613,9 +613,9 @@ ChannelAccessManager::NotifyTxStartNow (Time duration)
|
||||
}
|
||||
|
||||
void
|
||||
ChannelAccessManager::NotifyCcaBusyStartNow (Time duration)
|
||||
ChannelAccessManager::NotifyCcaBusyStartNow (Time duration, WifiChannelListType channelType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
NS_LOG_FUNCTION (this << duration << channelType);
|
||||
NS_LOG_DEBUG ("busy start for " << duration);
|
||||
UpdateBackoff ();
|
||||
m_lastBusyStart = Simulator::Now ();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <algorithm>
|
||||
#include "ns3/event-id.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "wifi-phy-common.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -152,10 +153,11 @@ public:
|
||||
void NotifyTxStartNow (Time duration);
|
||||
/**
|
||||
* \param duration expected duration of CCA busy period
|
||||
* \param channelType the channel type for which the CCA busy state is reported.
|
||||
*
|
||||
* Notify the Txop that a CCA busy period has just started.
|
||||
*/
|
||||
void NotifyCcaBusyStartNow (Time duration);
|
||||
void NotifyCcaBusyStartNow (Time duration, WifiChannelListType channelType);
|
||||
/**
|
||||
* \param duration expected duration of channel switching period
|
||||
*
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#ifndef WIFI_PHY_LISTENER_H
|
||||
#define WIFI_PHY_LISTENER_H
|
||||
|
||||
namespace ns3 {
|
||||
#include "wifi-phy-common.h"
|
||||
|
||||
class Time;
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief receive notifications about PHY events.
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
virtual void NotifyTxStart (Time duration, double txPowerDbm) = 0;
|
||||
/**
|
||||
* \param duration the expected busy duration.
|
||||
* \param channelType the channel type for which the CCA busy state is reported.
|
||||
*
|
||||
* This method does not really report a real state
|
||||
* change as opposed to the other methods in this class.
|
||||
@@ -91,7 +92,7 @@ public:
|
||||
* which the last NotifyCcaBusyStart method is called and
|
||||
* what duration it reported.
|
||||
*/
|
||||
virtual void NotifyCcaBusyStart (Time duration) = 0;
|
||||
virtual void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType) = 0;
|
||||
/**
|
||||
* \param duration the expected channel switching duration.
|
||||
*
|
||||
|
||||
@@ -266,12 +266,12 @@ WifiPhyStateHelper::NotifyRxEndError (void)
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhyStateHelper::NotifyCcaBusyStart (Time duration)
|
||||
WifiPhyStateHelper::NotifyCcaBusyStart (Time duration, WifiChannelListType channelType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
for (const auto& listener : m_listeners)
|
||||
{
|
||||
listener->NotifyCcaBusyStart (duration);
|
||||
listener->NotifyCcaBusyStart (duration, channelType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,8 +314,9 @@ private:
|
||||
* Notify all WifiPhyListener that the CCA has started for the given duration.
|
||||
*
|
||||
* \param duration the duration of the CCA state
|
||||
* \param channelType the channel type for which the CCA busy state is reported.
|
||||
*/
|
||||
void NotifyCcaBusyStart (Time duration);
|
||||
void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType = WIFI_CHANLIST_PRIMARY);
|
||||
/**
|
||||
* Notify all WifiPhyListener that we are switching channel with the given channel
|
||||
* switching delay.
|
||||
|
||||
@@ -541,9 +541,9 @@ WifiRadioEnergyModelPhyListener::NotifyTxStart (Time duration, double txPowerDbm
|
||||
}
|
||||
|
||||
void
|
||||
WifiRadioEnergyModelPhyListener::NotifyCcaBusyStart (Time duration)
|
||||
WifiRadioEnergyModelPhyListener::NotifyCcaBusyStart (Time duration, WifiChannelListType channelType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
NS_LOG_FUNCTION (this << duration << channelType);
|
||||
if (m_changeStateCallback.IsNull ())
|
||||
{
|
||||
NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
|
||||
|
||||
@@ -64,78 +64,15 @@ public:
|
||||
*/
|
||||
void SetUpdateTxCurrentCallback (UpdateTxCurrentCallback callback);
|
||||
|
||||
/**
|
||||
* \brief Switches the WifiRadioEnergyModel to RX state.
|
||||
*
|
||||
* \param duration the expected duration of the packet reception.
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyRxStart (Time duration) override;
|
||||
|
||||
/**
|
||||
* \brief Switches the WifiRadioEnergyModel back to IDLE state.
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*
|
||||
* Note that for the WifiRadioEnergyModel, the behavior of the function is the
|
||||
* same as NotifyRxEndError.
|
||||
*/
|
||||
void NotifyRxEndOk (void) override;
|
||||
|
||||
/**
|
||||
* \brief Switches the WifiRadioEnergyModel back to IDLE state.
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*
|
||||
* Note that for the WifiRadioEnergyModel, the behavior of the function is the
|
||||
* same as NotifyRxEndOk.
|
||||
*/
|
||||
void NotifyRxEndError (void) override;
|
||||
|
||||
/**
|
||||
* \brief Switches the WifiRadioEnergyModel to TX state and switches back to
|
||||
* IDLE after TX duration.
|
||||
*
|
||||
* \param duration the expected transmission duration.
|
||||
* \param txPowerDbm the nominal TX power in dBm
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyTxStart (Time duration, double txPowerDbm) override;
|
||||
|
||||
/**
|
||||
* \param duration the expected busy duration.
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyCcaBusyStart (Time duration) override;
|
||||
|
||||
/**
|
||||
* \param duration the expected channel switching duration.
|
||||
*
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType) override;
|
||||
void NotifySwitchingStart (Time duration) override;
|
||||
|
||||
/**
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifySleep (void) override;
|
||||
|
||||
/**
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyOff (void) override;
|
||||
|
||||
/**
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyWakeup (void) override;
|
||||
|
||||
/**
|
||||
* Defined in ns3::WifiPhyListener
|
||||
*/
|
||||
void NotifyOn (void) override;
|
||||
|
||||
|
||||
|
||||
@@ -363,8 +363,9 @@ private:
|
||||
* Add CCA busy event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
* \param channelType the channel type
|
||||
*/
|
||||
void AddCcaBusyEvt (uint64_t at, uint64_t duration);
|
||||
void AddCcaBusyEvt (uint64_t at, uint64_t duration, WifiChannelListType channelType = WIFI_CHANLIST_PRIMARY);
|
||||
/**
|
||||
* Add switching event function
|
||||
* \param at the event time
|
||||
@@ -715,11 +716,11 @@ ChannelAccessManagerTest<TxopType>::DoAccessRequest (uint64_t txTime, uint64_t e
|
||||
|
||||
template <typename TxopType>
|
||||
void
|
||||
ChannelAccessManagerTest<TxopType>::AddCcaBusyEvt (uint64_t at, uint64_t duration)
|
||||
ChannelAccessManagerTest<TxopType>::AddCcaBusyEvt (uint64_t at, uint64_t duration, WifiChannelListType channelType)
|
||||
{
|
||||
Simulator::Schedule (MicroSeconds (at) - Now (),
|
||||
&ChannelAccessManager::NotifyCcaBusyStartNow, m_ChannelAccessManager,
|
||||
MicroSeconds (duration));
|
||||
MicroSeconds (duration), channelType);
|
||||
}
|
||||
|
||||
template <typename TxopType>
|
||||
|
||||
@@ -253,9 +253,9 @@ public:
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration << txPowerDbm);
|
||||
}
|
||||
void NotifyCcaBusyStart (Time duration) override
|
||||
void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType) override
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << duration << channelType);
|
||||
++m_notifyMaybeCcaBusyStart;
|
||||
}
|
||||
void NotifySwitchingStart (Time duration) override
|
||||
|
||||
Reference in New Issue
Block a user