wifi: Add functions to retrieve the modulation class and PHY entity for a given standard
This commit is contained in:
@@ -187,4 +187,39 @@ IsUlMu (WifiPreamble preamble)
|
||||
return ((preamble == WIFI_PREAMBLE_HE_TB) || (preamble == WIFI_PREAMBLE_EHT_TB));
|
||||
}
|
||||
|
||||
WifiModulationClass
|
||||
GetModulationClassForStandard (WifiStandard standard)
|
||||
{
|
||||
WifiModulationClass modulationClass {WIFI_MOD_CLASS_UNKNOWN};
|
||||
switch (standard)
|
||||
{
|
||||
case WIFI_STANDARD_80211a:
|
||||
[[fallthrough]];
|
||||
case WIFI_STANDARD_80211p:
|
||||
modulationClass = WIFI_MOD_CLASS_OFDM;
|
||||
break;
|
||||
case WIFI_STANDARD_80211b:
|
||||
modulationClass = WIFI_MOD_CLASS_DSSS;
|
||||
break;
|
||||
case WIFI_STANDARD_80211g:
|
||||
modulationClass = WIFI_MOD_CLASS_ERP_OFDM;
|
||||
break;
|
||||
case WIFI_STANDARD_80211n:
|
||||
modulationClass = WIFI_MOD_CLASS_HT;
|
||||
break;
|
||||
case WIFI_STANDARD_80211ac:
|
||||
modulationClass = WIFI_MOD_CLASS_VHT;
|
||||
break;
|
||||
case WIFI_STANDARD_80211ax:
|
||||
modulationClass = WIFI_MOD_CLASS_HE;
|
||||
break;
|
||||
case WIFI_STANDARD_UNSPECIFIED:
|
||||
[[fallthrough]];
|
||||
default:
|
||||
NS_ASSERT_MSG (false, "Unsupported standard " << standard);
|
||||
break;
|
||||
}
|
||||
return modulationClass;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <ostream>
|
||||
#include "ns3/fatal-error.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "wifi-standards.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
@@ -488,6 +489,14 @@ bool IsDlMu (WifiPreamble preamble);
|
||||
*/
|
||||
bool IsUlMu (WifiPreamble preamble);
|
||||
|
||||
/**
|
||||
* Return the modulation class corresponding to a given standard.
|
||||
*
|
||||
* \param standard the standard
|
||||
* \return the modulation class corresponding to the standard
|
||||
*/
|
||||
WifiModulationClass GetModulationClassForStandard (WifiStandard standard);
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* WIFI_PHY_COMMON_H */
|
||||
|
||||
@@ -655,6 +655,12 @@ WifiPhy::GetPhyEntity (WifiModulationClass modulation) const
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Ptr<PhyEntity>
|
||||
WifiPhy::GetPhyEntity (WifiStandard standard) const
|
||||
{
|
||||
return GetPhyEntity (GetModulationClassForStandard (standard));
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::AddStaticPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity)
|
||||
{
|
||||
|
||||
@@ -1008,13 +1008,19 @@ public:
|
||||
static const Ptr<const PhyEntity> GetStaticPhyEntity (WifiModulationClass modulation);
|
||||
|
||||
/**
|
||||
* Get the supported PHY entity corresponding to the modulation class, for
|
||||
* the WifiPhy instance.
|
||||
* Get the supported PHY entity corresponding to the modulation class.
|
||||
*
|
||||
* \param modulation the modulation class
|
||||
* \return the pointer to the supported PHY entity
|
||||
*/
|
||||
Ptr<PhyEntity> GetPhyEntity (WifiModulationClass modulation) const;
|
||||
/**
|
||||
* Get the supported PHY entity corresponding to the wifi standard.
|
||||
*
|
||||
* \param standard the wifi standard
|
||||
* \return the pointer to the supported PHY entity
|
||||
*/
|
||||
Ptr<PhyEntity> GetPhyEntity (WifiStandard standard) const;
|
||||
|
||||
/**
|
||||
* \return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
|
||||
|
||||
Reference in New Issue
Block a user