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>
72 if (params.m_status == MacStatus::SUCCESS)
75 << device->GetMac()->GetShortAddress() <<
" | "
76 << device->GetMac()->GetExtendedAddress()
77 <<
"] MLME-SCAN.confirm: Active scan status SUCCESSFUL "
78 <<
"(Coordinator found and address assigned) \n";
80 else if (params.m_status == MacStatus::NO_BEACON)
83 << device->GetMac()->GetShortAddress() <<
" | "
84 << device->GetMac()->GetExtendedAddress()
85 <<
"] MLME-SCAN.confirm: Could not locate coordinator "
86 <<
"(Coord realignment command not received) "
87 <<
"status: " << params.m_status <<
"\n";
92 << device->GetMac()->GetShortAddress() <<
" | "
93 << device->GetMac()->GetExtendedAddress()
94 <<
"] MLME-SCAN.confirm: An error occurred during scanning, "
95 <<
"status: " << params.m_status <<
"\n";
108 << device->GetMac()->GetShortAddress() <<
" | "
109 << device->GetMac()->GetExtendedAddress()
110 <<
"] MLME-ORPHAN.indication: Orphan Notification received, processing...\n";
121main(
int argc,
char* argv[])
127 Ptr<Node> endNode = CreateObject<Node>();
134 coord1NetDevice->GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:01"));
135 coord1NetDevice->GetMac()->SetShortAddress(
Mac16Address(
"00:01"));
139 endNodeNetDevice->GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:02"));
144 CreateObject<LogDistancePropagationLossModel>();
146 CreateObject<ConstantSpeedPropagationDelayModel>();
147 channel->AddPropagationLossModel(propModel);
148 channel->SetPropagationDelayModel(delayModel);
150 coord1NetDevice->SetChannel(channel);
151 endNodeNetDevice->SetChannel(channel);
153 coord1->AddDevice(coord1NetDevice);
154 endNode->AddDevice(endNodeNetDevice);
158 CreateObject<ConstantPositionMobilityModel>();
159 coord1Mobility->SetPosition(Vector(0, 0, 0));
160 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
163 CreateObject<ConstantPositionMobilityModel>();
164 endNodeMobility->SetPosition(Vector(100, 0, 0));
165 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
168 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(
171 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(
189 coord1NetDevice->GetMac(),
208 endNodeNetDevice->GetMac(),
This class can contain 16 bit addresses.
Smart pointer class similar to boost::intrusive_ptr.
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.
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...
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...
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.
FtrParams 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.
bool m_assocMember
T = allocated with this coord | F = otherwise.
Mac64Address m_orphanAddr
The address of the orphaned device.
Mac16Address m_shortAddr
The short address allocated.
MLME-SCAN.confirm params.
MLME-SCAN.request params.
MlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
uint32_t m_scanChannels
The channel numbers to be scanned.
uint32_t m_chPage
The channel page on which to perform scan.
MLME-START.request params.