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>
54 void DoRun()
override;
60 :
TestCase(
"Test the 802.15.4 collision handling")
94 CreateObject<LogDistancePropagationLossModel>();
96 CreateObject<ConstantSpeedPropagationDelayModel>();
97 channel->AddPropagationLossModel(propModel);
98 channel->SetPropagationDelayModel(delayModel);
100 dev0->SetChannel(channel);
101 dev1->SetChannel(channel);
102 dev2->SetChannel(channel);
110 CreateObject<ConstantPositionMobilityModel>();
111 sender0Mobility->SetPosition(Vector(0, 0, 0));
112 dev0->GetPhy()->SetMobility(sender0Mobility);
113 n0->AggregateObject(sender0Mobility);
116 CreateObject<ConstantPositionMobilityModel>();
118 sender1Mobility->SetPosition(Vector(0, 1, 0));
119 dev1->GetPhy()->SetMobility(sender1Mobility);
120 n1->AggregateObject(sender1Mobility);
123 CreateObject<ConstantPositionMobilityModel>();
125 sender2Mobility->SetPosition(Vector(30, 0, 0));
126 dev2->GetPhy()->SetMobility(sender2Mobility);
127 n2->AggregateObject(sender2Mobility);
129 dev0->GetMac()->SetMcpsDataIndicationCallback(
133 dev0->GetCsmaCa()->SetMacMinBE(0);
134 dev1->GetCsmaCa()->SetMacMinBE(0);
135 dev2->GetCsmaCa()->SetMacMinBE(0);
144 params.m_dstPanId = 0;
145 params.m_msduHandle = 0;
149 std::cout <<
"*** First test " << std::endl;
162 std::cout <<
"*** Second test " << std::endl;
177 std::cout <<
"*** Third test " << std::endl;
179 params.m_txOptions = 0;
193 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
197 std::cout <<
"*** Fourth test " << std::endl;
209 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()
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.
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, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.