A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::BleHelper Class Reference

helps to manage and create BLE NetDevice objects and work with a group of device at once. More...

#include "ble-helper.h"

+ Inheritance diagram for ns3::BleHelper:
+ Collaboration diagram for ns3::BleHelper:

Public Member Functions

 BleHelper (void)
 Create a Ble Helper in an empty state. More...
 
virtual ~BleHelper (void)
 
void AddMobility (Ptr< BlePhy > phy, Ptr< MobilityModel > m)
 Add MobilityModel to a physical device. More...
 
void AllocateAddress (NetDeviceContainer c, Mac48Address addr)
 Allocate address to all Nodes. More...
 
void EnableLogComponents (void)
 Helper to enable all BLE log components with one statement. More...
 
Ptr< SpectrumChannelGetChannel (void)
 Get the channel associated to this helper. More...
 
NetDeviceContainer Install (NodeContainer c, BleLinkLayer::BleLinkLayerDeviceTypes type)
 Install a BleNetdevice and the assocuiated structures (e.g. More...
 
void SetChannel (Ptr< SpectrumChannel > channel)
 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, 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, 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, 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 (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false)
 Enable ascii trace output on the indicated net device. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd)
 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 (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 (std::string prefix, NetDeviceContainer d)
 Enable ascii trace output on each device in the container which is of the appropriate type. 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 (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 (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 (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 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 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...
 
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...
 

Static Public Member Functions

static std::string BleLinkLayerRolePrinter (BleLinkLayer::BleLinkLayerRole e)
 
static std::string BlePhyStatePrinter (BlePhy::BlePhyState e)
 Transform the BlePhy States into a printable strings. More...
 

Private Member Functions

 BleHelper (BleHelper 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 promiscous, bool explicitFilename)
 Enable pcap output on the indicated netdevice. More...
 
BleHelperoperator= (BleHelper const &)
 Copy Constructor - defined and not implemented. More...
 

Private Attributes

Ptr< SpectrumChannelm_channel
 channel to be used for the devices More...
 

Detailed Description

helps to manage and create BLE NetDevice objects and work with a group of device at once.

This class can help to create BLE NetDevice objects and configure their attributes during the creation. It also contains additional helper functions that can be used by user.

Definition at line 44 of file ble-helper.h.

Constructor & Destructor Documentation

ns3::BleHelper::BleHelper ( void  )

Create a Ble Helper in an empty state.

Output an ascii line representing the Transmit event (with context)

By default, a SingleModelSpectrumChannel is created with a log distance propagation loss model and a ConstantPositionPropagationDelayModel. To change the channel models, loss models, or delay model,the Get/Set Channel methods may be used.

Parameters
streamthe output stream
contextthe context
pthe packet Output an ascii line representing the Transmit event (without context)
streamthe output stream
pthe packet

Definition at line 60 of file ble-helper.cc.

References m_channel, and NS_LOG_FUNCTION.

ns3::BleHelper::~BleHelper ( void  )
virtual

Definition at line 71 of file ble-helper.cc.

References m_channel, and NS_LOG_FUNCTION.

ns3::BleHelper::BleHelper ( BleHelper const &  )
private

Copy Constructor - defined and not implemented.

Member Function Documentation

void ns3::BleHelper::AddMobility ( Ptr< BlePhy phy,
Ptr< MobilityModel m 
)

Add MobilityModel to a physical device.

Parameters
phythe physical device
mthe mobility model

Definition at line 150 of file ble-helper.cc.

void ns3::BleHelper::AllocateAddress ( NetDeviceContainer  c,
Mac48Address  addr 
)

Allocate address to all Nodes.

Parameters
cNetDevice Container
addrObject of Mac48Address class User same addr object to allocate addresses on same system.

Definition at line 211 of file ble-helper.cc.

References ns3::Mac48Address::Allocate(), ns3::NetDeviceContainer::Begin(), ns3::NetDeviceContainer::End(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

std::string ns3::BleHelper::BlePhyStatePrinter ( BlePhy::BlePhyState  e)
static

Transform the BlePhy States into a printable strings.

Parameters
ethe BlePhyState
Returns
the string

Definition at line 106 of file ble-helper.cc.

References ns3::BlePhy::BUSY_RX, ns3::BlePhy::BUSY_TX, ns3::BlePhy::IDLE, ns3::BlePhy::LISTEN, ns3::BlePhy::OFF, and ns3::BlePhy::TRANS.

void ns3::BleHelper::EnableAsciiInternal ( Ptr< OutputStreamWrapper stream,
std::string  prefix,
Ptr< NetDevice nd,
bool  explicitFilename 
)
privatevirtual

Enable ascii trace output on the indicated net device.

Net Device 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

Implements ns3::AsciiTraceHelperForDevice.

Definition at line 253 of file ble-helper.cc.

References ns3::AsciiBleLinkLayerTransmitSinkWithContext(), ns3::AsciiBleLinkLayerTransmitSinkWithoutContext(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::AsciiTraceHelper::DefaultDropSinkWithContext(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(), ns3::Packet::EnablePrinting(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), NS_LOG_FUNCTION, and NS_LOG_INFO.

+ Here is the call graph for this function:

void ns3::BleHelper::EnableLogComponents ( void  )

Helper to enable all BLE log components with one statement.

Definition at line 93 of file ble-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:

void ns3::BleHelper::EnablePcapInternal ( std::string  prefix,
Ptr< NetDevice nd,
bool  promiscous,
bool  explicitFilename 
)
privatevirtual

Enable pcap output on the indicated netdevice.

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

Parameters
prefixFilename prefix to use for pcap files.
ndNetDevice for which you want to use for pcap files.
promiscousIf tru capture all possible packets available at the device.

Implements ns3::PcapHelperForDevice.

Definition at line 345 of file ble-helper.cc.

References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_BLUETOOTH_LE_LL, ns3::PcapHelper::GetFilenameFromDevice(), ns3::MakeBoundCallback(), NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::PcapSniffBle().

+ Here is the call graph for this function:

Ptr< SpectrumChannel > ns3::BleHelper::GetChannel ( void  )

Get the channel associated to this helper.

Returns
Pointer to the SpectrumChannel object

Definition at line 86 of file ble-helper.cc.

References m_channel, and NS_LOG_FUNCTION.

NetDeviceContainer ns3::BleHelper::Install ( NodeContainer  c,
BleLinkLayer::BleLinkLayerDeviceTypes  type 
)

Install a BleNetdevice and the assocuiated structures (e.g.

channel, LinkLayer, PhyDevices in the nodes.

Parameters
ca set of nodes
typeType of device
Returns
A container of the added net devices

Definition at line 156 of file ble-helper.cc.

References ns3::NetDeviceContainer::Add(), ns3::BleSensorApplication::ADVERTISE, ns3::NodeContainer::Begin(), ns3::BleLinkLayer::CENTRAL, first::devices, ns3::NodeContainer::End(), m_channel, third::phy, and ns3::BleSensorApplication::SCANNING.

+ Here is the call graph for this function:

BleHelper& ns3::BleHelper::operator= ( BleHelper const &  )
private

Copy Constructor - defined and not implemented.

Returns
void ns3::BleHelper::SetChannel ( Ptr< SpectrumChannel channel)

Set the channel associated to this helper.

Parameters
channelPointer to SpectrumChannel object

Definition at line 79 of file ble-helper.cc.

References third::channel, m_channel, and NS_LOG_FUNCTION.

Member Data Documentation

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

channel to be used for the devices

Definition at line 139 of file ble-helper.h.

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


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