wifi: Add WifiHelper methods to set config options for available standards

This commit is contained in:
Stefano Avallone
2022-06-27 15:11:05 +02:00
committed by Stefano Avallone
parent 59e05f030e
commit 2cea008b33
2 changed files with 80 additions and 5 deletions

View File

@@ -691,6 +691,10 @@ WifiHelper::WifiHelper ()
m_enableFlowControl (true)
{
SetRemoteStationManager ("ns3::IdealWifiManager");
m_htConfig.SetTypeId ("ns3::HtConfiguration");
m_vhtConfig.SetTypeId ("ns3::VhtConfiguration");
m_heConfig.SetTypeId ("ns3::HeConfiguration");
m_ehtConfig.SetTypeId ("ns3::EhtConfiguration");
}
void
@@ -731,7 +735,7 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
}
if (m_standard >= WIFI_STANDARD_80211n)
{
Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
auto htConfiguration = m_htConfig.Create<HtConfiguration> ();
device->SetHtConfiguration (htConfiguration);
}
if (m_standard >= WIFI_STANDARD_80211ac)
@@ -741,17 +745,17 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
// This approach allows us not to worry about deleting this object when
// the PHY band is switched from 5GHz to 2.4GHz and creating this object
// when the PHY band is switched from 2.4GHz to 5GHz.
Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
auto vhtConfiguration = m_vhtConfig.Create<VhtConfiguration> ();
device->SetVhtConfiguration (vhtConfiguration);
}
if (m_standard >= WIFI_STANDARD_80211ax)
{
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
auto heConfiguration = m_heConfig.Create<HeConfiguration> ();
device->SetHeConfiguration (heConfiguration);
}
if (m_standard >= WIFI_STANDARD_80211be)
{
Ptr<EhtConfiguration> ehtConfiguration = CreateObject<EhtConfiguration> ();
auto ehtConfiguration = m_ehtConfig.Create<EhtConfiguration> ();
device->SetEhtConfiguration (ehtConfiguration);
}
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();

View File

@@ -388,6 +388,46 @@ public:
*/
virtual void SetStandard (WifiStandard standard);
/**
* Helper function used to configure the HT options listed as attributes of
* the HtConfiguration class.
*
* \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
* \param args A sequence of name-value pairs of the attributes to set.
*/
template <typename... Args>
void ConfigHtOptions (Args&&... args);
/**
* Helper function used to configure the VHT options listed as attributes of
* the VhtConfiguration class.
*
* \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
* \param args A sequence of name-value pairs of the attributes to set.
*/
template <typename... Args>
void ConfigVhtOptions (Args&&... args);
/**
* Helper function used to configure the HE options listed as attributes of
* the HeConfiguration class.
*
* \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
* \param args A sequence of name-value pairs of the attributes to set.
*/
template <typename... Args>
void ConfigHeOptions (Args&&... args);
/**
* Helper function used to configure the EHT options listed as attributes of
* the EhtConfiguration class.
*
* \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
* \param args A sequence of name-value pairs of the attributes to set.
*/
template <typename... Args>
void ConfigEhtOptions (Args&&... args);
/**
* Helper to enable all WifiNetDevice log components with one statement
*/
@@ -412,8 +452,11 @@ public:
protected:
ObjectFactory m_stationManager; ///< station manager
ObjectFactory m_ackPolicySelector[4]; ///< ack policy selector for all ACs
WifiStandard m_standard; ///< wifi standard
ObjectFactory m_htConfig; ///< HT configuration
ObjectFactory m_vhtConfig; ///< VHT configuration
ObjectFactory m_heConfig; ///< HE configuration
ObjectFactory m_ehtConfig; ///< EHT configuration
SelectQueueCallback m_selectQueueCallback; ///< select queue callback
ObjectFactory m_obssPdAlgorithm; ///< OBSS_PD algorithm
bool m_enableFlowControl; //!< whether to enable flow control
@@ -475,6 +518,34 @@ WifiHelper::SetObssPdAlgorithm (std::string type, Args&&... args)
m_obssPdAlgorithm.Set (args...);
}
template <typename... Args>
void
WifiHelper::ConfigHtOptions (Args&&... args)
{
m_htConfig.Set (args...);
}
template <typename... Args>
void
WifiHelper::ConfigVhtOptions (Args&&... args)
{
m_vhtConfig.Set (args...);
}
template <typename... Args>
void
WifiHelper::ConfigHeOptions (Args&&... args)
{
m_heConfig.Set (args...);
}
template <typename... Args>
void
WifiHelper::ConfigEhtOptions (Args&&... args)
{
m_ehtConfig.Set (args...);
}
} // namespace ns3
#endif /* WIFI_HELPER_H */