54 #include <ns3/constant-position-mobility-model.h>
55 #include <ns3/core-module.h>
57 #include <ns3/lr-wpan-module.h>
58 #include <ns3/packet.h>
59 #include <ns3/propagation-delay-model.h>
60 #include <ns3/propagation-loss-model.h>
61 #include <ns3/simulator.h>
62 #include <ns3/single-model-spectrum-channel.h>
74 << device->
GetMac()->GetShortAddress() <<
" | "
75 << device->
GetMac()->GetExtendedAddress()
76 <<
"] MLME-SCAN.confirm: Active scan status SUCCESSFUL "
77 <<
"(Coordinator found and address assigned) \n";
82 << device->
GetMac()->GetShortAddress() <<
" | "
83 << device->
GetMac()->GetExtendedAddress()
84 <<
"] MLME-SCAN.confirm: Could not locate coordinator "
85 <<
"(Coord realignment command not received) "
86 <<
"status: " <<
params.m_status <<
"\n";
91 << device->
GetMac()->GetShortAddress() <<
" | "
92 << device->
GetMac()->GetExtendedAddress()
93 <<
"] MLME-SCAN.confirm: An error occurred during scanning, "
94 <<
"status: " <<
params.m_status <<
"\n";
107 << device->
GetMac()->GetShortAddress() <<
" | "
108 << device->
GetMac()->GetExtendedAddress()
109 <<
"] MLME-ORPHAN.indication: Orphan Notification received, processing...\n";
120 main(
int argc,
char* argv[])
126 Ptr<Node> endNode = CreateObject<Node>();
133 coord1NetDevice->
GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:01"));
138 endNodeNetDevice->
GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:02"));
143 CreateObject<LogDistancePropagationLossModel>();
145 CreateObject<ConstantSpeedPropagationDelayModel>();
146 channel->AddPropagationLossModel(propModel);
147 channel->SetPropagationDelayModel(delayModel);
157 CreateObject<ConstantPositionMobilityModel>();
158 coord1Mobility->SetPosition(Vector(0, 0, 0));
159 coord1NetDevice->
GetPhy()->SetMobility(coord1Mobility);
162 CreateObject<ConstantPositionMobilityModel>();
163 endNodeMobility->SetPosition(Vector(100, 0, 0));
164 endNodeNetDevice->
GetPhy()->SetMobility(endNodeMobility);
167 endNodeNetDevice->
GetMac()->SetMlmeScanConfirmCallback(
170 coord1NetDevice->
GetMac()->SetMlmeOrphanIndicationCallback(
188 coord1NetDevice->
GetMac(),
207 endNodeNetDevice->
GetMac(),
void MlmeScanRequest(MlmeScanRequestParams params) override
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
void MlmeStartRequest(MlmeStartRequestParams params) override
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
void MlmeOrphanResponse(MlmeOrphanResponseParams params) override
IEEE 802.15.4-2011, section 6.2.7.2 MLME-ORPHAN.response Primitive used to initiatte a response to an...
Ptr< Node > GetNode() const override
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
This class can contain 16 bit addresses.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
@ NO_BEACON
A scan operation failed to find any network beacons.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void OrphanIndication(Ptr< LrWpanNetDevice > device, MlmeOrphanIndicationParams params)
static void ScanConfirm(Ptr< LrWpanNetDevice > device, MlmeScanConfirmParams params)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LogLevel
Logging severity classes and levels.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MLME-ORPHAN.indication params.
MLME-ORPHAN.response params.
Mac16Address m_shortAddr
The short address allocated.
Mac64Address m_orphanAddr
The address of the orphaned device.
bool m_assocMember
T = allocated with this coord | F = otherwise.
MLME-SCAN.confirm params.
MLME-SCAN.request params.
uint32_t m_scanChannels
The channel numbers to be scanned.
uint32_t m_chPage
The channel page on which to perform scan.
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
MLME-START.request params.