A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::LrWpanHelper Class Reference

helps to manage and create IEEE 802.15.4 NetDevice objects More...

#include "lr-wpan-helper.h"

+ Inheritance diagram for ns3::LrWpanHelper:
+ Collaboration diagram for ns3::LrWpanHelper:

Public Member Functions

 LrWpanHelper ()
 Create a LrWpan helper in an empty state.
 
 LrWpanHelper (bool useMultiModelSpectrumChannel)
 Create a LrWpan helper in an empty state.
 
 LrWpanHelper (const LrWpanHelper &)=delete
 
 ~LrWpanHelper () override
 
void AddMobility (Ptr< lrwpan::LrWpanPhy > phy, Ptr< MobilityModel > m)
 Add mobility model to a physical device.
 
template<typename... Ts>
void AddPropagationLossModel (std::string name, Ts &&... args)
 
int64_t AssignStreams (NetDeviceContainer c, int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model.
 
void CreateAssociatedPan (NetDeviceContainer c, uint16_t panId)
 Creates an PAN with associated nodes and assigned addresses(16 and 64) from the nodes in the node container.
 
void EnableLogComponents ()
 Helper to enable all LrWpan log components with one statement.
 
Ptr< SpectrumChannelGetChannel ()
 Get the channel associated to this helper.
 
NetDeviceContainer Install (NodeContainer c)
 Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.
 
LrWpanHelperoperator= (const LrWpanHelper &)=delete
 
void SetChannel (Ptr< SpectrumChannel > channel)
 Set the channel associated to this helper.
 
void SetChannel (std::string channelName)
 Set the channel associated to this helper.
 
void SetExtendedAddresses (NetDeviceContainer c)
 Set the extended 64 bit addresses (EUI-64) for a group of LrWpanNetDevices.
 
template<typename... Ts>
void SetPropagationDelayModel (std::string name, Ts &&... args)
 
- Public Member Functions inherited from ns3::PcapHelperForDevice
 PcapHelperForDevice ()
 Construct a PcapHelperForDevice.
 
virtual ~PcapHelperForDevice ()
 Destroy a PcapHelperForDevice.
 
void EnablePcap (std::string prefix, NetDeviceContainer d, bool promiscuous=false)
 Enable pcap output on each device in the container which is of the appropriate type.
 
void EnablePcap (std::string prefix, NodeContainer n, bool promiscuous=false)
 Enable pcap output on each device (which is of the appropriate type) in the nodes provided in the container.
 
void EnablePcap (std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
 Enable pcap output the indicated net device.
 
void EnablePcap (std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false)
 Enable pcap output the indicated net device using a device previously named using the ns-3 object name service.
 
void EnablePcap (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false)
 Enable pcap output on the device specified by a global node-id (of a previously created node) and associated device-id.
 
void EnablePcapAll (std::string prefix, bool promiscuous=false)
 Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created in the simulation.
 
- Public Member Functions inherited from ns3::AsciiTraceHelperForDevice
 AsciiTraceHelperForDevice ()
 Construct an AsciiTraceHelperForDevice.
 
virtual ~AsciiTraceHelperForDevice ()
 Destroy an AsciiTraceHelperForDevice.
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, NetDeviceContainer d)
 Enable ascii trace output on each device in the container which is of the appropriate type.
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, NodeContainer n)
 Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container.
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd)
 Enable ascii trace output on the indicated net device.
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, std::string ndName)
 Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service.
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, uint32_t nodeid, uint32_t deviceid)
 Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id.
 
void EnableAscii (std::string prefix, NetDeviceContainer d)
 Enable ascii trace output on each device in the container which is of the appropriate type.
 
void EnableAscii (std::string prefix, NodeContainer n)
 Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container.
 
void EnableAscii (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false)
 Enable ascii trace output on the indicated net device.
 
void EnableAscii (std::string prefix, std::string ndName, bool explicitFilename=false)
 Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service.
 
void EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename)
 Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id.
 
void EnableAsciiAll (Ptr< OutputStreamWrapper > stream)
 Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation.
 
void EnableAsciiAll (std::string prefix)
 Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation.
 

Static Public Member Functions

static std::string LrWpanMacStatePrinter (lrwpan::MacState e)
 Transform the LrWpanMacState enumeration into a printable string.
 
static std::string LrWpanPhyEnumerationPrinter (lrwpan::PhyEnumeration e)
 Transform the LrWpanPhyEnumeration enumeration into a printable string.
 

Private Member Functions

void EnableAsciiInternal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
 Enable ascii trace output on the indicated net device.
 
void EnablePcapInternal (std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
 Enable pcap output on the indicated net device.
 

Private Attributes

Ptr< SpectrumChannelm_channel
 channel to be used for the devices
 
ObjectFactory m_propagationDelay
 propagation delay model
 
std::vector< ObjectFactorym_propagationLoss
 vector of propagation loss models
 
bool m_useMultiModelSpectrumChannel
 indicates whether a MultiModelSpectrumChannel is used
 

Detailed Description

helps to manage and create IEEE 802.15.4 NetDevice objects

This class can help to create IEEE 802.15.4 NetDevice objects and to configure their attributes during creation. It also contains additional helper functions used by client code.

Only one channel is created, and all devices attached to it. If multiple channels are needed, multiple helper objects must be used, or else the channel object must be replaced.

Definition at line 38 of file lr-wpan-helper.h.

Constructor & Destructor Documentation

◆ LrWpanHelper() [1/3]

ns3::LrWpanHelper::LrWpanHelper ( )

Create a LrWpan helper in an empty state.

Definition at line 52 of file lr-wpan-helper.cc.

References m_useMultiModelSpectrumChannel.

◆ LrWpanHelper() [2/3]

ns3::LrWpanHelper::LrWpanHelper ( bool useMultiModelSpectrumChannel)

Create a LrWpan helper in an empty state.

Parameters
useMultiModelSpectrumChanneluse a MultiModelSpectrumChannel if true, a SingleModelSpectrumChannel otherwise

Definition at line 57 of file lr-wpan-helper.cc.

References m_useMultiModelSpectrumChannel.

◆ ~LrWpanHelper()

ns3::LrWpanHelper::~LrWpanHelper ( )
override

Definition at line 62 of file lr-wpan-helper.cc.

References m_channel.

◆ LrWpanHelper() [3/3]

ns3::LrWpanHelper::LrWpanHelper ( const LrWpanHelper & )
delete

Member Function Documentation

◆ AddMobility()

void ns3::LrWpanHelper::AddMobility ( Ptr< lrwpan::LrWpanPhy > phy,
Ptr< MobilityModel > m )

Add mobility model to a physical device.

Parameters
phythe physical device
mthe mobility model

Definition at line 138 of file lr-wpan-helper.cc.

◆ AddPropagationLossModel()

template<typename... Ts>
void ns3::LrWpanHelper::AddPropagationLossModel ( std::string name,
Ts &&... args )
Template Parameters
Ts[deduced] Argument types
Parameters
namethe name of the model to set
[in]argsName and AttributeValue pairs to set.

Add a propagation loss model to the set of currently-configured loss models.

Definition at line 218 of file lr-wpan-helper.h.

References m_propagationLoss.

Referenced by LrWpanAckTestCase::DoRun(), and Install().

+ Here is the caller graph for this function:

◆ AssignStreams()

int64_t ns3::LrWpanHelper::AssignStreams ( NetDeviceContainer c,
int64_t stream )

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams that have been assigned. The Install() method should have previously been called by the user.

Parameters
cNetDeviceContainer of the set of net devices for which the CsmaNetDevice should be modified to use a fixed stream
streamfirst stream index to use
Returns
the number of stream indices assigned by this helper

Definition at line 221 of file lr-wpan-helper.cc.

References ns3::NetDeviceContainer::Begin(), ns3::DynamicCast(), and ns3::NetDeviceContainer::End().

+ Here is the call graph for this function:

◆ CreateAssociatedPan()

void ns3::LrWpanHelper::CreateAssociatedPan ( NetDeviceContainer c,
uint16_t panId )

Creates an PAN with associated nodes and assigned addresses(16 and 64) from the nodes in the node container.

The first node in the container becomes the PAN coordinator.

Parameters
ca The node container with the nodes that will form the PAN.
panIdThe PAN identifier.

Definition at line 238 of file lr-wpan-helper.cc.

References ns3::NetDeviceContainer::Begin(), ns3::Mac16Address::CopyFrom(), ns3::Mac64Address::CopyFrom(), ns3::DynamicCast(), ns3::NetDeviceContainer::End(), and NS_ABORT_MSG.

+ Here is the call graph for this function:

◆ EnableAsciiInternal()

void ns3::LrWpanHelper::EnableAsciiInternal ( Ptr< OutputStreamWrapper > stream,
std::string prefix,
Ptr< NetDevice > nd,
bool explicitFilename )
overrideprivatevirtual

Enable ascii trace output on the indicated net device.

NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.

Parameters
streamThe output stream object to use when logging ascii traces.
prefixFilename prefix to use for ascii trace files.
ndNet device for which you want to enable tracing.
explicitFilenameTreat the prefix as an explicit filename if true

Implements ns3::AsciiTraceHelperForDevice.

Definition at line 381 of file lr-wpan-helper.cc.

References ns3::AsciiLrWpanMacTransmitSinkWithContext(), ns3::AsciiLrWpanMacTransmitSinkWithoutContext(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(), ns3::AsciiTraceHelper::DefaultDropSinkWithContext(), ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(), ns3::Packet::EnablePrinting(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), and NS_LOG_INFO.

+ Here is the call graph for this function:

◆ EnableLogComponents()

void ns3::LrWpanHelper::EnableLogComponents ( )

Helper to enable all LrWpan log components with one statement.

Definition at line 69 of file lr-wpan-helper.cc.

References ns3::LOG_LEVEL_ALL, ns3::LOG_PREFIX_FUNC, ns3::LOG_PREFIX_TIME, ns3::LogComponentEnable(), and ns3::LogComponentEnableAll().

+ Here is the call graph for this function:

◆ EnablePcapInternal()

void ns3::LrWpanHelper::EnablePcapInternal ( std::string prefix,
Ptr< NetDevice > nd,
bool promiscuous,
bool explicitFilename )
overrideprivatevirtual

Enable pcap output on the indicated net device.

NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.

Parameters
prefixFilename prefix to use for pcap files.
ndNet device for which you want to enable tracing.
promiscuousIf true capture all possible packets available at the device.
explicitFilenameTreat the prefix as an explicit filename if true

Implements ns3::PcapHelperForDevice.

Definition at line 329 of file lr-wpan-helper.cc.

References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_IEEE802_15_4, ns3::PcapHelper::GetFilenameFromDevice(), ns3::MakeBoundCallback(), NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::PcapSniffLrWpan().

+ Here is the call graph for this function:

◆ GetChannel()

Ptr< SpectrumChannel > ns3::LrWpanHelper::GetChannel ( )

Get the channel associated to this helper.

Returns
the channel

Definition at line 202 of file lr-wpan-helper.cc.

References m_channel.

◆ Install()

NetDeviceContainer ns3::LrWpanHelper::Install ( NodeContainer c)

Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.

If the channel is not already initialized, it will be created as either a SingleModelSpectrumChannel or a MultiModelSpectrumChannel, depending on the useMultiModelSpectrumChannel flag. Additionally, a ConstantSpeedPropagationDelayModel will be set as the default delay model if no delay model is specified, and a LogDistancePropagationLossModel will be added to the channel if no propagation loss models are defined.

If the channel is already initialized but lacks either a PropagationDelayModel or a PropagationLossModel, an error will be raised.

Parameters
ca set of nodes
Returns
A container holding the added net devices.

Definition at line 144 of file lr-wpan-helper.cc.

References AddPropagationLossModel(), ns3::NodeContainer::Begin(), ns3::ObjectFactory::Create(), ns3::CreateObject(), ns3::NodeContainer::End(), ns3::ObjectFactory::IsTypeIdSet(), m_channel, m_propagationDelay, m_propagationLoss, m_useMultiModelSpectrumChannel, NS_FATAL_ERROR, and SetPropagationDelayModel().

Referenced by LrWpanAckTestCase::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LrWpanMacStatePrinter()

std::string ns3::LrWpanHelper::LrWpanMacStatePrinter ( lrwpan::MacState e)
static

Transform the LrWpanMacState enumeration into a printable string.

Parameters
ethe LrWpanMacState
Returns
a string

Definition at line 120 of file lr-wpan-helper.cc.

References ns3::lrwpan::CHANNEL_ACCESS_FAILURE, ns3::lrwpan::CHANNEL_IDLE, ns3::lrwpan::MAC_IDLE, and ns3::lrwpan::SET_PHY_TX_ON.

◆ LrWpanPhyEnumerationPrinter()

◆ operator=()

LrWpanHelper & ns3::LrWpanHelper::operator= ( const LrWpanHelper & )
delete

◆ SetChannel() [1/2]

void ns3::LrWpanHelper::SetChannel ( Ptr< SpectrumChannel > channel)

Set the channel associated to this helper.

Parameters
channelthe channel

Definition at line 208 of file lr-wpan-helper.cc.

References m_channel.

◆ SetChannel() [2/2]

void ns3::LrWpanHelper::SetChannel ( std::string channelName)

Set the channel associated to this helper.

Parameters
channelNamethe channel name

Definition at line 214 of file lr-wpan-helper.cc.

References ns3::Names::Find(), and m_channel.

+ Here is the call graph for this function:

◆ SetExtendedAddresses()

void ns3::LrWpanHelper::SetExtendedAddresses ( NetDeviceContainer c)

Set the extended 64 bit addresses (EUI-64) for a group of LrWpanNetDevices.

Parameters
cThe NetDevice container.

Definition at line 285 of file lr-wpan-helper.cc.

References ns3::NetDeviceContainer::Begin(), ns3::Mac64Address::CopyFrom(), ns3::DynamicCast(), and ns3::NetDeviceContainer::End().

+ Here is the call graph for this function:

◆ SetPropagationDelayModel()

template<typename... Ts>
void ns3::LrWpanHelper::SetPropagationDelayModel ( std::string name,
Ts &&... args )
Template Parameters
Ts[deduced] Argument types
Parameters
namethe name of the model to set
[in]argsName and AttributeValue pairs to set.

Configure a propagation delay for this channel.

Definition at line 225 of file lr-wpan-helper.h.

References m_propagationDelay.

Referenced by LrWpanAckTestCase::DoRun(), and Install().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channel

Ptr<SpectrumChannel> ns3::LrWpanHelper::m_channel
private

channel to be used for the devices

Definition at line 206 of file lr-wpan-helper.h.

Referenced by ~LrWpanHelper(), GetChannel(), Install(), SetChannel(), and SetChannel().

◆ m_propagationDelay

ObjectFactory ns3::LrWpanHelper::m_propagationDelay
private

propagation delay model

Definition at line 209 of file lr-wpan-helper.h.

Referenced by Install(), and SetPropagationDelayModel().

◆ m_propagationLoss

std::vector<ObjectFactory> ns3::LrWpanHelper::m_propagationLoss
private

vector of propagation loss models

Definition at line 208 of file lr-wpan-helper.h.

Referenced by AddPropagationLossModel(), and Install().

◆ m_useMultiModelSpectrumChannel

bool ns3::LrWpanHelper::m_useMultiModelSpectrumChannel
private

indicates whether a MultiModelSpectrumChannel is used

Definition at line 207 of file lr-wpan-helper.h.

Referenced by LrWpanHelper(), LrWpanHelper(), and Install().


The documentation for this class was generated from the following files: