|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include <ns3/core-module.h>
24 #include <ns3/lr-wpan-module.h>
25 #include <ns3/propagation-loss-model.h>
26 #include <ns3/propagation-delay-model.h>
27 #include <ns3/simulator.h>
28 #include <ns3/single-model-spectrum-channel.h>
29 #include <ns3/constant-position-mobility-model.h>
30 #include <ns3/packet.h>
31 #include "ns3/rng-seed-manager.h"
106 virtual void DoRun (
void);
179 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest,
180 dev->
GetMac (), params1,p0);
225 channel->AddPropagationLossModel (propModel);
226 channel->SetPropagationDelayModel (delayModel);
243 dev0->
GetPhy ()->SetMobility (sender0Mobility);
247 dev1->
GetPhy ()->SetMobility (sender1Mobility);
251 dev0->
GetMac ()->SetMcpsDataConfirmCallback (cb0);
255 dev1->
GetMac ()->SetMcpsDataConfirmCallback (cb1);
270 Simulator::ScheduleWithContext (1,
Seconds (0.0),
271 &LrWpanMac::McpsDataRequest,
272 dev0->
GetMac (), params, p0);
282 std::cout <<
"----------------------------------\n";
286 p0 = Create<Packet> (6);
288 Simulator::ScheduleWithContext (1,
Seconds (0.0),
289 &LrWpanMac::McpsDataRequest,
290 dev0->
GetMac (), params, p0);
300 std::cout <<
"----------------------------------\n";
305 p0 = Create<Packet> (2);
307 Simulator::ScheduleWithContext (1,
Seconds (0.0),
308 &LrWpanMac::McpsDataRequest,
309 dev0->
GetMac (), params, p0);
318 std::cout <<
"----------------------------------\n";
323 p0 = Create<Packet> (6);
325 Simulator::ScheduleWithContext (1,
Seconds (0.0),
326 &LrWpanMac::McpsDataRequest,
327 dev0->
GetMac (), params, p0);
337 std::cout <<
"----------------------------------\n";
352 p0 = Create<Packet> (50);
359 Simulator::ScheduleWithContext (1,
Seconds (0.0),
360 &LrWpanMac::McpsDataRequest,
361 dev0->
GetMac (), params, p0);
369 Simulator::Destroy ();
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static void DataConfirm(McpsDataConfirmParams params)
Function called when a Data confirm is invoked.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
virtual ~LrWpanDataIfsTestCase()
bool IsBroadcast(void) const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ TX_OPTION_ACK
TX_OPTION_ACK.
static void DataReceivedDev1(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet >)
Function called when DataConfirm is hit.
This class can contain 16 bit addresses.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
uint16_t m_dstPanId
Destination PAN identifier.
static void PhyDataRxStart(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when PhyDataRxStart is hit.
void SetPosition(const Vector &position)
void LogComponentEnable(char const *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.
Ptr< LrWpanCsmaCa > GetCsmaCa(void) const
Get the CSMA/CA implementation used by this NetDevice.
uint8_t m_txOptions
Tx Options (bitfield)
Time m_lastTxTime
The time of the last transmitted packet.
static void IfsEnd(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Time IfsTime)
Function called when the IFS ends.
MCPS-DATA.confirm params.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time m_ackRxTime
The time of the received acknowledgment.
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Simulation virtual time values and global simulation resolution.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Time m_phyStartRx
The time the phy start receiving a packet.
static LrWpanIfsTestSuite lrWpanIfsTestSuite
Static variable for test initialization.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
static void DataReceivedDev0(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when DataReceived is hit.
Time m_endIfs
The time where the Interframe Space ended.
Time Seconds(double value)
Construct a Time in the indicated unit.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
LrWpan Dataframe transmission with Interframe Space.
LrWpanAddressMode m_srcAddrMode
Source address mode.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Mac16Address m_dstAddr
Destination address.
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress ()
MCPS-DATA.request params.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static void DataConfirm(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params)
Function called when DataConfirm is hit.
uint8_t m_msduHandle
MSDU handle.