21#include <ns3/lr-wpan-module.h>
22#include <ns3/mac16-address.h>
23#include <ns3/mac64-address.h>
24#include <ns3/mobility-module.h>
25#include <ns3/packet.h>
26#include <ns3/propagation-module.h>
27#include <ns3/spectrum-module.h>
55 void DoRun()
override;
61 :
TestCase(
"Test the 802.15.4 collision handling")
95 CreateObject<LogDistancePropagationLossModel>();
97 CreateObject<ConstantSpeedPropagationDelayModel>();
98 channel->AddPropagationLossModel(propModel);
99 channel->SetPropagationDelayModel(delayModel);
101 dev0->SetChannel(channel);
102 dev1->SetChannel(channel);
103 dev2->SetChannel(channel);
111 CreateObject<ConstantPositionMobilityModel>();
112 sender0Mobility->SetPosition(Vector(0, 0, 0));
113 dev0->GetPhy()->SetMobility(sender0Mobility);
114 n0->AggregateObject(sender0Mobility);
117 CreateObject<ConstantPositionMobilityModel>();
119 sender1Mobility->SetPosition(Vector(0, 1, 0));
120 dev1->GetPhy()->SetMobility(sender1Mobility);
121 n1->AggregateObject(sender1Mobility);
124 CreateObject<ConstantPositionMobilityModel>();
126 sender2Mobility->SetPosition(Vector(30, 0, 0));
127 dev2->GetPhy()->SetMobility(sender2Mobility);
128 n2->AggregateObject(sender2Mobility);
130 dev0->GetMac()->SetMcpsDataIndicationCallback(
134 dev0->GetCsmaCa()->SetMacMinBE(0);
135 dev1->GetCsmaCa()->SetMacMinBE(0);
136 dev2->GetCsmaCa()->SetMacMinBE(0);
145 params.m_dstPanId = 0;
146 params.m_msduHandle = 0;
150 std::cout <<
"*** First test " << std::endl;
163 std::cout <<
"*** Second test " << std::endl;
178 std::cout <<
"*** Third test " << std::endl;
180 params.m_txOptions = 0;
194 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
198 std::cout <<
"*** Fourth test " << std::endl;
210 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.
#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.