43#include <ns3/constant-position-mobility-model.h>
44#include <ns3/core-module.h>
46#include <ns3/lr-wpan-module.h>
47#include <ns3/packet.h>
48#include <ns3/propagation-delay-model.h>
49#include <ns3/propagation-loss-model.h>
50#include <ns3/simulator.h>
51#include <ns3/single-model-spectrum-channel.h>
61 if (params.m_status == MacStatus::SUCCESS)
64 << device->GetMac()->GetShortAddress() <<
" | "
65 << device->GetMac()->GetExtendedAddress()
66 <<
"] MLME-SCAN.confirm: Active scan status SUCCESSFUL "
67 <<
"(Coordinator found and address assigned) \n";
69 else if (params.m_status == MacStatus::NO_BEACON)
72 << device->GetMac()->GetShortAddress() <<
" | "
73 << device->GetMac()->GetExtendedAddress()
74 <<
"] MLME-SCAN.confirm: Could not locate coordinator "
75 <<
"(Coord realignment command not received) "
76 <<
"status: " << params.m_status <<
"\n";
81 << device->GetMac()->GetShortAddress() <<
" | "
82 << device->GetMac()->GetExtendedAddress()
83 <<
"] MLME-SCAN.confirm: An error occurred during scanning, "
84 <<
"status: " << params.m_status <<
"\n";
97 << device->GetMac()->GetShortAddress() <<
" | "
98 << device->GetMac()->GetExtendedAddress()
99 <<
"] MLME-ORPHAN.indication: Orphan Notification received, processing...\n";
110main(
int argc,
char* argv[])
123 coord1NetDevice->GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:01"));
124 coord1NetDevice->GetMac()->SetShortAddress(
Mac16Address(
"00:01"));
128 endNodeNetDevice->GetMac()->SetExtendedAddress(
Mac64Address(
"00:00:00:00:00:00:00:02"));
136 channel->AddPropagationLossModel(propModel);
137 channel->SetPropagationDelayModel(delayModel);
139 coord1NetDevice->SetChannel(channel);
140 endNodeNetDevice->SetChannel(channel);
142 coord1->AddDevice(coord1NetDevice);
143 endNode->AddDevice(endNodeNetDevice);
148 coord1Mobility->SetPosition(Vector(0, 0, 0));
149 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
153 endNodeMobility->SetPosition(Vector(100, 0, 0));
154 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
157 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(
160 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(
178 coord1NetDevice->GetMac(),
197 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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
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.
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.