|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
29 #include <ns3/core-module.h>
30 #include <ns3/lr-wpan-module.h>
31 #include <ns3/propagation-loss-model.h>
32 #include <ns3/propagation-delay-model.h>
33 #include <ns3/simulator.h>
34 #include <ns3/single-model-spectrum-channel.h>
35 #include <ns3/constant-position-mobility-model.h>
36 #include <ns3/packet.h>
75 int main (
int argc,
char *argv[])
82 cmd.AddValue (
"verbose",
"turn on all log components",
verbose);
83 cmd.AddValue (
"extended",
"use extended addressing",
extended);
85 cmd.Parse (argc, argv);
120 channel->AddPropagationLossModel (propModel);
121 channel->SetPropagationDelayModel (delayModel);
136 dev0->
GetPhy ()->SetMobility (sender0Mobility);
140 dev1->
GetPhy ()->SetMobility (sender1Mobility);
144 dev0->
GetMac ()->SetMcpsDataConfirmCallback (cb0);
148 dev0->
GetMac ()->SetMcpsDataIndicationCallback (cb1);
152 dev1->
GetMac ()->SetMcpsDataConfirmCallback (cb2);
156 dev1->
GetMac ()->SetMcpsDataIndicationCallback (cb3);
159 lrWpanHelper.
EnablePcapAll (std::string (
"lr-wpan-data"),
true);
187 dev0->
GetMac (), params, p0);
201 dev1->
GetMac (), params, p2);
helps to manage and create IEEE 802.15.4 NetDevice objects
static void DataConfirm(McpsDataConfirmParams params)
Function called when a Data confirm is invoked.
Parse command-line arguments.
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ TX_OPTION_ACK
TX_OPTION_ACK.
This class can contain 16 bit addresses.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
uint16_t m_dstPanId
Destination PAN identifier.
static void StateChangeNotification(std::string context, Time now, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
Function called when a the PHY state changes.
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
void SetPosition(const Vector &position)
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
uint8_t m_txOptions
Tx Options (bitfield)
Mac64Address m_dstExtAddr
Destination extended address.
static void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when a Data indication is invoked.
MCPS-DATA.confirm params.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Simulation virtual time values and global simulation resolution.
void EnableLogComponents(void)
Helper to enable all LrWpan log components with one statement.
static std::string LrWpanPhyEnumerationPrinter(LrWpanPhyEnumeration e)
Transform the LrWpanPhyEnumeration enumeration into a printable string.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static void Run(void)
Run the simulation.
Manage ASCII trace files for device models.
MCPS-DATA.indication params.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
LrWpanMcpsDataConfirmStatus m_status
The status of the last MSDU transmission.
LrWpanAddressMode m_srcAddrMode
Source address mode.
Mac16Address m_dstAddr
Destination address.
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress ()
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p)
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
MCPS-DATA.request params.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
uint8_t m_msduHandle
MSDU handle.