helps to manage and create IEEE 802.15.4 NetDevice objects More...
#include "lr-wpan-helper.h"
Public Member Functions | |
LrWpanHelper (bool useMultiModelSpectrumChannel) | |
Create a LrWpan helper in an empty state with either a SingleModelSpectrumChannel or a MultiModelSpectrumChannel. More... | |
LrWpanHelper (void) | |
Create a LrWpan helper in an empty state. More... | |
virtual | ~LrWpanHelper (void) |
void | AddMobility (Ptr< LrWpanPhy > phy, Ptr< MobilityModel > m) |
Add mobility model to a physical device. More... | |
int64_t | AssignStreams (NetDeviceContainer c, int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
void | AssociateToBeaconPan (NetDeviceContainer c, uint16_t panId, Mac16Address coor, uint8_t bcnOrd, uint8_t sfrmOrd) |
Associate the nodes to the same PAN and initiate beacon enabled mode. More... | |
void | AssociateToPan (NetDeviceContainer c, uint16_t panId) |
Associate the nodes to the same PAN. More... | |
void | EnableLogComponents (void) |
Helper to enable all LrWpan log components with one statement. More... | |
Ptr< SpectrumChannel > | GetChannel (void) |
Get the channel associated to this helper. More... | |
NetDeviceContainer | Install (NodeContainer c) |
Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes. More... | |
void | SetChannel (Ptr< SpectrumChannel > channel) |
Set the channel associated to this helper. More... | |
void | SetChannel (std::string channelName) |
Set the channel associated to this helper. More... | |
Public Member Functions inherited from ns3::PcapHelperForDevice | |
PcapHelperForDevice () | |
Construct a PcapHelperForDevice. More... | |
virtual | ~PcapHelperForDevice () |
Destroy a PcapHelperForDevice. More... | |
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. More... | |
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. More... | |
void | EnablePcap (std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false) |
Enable pcap output the indicated net device. More... | |
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. More... | |
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. More... | |
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. More... | |
Public Member Functions inherited from ns3::AsciiTraceHelperForDevice | |
AsciiTraceHelperForDevice () | |
Construct an AsciiTraceHelperForDevice. More... | |
virtual | ~AsciiTraceHelperForDevice () |
Destroy an AsciiTraceHelperForDevice. More... | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. More... | |
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. More... | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd) |
Enable ascii trace output on the indicated net device. More... | |
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. More... | |
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. More... | |
void | EnableAscii (std::string prefix, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. More... | |
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. More... | |
void | EnableAscii (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false) |
Enable ascii trace output on the indicated net device. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Static Public Member Functions | |
static std::string | LrWpanMacStatePrinter (LrWpanMacState e) |
Transform the LrWpanMacState enumeration into a printable string. More... | |
static std::string | LrWpanPhyEnumerationPrinter (LrWpanPhyEnumeration e) |
Transform the LrWpanPhyEnumeration enumeration into a printable string. More... | |
Private Member Functions | |
LrWpanHelper (LrWpanHelper const &) | |
Copy constructor - defined and not implemented. More... | |
virtual void | EnableAsciiInternal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) |
Enable ascii trace output on the indicated net device. More... | |
virtual void | EnablePcapInternal (std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) |
Enable pcap output on the indicated net device. More... | |
LrWpanHelper & | operator= (LrWpanHelper const &) |
Copy constructor - defined and not implemented. More... | |
Private Attributes | |
Ptr< SpectrumChannel > | m_channel |
channel to be used for the devices More... | |
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 49 of file lr-wpan-helper.h.
ns3::LrWpanHelper::LrWpanHelper | ( | void | ) |
Create a LrWpan helper in an empty state.
By default, a SingleModelSpectrumChannel is created, with a LogDistancePropagationLossModel and a ConstantSpeedPropagationDelayModel.
To change the channel type, loss model, or delay model, the Get/Set Channel methods may be used.
Definition at line 66 of file lr-wpan-helper.cc.
References m_channel.
ns3::LrWpanHelper::LrWpanHelper | ( | bool | useMultiModelSpectrumChannel | ) |
Create a LrWpan helper in an empty state with either a SingleModelSpectrumChannel or a MultiModelSpectrumChannel.
useMultiModelSpectrumChannel | use a MultiModelSpectrumChannel if true, a SingleModelSpectrumChannel otherwise |
A LogDistancePropagationLossModel and a ConstantSpeedPropagationDelayModel are added to the channel.
Definition at line 77 of file lr-wpan-helper.cc.
References m_channel.
|
virtual |
Definition at line 94 of file lr-wpan-helper.cc.
References m_channel.
|
private |
Copy constructor - defined and not implemented.
void ns3::LrWpanHelper::AddMobility | ( | Ptr< LrWpanPhy > | phy, |
Ptr< MobilityModel > | m | ||
) |
Add mobility model to a physical device.
phy | the physical device |
m | the mobility model |
Definition at line 170 of file lr-wpan-helper.cc.
References third::phy.
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.
c | NetDeviceContainer of the set of net devices for which the CsmaNetDevice should be modified to use a fixed stream |
stream | first stream index to use |
Definition at line 216 of file lr-wpan-helper.cc.
References ns3::LrWpanNetDevice::AssignStreams(), ns3::NetDeviceContainer::Begin(), and ns3::NetDeviceContainer::End().
void ns3::LrWpanHelper::AssociateToBeaconPan | ( | NetDeviceContainer | c, |
uint16_t | panId, | ||
Mac16Address | coor, | ||
uint8_t | bcnOrd, | ||
uint8_t | sfrmOrd | ||
) |
Associate the nodes to the same PAN and initiate beacon enabled mode.
c | a set of nodes |
panId | the PAN id |
coor | the address of the PAN coordinator |
bcnOrd | indicates the interval between beacons. The value must be an int between 0 and 14. |
sfrmOrd | indicates the length of the superframe. The value must be an int between 0 and 14 and less or equal to the bcnOrd |
Definition at line 258 of file lr-wpan-helper.cc.
References first::address, ns3::NetDeviceContainer::Begin(), first::devices, ns3::NetDeviceContainer::End(), ns3::UniformRandomVariable::GetInteger(), ns3::LrWpanNetDevice::GetMac(), ns3::MlmeStartRequestParams::m_bcnOrd, ns3::MlmeStartRequestParams::m_panCoor, ns3::MlmeStartRequestParams::m_PanId, ns3::MlmeStartRequestParams::m_sfrmOrd, ns3::MilliSeconds(), ns3::LrWpanMac::MlmeStartRequest(), NS_LOG_DEBUG, and ns3::Simulator::Schedule().
void ns3::LrWpanHelper::AssociateToPan | ( | NetDeviceContainer | c, |
uint16_t | panId | ||
) |
Associate the nodes to the same PAN.
c | a set of nodes |
panId | the PAN Id |
Definition at line 233 of file lr-wpan-helper.cc.
References first::address, ns3::NetDeviceContainer::Begin(), first::devices, ns3::NetDeviceContainer::End(), and ns3::LrWpanNetDevice::GetMac().
|
privatevirtual |
Enable ascii trace output on the indicated net device.
NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.
stream | The output stream object to use when logging ascii traces. |
prefix | Filename prefix to use for ascii trace files. |
nd | Net device for which you want to enable tracing. |
explicitFilename | Treat the prefix as an explicit filename if true |
Implements ns3::AsciiTraceHelperForDevice.
Definition at line 373 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::Node::GetId(), ns3::NetDevice::GetIfIndex(), ns3::LrWpanNetDevice::GetMac(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), and NS_LOG_INFO.
void ns3::LrWpanHelper::EnableLogComponents | ( | void | ) |
Helper to enable all LrWpan log components with one statement.
Definition at line 101 of file lr-wpan-helper.cc.
References ns3::LOG_LEVEL_ALL, ns3::LOG_PREFIX_FUNC, ns3::LOG_PREFIX_TIME, ns3::LogComponentEnable(), and ns3::LogComponentEnableAll().
|
privatevirtual |
Enable pcap output on the indicated net device.
NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.
prefix | Filename prefix to use for pcap files. |
nd | Net device for which you want to enable tracing. |
promiscuous | If true capture all possible packets available at the device. |
explicitFilename | Treat the prefix as an explicit filename if true |
Implements ns3::PcapHelperForDevice.
Definition at line 326 of file lr-wpan-helper.cc.
References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_IEEE802_15_4, create-module::file, ns3::PcapHelper::GetFilenameFromDevice(), ns3::LrWpanNetDevice::GetMac(), ns3::Object::GetObject(), ns3::MakeBoundCallback(), NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::PcapSniffLrWpan().
Ptr< SpectrumChannel > ns3::LrWpanHelper::GetChannel | ( | void | ) |
Get the channel associated to this helper.
Definition at line 196 of file lr-wpan-helper.cc.
References m_channel.
NetDeviceContainer ns3::LrWpanHelper::Install | ( | NodeContainer | c | ) |
Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.
c | a set of nodes |
Definition at line 176 of file lr-wpan-helper.cc.
References ns3::Node::AddDevice(), ns3::NodeContainer::Begin(), first::devices, ns3::NodeContainer::End(), m_channel, ns3::LrWpanNetDevice::SetChannel(), and ns3::LrWpanNetDevice::SetNode().
|
static |
Transform the LrWpanMacState enumeration into a printable string.
e | the LrWpanMacState |
Definition at line 152 of file lr-wpan-helper.cc.
References ns3::CHANNEL_ACCESS_FAILURE, ns3::CHANNEL_IDLE, ns3::MAC_IDLE, and ns3::SET_PHY_TX_ON.
|
static |
Transform the LrWpanPhyEnumeration enumeration into a printable string.
e | the LrWpanPhyEnumeration |
Definition at line 116 of file lr-wpan-helper.cc.
References ns3::IEEE_802_15_4_PHY_BUSY, ns3::IEEE_802_15_4_PHY_BUSY_RX, ns3::IEEE_802_15_4_PHY_BUSY_TX, ns3::IEEE_802_15_4_PHY_FORCE_TRX_OFF, ns3::IEEE_802_15_4_PHY_IDLE, ns3::IEEE_802_15_4_PHY_INVALID_PARAMETER, ns3::IEEE_802_15_4_PHY_READ_ONLY, ns3::IEEE_802_15_4_PHY_RX_ON, ns3::IEEE_802_15_4_PHY_SUCCESS, ns3::IEEE_802_15_4_PHY_TRX_OFF, ns3::IEEE_802_15_4_PHY_TX_ON, ns3::IEEE_802_15_4_PHY_UNSPECIFIED, and ns3::IEEE_802_15_4_PHY_UNSUPPORTED_ATTRIBUTE.
Referenced by StateChangeNotification().
|
private |
Copy constructor - defined and not implemented.
void ns3::LrWpanHelper::SetChannel | ( | Ptr< SpectrumChannel > | channel | ) |
Set the channel associated to this helper.
channel | the channel |
Definition at line 202 of file lr-wpan-helper.cc.
References third::channel, and m_channel.
void ns3::LrWpanHelper::SetChannel | ( | std::string | channelName | ) |
Set the channel associated to this helper.
channelName | the channel name |
Definition at line 208 of file lr-wpan-helper.cc.
References third::channel, and m_channel.
|
private |
channel to be used for the devices
Definition at line 201 of file lr-wpan-helper.h.
Referenced by LrWpanHelper(), ~LrWpanHelper(), GetChannel(), Install(), and SetChannel().