10#include <ns3/lr-wpan-module.h>
11#include <ns3/mac16-address.h>
12#include <ns3/mac64-address.h>
13#include <ns3/mobility-module.h>
14#include <ns3/packet.h>
15#include <ns3/propagation-module.h>
16#include <ns3/spectrum-module.h>
44 void DoRun()
override;
50 :
TestCase(
"Test the 802.15.4 collision handling")
87 channel->AddPropagationLossModel(propModel);
88 channel->SetPropagationDelayModel(delayModel);
90 dev0->SetChannel(channel);
91 dev1->SetChannel(channel);
92 dev2->SetChannel(channel);
101 sender0Mobility->SetPosition(Vector(0, 0, 0));
102 dev0->GetPhy()->SetMobility(sender0Mobility);
103 n0->AggregateObject(sender0Mobility);
108 sender1Mobility->SetPosition(Vector(0, 1, 0));
109 dev1->GetPhy()->SetMobility(sender1Mobility);
110 n1->AggregateObject(sender1Mobility);
115 sender2Mobility->SetPosition(Vector(30, 0, 0));
116 dev2->GetPhy()->SetMobility(sender2Mobility);
117 n2->AggregateObject(sender2Mobility);
119 dev0->GetMac()->SetMcpsDataIndicationCallback(
123 dev0->GetCsmaCa()->SetMacMinBE(0);
124 dev1->GetCsmaCa()->SetMacMinBE(0);
125 dev2->GetCsmaCa()->SetMacMinBE(0);
134 params.m_dstPanId = 0;
135 params.m_msduHandle = 0;
139 std::cout <<
"*** First test " << std::endl;
152 std::cout <<
"*** Second test " << std::endl;
167 std::cout <<
"*** Third test " << std::endl;
169 params.m_txOptions = 0;
183 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
187 std::cout <<
"*** Fourth test " << std::endl;
199 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
void DoRun() override
Implementation to actually run this TestCase.
~LrWpanCollisionTestCase() override
uint8_t m_rxPackets
Rx packets counter.
void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when DataIndication is hit.
LrWpanCollisionTestCase()
LrWpan Collision TestSuite.
LrWpanCollisionTestSuite()
This class can contain 16 bit addresses.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p) override
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
@ TX_OPTION_ACK
TX_OPTION_ACK.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
static LrWpanCollisionTestSuite g_lrWpanCollisionTestSuite
Static variable for test initialization.
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...
MCPS-DATA.indication params.
MCPS-DATA.request params.