35#include <ns3/constant-position-mobility-model.h>
36#include <ns3/core-module.h>
38#include <ns3/lr-wpan-module.h>
39#include <ns3/packet.h>
40#include <ns3/propagation-delay-model.h>
41#include <ns3/propagation-loss-model.h>
42#include <ns3/simulator.h>
43#include <ns3/single-model-spectrum-channel.h>
53 <<
" secs | Received BEACON packet of size " << p->
GetSize());
60 <<
" secs | Received DATA packet of size " << p->
GetSize());
78 <<
"s Coordinator Received DATA packet (size " << p->
GetSize() <<
" bytes)");
91main(
int argc,
char* argv[])
112 CreateObject<LogDistancePropagationLossModel>();
114 CreateObject<ConstantSpeedPropagationDelayModel>();
115 channel->AddPropagationLossModel(propModel);
116 channel->SetPropagationDelayModel(delayModel);
126 CreateObject<ConstantPositionMobilityModel>();
127 sender0Mobility->SetPosition(
Vector(0, 0, 0));
128 dev0->
GetPhy()->SetMobility(sender0Mobility);
130 CreateObject<ConstantPositionMobilityModel>();
132 sender1Mobility->SetPosition(
Vector(0, 10, 0));
133 dev1->
GetPhy()->SetMobility(sender1Mobility);
139 dev0->
GetMac()->SetMlmeStartConfirmCallback(cb0);
143 dev1->
GetMac()->SetMcpsDataConfirmCallback(cb1);
147 dev1->
GetMac()->SetMlmeBeaconNotifyIndicationCallback(cb3);
151 dev1->
GetMac()->SetMcpsDataIndicationCallback(cb4);
155 dev0->
GetMac()->SetMcpsDataIndicationCallback(cb5);
164 dev1->
GetMac()->SetPanId(5);
174 Simulator::ScheduleWithContext(1,
176 &LrWpanMac::MlmeStartRequest,
206 Simulator::ScheduleWithContext(1,
208 &LrWpanMac::McpsDataRequest,
216 Simulator::Destroy();
helps to manage and create IEEE 802.15.4 NetDevice objects
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.
void SetAddress(Address address) override
This method indirects to LrWpanMac::SetShortAddress ()
This class can contain 16 bit addresses.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void DataIndicationCoordinator(McpsDataIndicationParams params, Ptr< Packet > p)
static void StartConfirm(MlmeStartConfirmParams params)
static void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
static void TransEndIndication(McpsDataConfirmParams params)
static void BeaconIndication(MlmeBeaconNotifyIndicationParams params, Ptr< Packet > p)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_LEVEL_INFO
LOG_INFO and above.
void LogComponentEnable(const char *name, enum LogLevel level)
Enable the logging output associated with that log component.
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
MCPS-DATA.confirm params.
LrWpanMcpsDataConfirmStatus m_status
The status of the last MSDU transmission.
MCPS-DATA.indication params.
MCPS-DATA.request params.
LrWpanAddressMode m_srcAddrMode
Source address mode.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
uint16_t m_dstPanId
Destination PAN identifier.
Mac16Address m_dstAddr
Destination address.
uint8_t m_msduHandle
MSDU handle.
MLME-BEACON-NOTIFY.indication params.
MLME-START.confirm params.
LrWpanMlmeStartConfirmStatus m_status
The status of a MLME-start.request.
MLME-START.request params.
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.