wifi: Move EndOfHeSigA callback to HePhy
WifiPhy::GetPhyEntity now returns a non-const pointer (needed to connect callback)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "sta-wifi-mac.h"
|
||||
#include "wifi-utils.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "he-phy.h"
|
||||
#include "wifi-net-device.h"
|
||||
#include "he-configuration.h"
|
||||
|
||||
@@ -56,7 +57,9 @@ void
|
||||
ConstantObssPdAlgorithm::ConnectWifiNetDevice (const Ptr<WifiNetDevice> device)
|
||||
{
|
||||
Ptr<WifiPhy> phy = device->GetPhy ();
|
||||
phy->TraceConnectWithoutContext ("EndOfHeSigA", MakeCallback (&ConstantObssPdAlgorithm::ReceiveHeSigA, this));
|
||||
auto hePhy = DynamicCast<HePhy> (phy->GetPhyEntity (WIFI_MOD_CLASS_HE));
|
||||
NS_ASSERT (hePhy);
|
||||
hePhy->SetEndOfHeSigACallback (MakeCallback (&ConstantObssPdAlgorithm::ReceiveHeSigA, this));
|
||||
ObssPdAlgorithm::ConnectWifiNetDevice (device);
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ HePhy::ProcessSigA (Ptr<Event> event, PhyFieldRxStatus status)
|
||||
HeSigAParameters params;
|
||||
params.rssiW = GetRxPowerWForPpdu (event);
|
||||
params.bssColor = event->GetTxVector ().GetBssColor ();
|
||||
Simulator::ScheduleNow (&WifiPhy::NotifyEndOfHeSigA, GetPointer (m_wifiPhy), params);
|
||||
Simulator::ScheduleNow (&HePhy::NotifyEndOfHeSigA, this, params); //finish field processing first
|
||||
|
||||
if (status.isSuccess)
|
||||
{
|
||||
@@ -549,6 +549,21 @@ HePhy::ProcessSigA (Ptr<Event> event, PhyFieldRxStatus status)
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
HePhy::SetEndOfHeSigACallback (EndOfHeSigACallback callback)
|
||||
{
|
||||
m_endOfHeSigACallback = callback;
|
||||
}
|
||||
|
||||
void
|
||||
HePhy::NotifyEndOfHeSigA (HeSigAParameters params)
|
||||
{
|
||||
if (!m_endOfHeSigACallback.IsNull ())
|
||||
{
|
||||
m_endOfHeSigACallback (params);
|
||||
}
|
||||
}
|
||||
|
||||
PhyEntity::PhyFieldRxStatus
|
||||
HePhy::ProcessSigB (Ptr<Event> event, PhyFieldRxStatus status)
|
||||
{
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
|
||||
#include "vht-phy.h"
|
||||
#include "wifi-phy-band.h"
|
||||
#include "ns3/callback.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup wifi
|
||||
* Declaration of ns3::HePhy class.
|
||||
* Declaration of ns3::HePhy class
|
||||
* and ns3::HeSigAParameters struct.
|
||||
*/
|
||||
|
||||
namespace ns3 {
|
||||
@@ -38,6 +40,15 @@ namespace ns3 {
|
||||
*/
|
||||
#define HE_PHY 125
|
||||
|
||||
/**
|
||||
* Parameters for received HE-SIG-A for OBSS_PD based SR
|
||||
*/
|
||||
struct HeSigAParameters
|
||||
{
|
||||
double rssiW; ///< RSSI in W
|
||||
uint8_t bssColor; ///< BSS color
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief PHY entity for HE (11ax)
|
||||
* \ingroup wifi
|
||||
@@ -49,6 +60,13 @@ namespace ns3 {
|
||||
class HePhy : public VhtPhy
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Callback upon end of HE-SIG-A
|
||||
*
|
||||
* arg1: Parameters of HE-SIG-A
|
||||
*/
|
||||
typedef Callback<void, HeSigAParameters> EndOfHeSigACallback;
|
||||
|
||||
/**
|
||||
* Constructor for HE PHY
|
||||
*
|
||||
@@ -144,6 +162,22 @@ public:
|
||||
*/
|
||||
uint16_t GetCenterFrequencyForNonOfdmaPart (WifiTxVector txVector, uint16_t staId) const;
|
||||
|
||||
/**
|
||||
* Set a callback for a end of HE-SIG-A.
|
||||
*
|
||||
* \param callback the EndOfHeSigACallback to set
|
||||
*/
|
||||
void SetEndOfHeSigACallback (EndOfHeSigACallback callback);
|
||||
|
||||
/**
|
||||
* Fire a EndOfHeSigA callback (if connected) once HE-SIG-A field has been received.
|
||||
* This method is scheduled immediatly after end of HE-SIG-A, once
|
||||
* field processing is finished.
|
||||
*
|
||||
* \param params the HE-SIG-A parameters
|
||||
*/
|
||||
void NotifyEndOfHeSigA (HeSigAParameters params);
|
||||
|
||||
/**
|
||||
* Initialize all HE modes.
|
||||
*/
|
||||
@@ -257,6 +291,8 @@ protected:
|
||||
|
||||
std::map <uint16_t /* STA-ID */, EventId> m_beginOfdmaPayloadRxEvents; //!< the beginning of the OFDMA payload reception events (indexed by STA-ID)
|
||||
|
||||
EndOfHeSigACallback m_endOfHeSigACallback; //!< end of HE-SIG-A callback
|
||||
|
||||
private:
|
||||
// Inherited
|
||||
virtual void BuildModeList (void) override;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "obss-pd-algorithm.h"
|
||||
#include "wifi-net-device.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "he-phy.h"
|
||||
#include "wifi-utils.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -508,10 +508,6 @@ WifiPhy::GetTypeId (void)
|
||||
"in monitor mode to sniff all frames being transmitted",
|
||||
MakeTraceSourceAccessor (&WifiPhy::m_phyMonitorSniffTxTrace),
|
||||
"ns3::WifiPhy::MonitorSnifferTxTracedCallback")
|
||||
.AddTraceSource ("EndOfHeSigA",
|
||||
"Trace source indicating the end of the HE-SIG-A field for HE PPDUs (or more recent)",
|
||||
MakeTraceSourceAccessor (&WifiPhy::m_phyEndOfHeSigATrace),
|
||||
"ns3::WifiPhy::EndOfHeSigATracedCallback")
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -966,7 +962,7 @@ WifiPhy::GetStaticPhyEntity (WifiModulationClass modulation)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const Ptr<const PhyEntity>
|
||||
Ptr<PhyEntity>
|
||||
WifiPhy::GetPhyEntity (WifiModulationClass modulation) const
|
||||
{
|
||||
const auto it = m_phyEntities.find (modulation);
|
||||
@@ -974,15 +970,6 @@ WifiPhy::GetPhyEntity (WifiModulationClass modulation) const
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Ptr<PhyEntity>
|
||||
WifiPhy::GetPhyEntity (WifiModulationClass modulation)
|
||||
{
|
||||
//This method returns a non-const pointer to be used by child classes
|
||||
const auto it = m_phyEntities.find (modulation);
|
||||
NS_ABORT_MSG_IF (it == m_phyEntities.end (), "Unsupported Wi-Fi modulation class");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::AddStaticPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity)
|
||||
{
|
||||
@@ -2006,12 +1993,6 @@ WifiPhy::NotifyMonitorSniffTx (Ptr<const WifiPsdu> psdu, uint16_t channelFreqMhz
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::NotifyEndOfHeSigA (HeSigAParameters params)
|
||||
{
|
||||
m_phyEndOfHeSigATrace (params); //TODO to move to HePhy
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::Send (Ptr<const WifiPsdu> psdu, WifiTxVector txVector)
|
||||
{
|
||||
|
||||
@@ -39,13 +39,6 @@ class PreambleDetectionModel;
|
||||
class WifiRadioEnergyModel;
|
||||
class UniformRandomVariable;
|
||||
|
||||
/// Parameters for received HE-SIG-A for OBSS_PD based SR
|
||||
struct HeSigAParameters
|
||||
{
|
||||
double rssiW; ///< RSSI in W
|
||||
uint8_t bssColor; ///< BSS color
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief 802.11 PHY layer model
|
||||
* \ingroup wifi
|
||||
@@ -676,21 +669,6 @@ public:
|
||||
*/
|
||||
typedef void (* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
|
||||
|
||||
/**
|
||||
* Public method used to fire a EndOfHeSigA trace once HE-SIG-A field has been received.
|
||||
*
|
||||
* \param params the HE-SIG-A parameters
|
||||
*/
|
||||
void NotifyEndOfHeSigA (HeSigAParameters params);
|
||||
|
||||
/**
|
||||
* TracedCallback signature for end of HE-SIG-A events.
|
||||
*
|
||||
*
|
||||
* \param params the HE-SIG-A parameters
|
||||
*/
|
||||
typedef void (* EndOfHeSigACallback)(HeSigAParameters params);
|
||||
|
||||
/**
|
||||
* TracedCallback signature for start of PSDU reception events.
|
||||
*
|
||||
@@ -1011,9 +989,9 @@ public:
|
||||
* the WifiPhy instance.
|
||||
*
|
||||
* \param modulation the modulation class
|
||||
* \return the const pointer to the supported PHY entity
|
||||
* \return the pointer to the supported PHY entity
|
||||
*/
|
||||
const Ptr<const PhyEntity> GetPhyEntity (WifiModulationClass modulation) const;
|
||||
Ptr<PhyEntity> GetPhyEntity (WifiModulationClass modulation) const;
|
||||
|
||||
/**
|
||||
* \return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
|
||||
@@ -1116,17 +1094,6 @@ protected:
|
||||
* \param phyEntity the PHY entity
|
||||
*/
|
||||
void AddPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
|
||||
/**
|
||||
* Get the supported PHY entity corresponding to the modulation class, for
|
||||
* the WifiPhy instance.
|
||||
*
|
||||
* This method enables child classes to retrieve the non-const pointer to
|
||||
* the supported PHY entity.
|
||||
*
|
||||
* \param modulation the modulation class
|
||||
* \return the non-const pointer to the supported PHY entity
|
||||
*/
|
||||
Ptr<PhyEntity> GetPhyEntity (WifiModulationClass modulation);
|
||||
|
||||
InterferenceHelper m_interference; //!< the class handling interference computations
|
||||
Ptr<UniformRandomVariable> m_random; //!< Provides uniform random variables.
|
||||
@@ -1379,13 +1346,6 @@ private:
|
||||
*/
|
||||
TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, uint16_t /* STA-ID*/> m_phyMonitorSniffTxTrace;
|
||||
|
||||
/**
|
||||
* A trace source that indicates the end of HE SIG-A field for received 802.11ax PPDUs
|
||||
*
|
||||
* \see class CallBackTraceSource
|
||||
*/
|
||||
TracedCallback<HeSigAParameters> m_phyEndOfHeSigATrace;
|
||||
|
||||
/**
|
||||
* Map of __implemented__ PHY entities. This is used to compute the different
|
||||
* amendment-specific parameters in a static manner.
|
||||
|
||||
Reference in New Issue
Block a user