42#include <ns3/constant-position-mobility-model.h>
43#include <ns3/core-module.h>
45#include <ns3/lr-wpan-module.h>
46#include <ns3/packet.h>
47#include <ns3/propagation-delay-model.h>
48#include <ns3/propagation-loss-model.h>
49#include <ns3/simulator.h>
50#include <ns3/single-model-spectrum-channel.h>
63 if (!params.m_panDescList.empty())
65 std::cout <<
"Device [" << device->GetMac()->GetShortAddress()
66 <<
"] found the following PANs:\n";
67 for (
long unsigned int i = 0; i < params.m_panDescList.size(); i++)
69 std::cout <<
"PAN DESCRIPTOR " << i <<
":\n"
70 <<
"Pan Id: " << params.m_panDescList[i].m_coorPanId
71 <<
"\nChannel: " <<
static_cast<uint32_t>(params.m_panDescList[i].m_logCh)
73 <<
static_cast<uint32_t>(params.m_panDescList[i].m_linkQuality)
74 <<
"\nCoordinator Short Address: "
75 << params.m_panDescList[i].m_coorShortAddr <<
"\n\n";
80 std::cout <<
"No PANs found (Could not find any beacons)\n";
85 std::cout <<
"Something went wrong, scan could not be completed\n";
90main(
int argc,
char* argv[])
110 CreateObject<LogDistancePropagationLossModel>();
112 CreateObject<ConstantSpeedPropagationDelayModel>();
113 channel->AddPropagationLossModel(propModel);
114 channel->SetPropagationDelayModel(delayModel);
116 coord1NetDevice->SetChannel(channel);
117 endNodeNetDevice->SetChannel(channel);
118 coord2NetDevice->SetChannel(channel);
120 coord1->AddDevice(coord1NetDevice);
121 endNode->AddDevice(endNodeNetDevice);
122 coord2->AddDevice(coord2NetDevice);
126 CreateObject<ConstantPositionMobilityModel>();
127 coord1Mobility->SetPosition(Vector(0, 0, 0));
128 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
131 CreateObject<ConstantPositionMobilityModel>();
132 endNodeMobility->SetPosition(Vector(100, 0, 0));
133 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
136 CreateObject<ConstantPositionMobilityModel>();
137 coord2Mobility->SetPosition(Vector(206, 0, 0));
138 coord2NetDevice->GetPhy()->SetMobility(coord2Mobility);
141 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(
159 coord1NetDevice->GetMac(),
173 coord2NetDevice->GetMac(),
190 endNodeNetDevice->GetMac(),
void MlmeStartRequest(MlmeStartRequestParams params)
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
void MlmeScanRequest(MlmeScanRequestParams params)
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
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 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.
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 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-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.
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
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.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
bool m_panCoor
On true this device will become coordinator.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
uint16_t m_PanId
Pan Identifier used by the device.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.