wifi: Add WifiTxVector::GetModulationClass for convenience

In case the TxVector is MU, we don't need to specify any STAID
because the modulation class is unique. Getting the modulation
class through the WifiMode requires to specify the STAID instead.
This commit is contained in:
Stefano Avallone
2020-11-18 13:16:30 +01:00
parent 2bcf750347
commit 2de357aac2
2 changed files with 24 additions and 0 deletions

View File

@@ -119,6 +119,23 @@ WifiTxVector::GetMode (uint16_t staId) const
return m_mode;
}
WifiModulationClass
WifiTxVector::GetModulationClass (void) const
{
NS_ABORT_MSG_IF (!m_modeInitialized, "WifiTxVector mode must be set before using");
// TODO Replace the following with IsMu when available
if (m_preamble == WIFI_PREAMBLE_VHT_MU
|| m_preamble == WIFI_PREAMBLE_HE_MU
|| m_preamble == WIFI_PREAMBLE_HE_TB)
{
NS_ASSERT (!m_muUserInfos.empty ());
// all the modes belong to the same modulation class
return m_muUserInfos.begin ()->second.mcs.GetModulationClass ();
}
return m_mode.GetModulationClass ();
}
uint8_t
WifiTxVector::GetTxPowerLevel (void) const
{

View File

@@ -137,6 +137,13 @@ public:
*/
void SetMode (WifiMode mode, uint16_t staId);
/**
* Get the modulation class specified by this TXVECTOR.
*
* \return the Modulation Class specified by this TXVECTOR
*/
WifiModulationClass GetModulationClass (void) const;
/**
* \returns the transmission power level
*/