wifi: Extend helper to set frame capture model
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/spectrum-wifi-phy.h"
|
||||
#include "ns3/error-rate-model.h"
|
||||
#include "ns3/frame-capture-model.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include "spectrum-wifi-helper.h"
|
||||
|
||||
@@ -64,6 +65,11 @@ SpectrumWifiPhyHelper::Create (Ptr<Node> node, Ptr<NetDevice> device) const
|
||||
phy->CreateWifiSpectrumPhyInterface (device);
|
||||
Ptr<ErrorRateModel> error = m_errorRateModel.Create<ErrorRateModel> ();
|
||||
phy->SetErrorRateModel (error);
|
||||
if (m_frameCaptureModel.GetTypeId ().GetUid ())
|
||||
{
|
||||
Ptr<FrameCaptureModel> capture = m_frameCaptureModel.Create<FrameCaptureModel> ();
|
||||
phy->SetFrameCaptureModel (capture);
|
||||
}
|
||||
phy->SetChannel (m_channel);
|
||||
phy->SetDevice (device);
|
||||
phy->SetMobility (node->GetObject<MobilityModel> ());
|
||||
|
||||
@@ -165,6 +165,29 @@ WifiPhyHelper::SetErrorRateModel (std::string name,
|
||||
m_errorRateModel.Set (n7, v7);
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhyHelper::SetFrameCaptureModel (std::string name,
|
||||
std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3,
|
||||
std::string n4, const AttributeValue &v4,
|
||||
std::string n5, const AttributeValue &v5,
|
||||
std::string n6, const AttributeValue &v6,
|
||||
std::string n7, const AttributeValue &v7)
|
||||
{
|
||||
m_frameCaptureModel = ObjectFactory ();
|
||||
m_frameCaptureModel.SetTypeId (name);
|
||||
m_frameCaptureModel.Set (n0, v0);
|
||||
m_frameCaptureModel.Set (n1, v1);
|
||||
m_frameCaptureModel.Set (n2, v2);
|
||||
m_frameCaptureModel.Set (n3, v3);
|
||||
m_frameCaptureModel.Set (n4, v4);
|
||||
m_frameCaptureModel.Set (n5, v5);
|
||||
m_frameCaptureModel.Set (n6, v6);
|
||||
m_frameCaptureModel.Set (n7, v7);
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhyHelper::PcapSniffTxEvent (
|
||||
Ptr<PcapFileWrapper> file,
|
||||
|
||||
@@ -100,6 +100,36 @@ public:
|
||||
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
|
||||
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
|
||||
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
|
||||
/**
|
||||
* \param name the name of the error rate model to set.
|
||||
* \param n0 the name of the attribute to set
|
||||
* \param v0 the value of the attribute to set
|
||||
* \param n1 the name of the attribute to set
|
||||
* \param v1 the value of the attribute to set
|
||||
* \param n2 the name of the attribute to set
|
||||
* \param v2 the value of the attribute to set
|
||||
* \param n3 the name of the attribute to set
|
||||
* \param v3 the value of the attribute to set
|
||||
* \param n4 the name of the attribute to set
|
||||
* \param v4 the value of the attribute to set
|
||||
* \param n5 the name of the attribute to set
|
||||
* \param v5 the value of the attribute to set
|
||||
* \param n6 the name of the attribute to set
|
||||
* \param v6 the value of the attribute to set
|
||||
* \param n7 the name of the attribute to set
|
||||
* \param v7 the value of the attribute to set
|
||||
*
|
||||
* Set the frame capture model and its attributes to use when Install is called.
|
||||
*/
|
||||
void SetFrameCaptureModel (std::string name,
|
||||
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
|
||||
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
|
||||
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
|
||||
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
|
||||
std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
|
||||
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
|
||||
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
|
||||
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
|
||||
|
||||
/**
|
||||
* An enumeration of the pcap data link types (DLTs) which this helper
|
||||
@@ -168,6 +198,7 @@ protected:
|
||||
|
||||
ObjectFactory m_phy; ///< PHY object
|
||||
ObjectFactory m_errorRateModel; ///< error rate model
|
||||
ObjectFactory m_frameCaptureModel; ///< frame capture model
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ns3/propagation-loss-model.h"
|
||||
#include "ns3/propagation-delay-model.h"
|
||||
#include "ns3/error-rate-model.h"
|
||||
#include "ns3/frame-capture-model.h"
|
||||
#include "ns3/yans-wifi-phy.h"
|
||||
#include "yans-wifi-helper.h"
|
||||
|
||||
@@ -154,6 +155,11 @@ YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<NetDevice> device) const
|
||||
Ptr<YansWifiPhy> phy = m_phy.Create<YansWifiPhy> ();
|
||||
Ptr<ErrorRateModel> error = m_errorRateModel.Create<ErrorRateModel> ();
|
||||
phy->SetErrorRateModel (error);
|
||||
if (m_frameCaptureModel.GetTypeId ().GetUid ())
|
||||
{
|
||||
Ptr<FrameCaptureModel> capture = m_frameCaptureModel.Create<FrameCaptureModel> ();
|
||||
phy->SetFrameCaptureModel (capture);
|
||||
}
|
||||
phy->SetChannel (m_channel);
|
||||
phy->SetDevice (device);
|
||||
return phy;
|
||||
|
||||
Reference in New Issue
Block a user