22 #include <ns3/packet.h>
23 #include <ns3/lr-wpan-module.h>
24 #include <ns3/mobility-module.h>
25 #include <ns3/propagation-module.h>
26 #include <ns3/spectrum-module.h>
27 #include <ns3/mac16-address.h>
28 #include <ns3/mac64-address.h>
55 virtual void DoRun (
void);
61 :
TestCase (
"Test the 802.15.4 collision handling")
97 channel->AddPropagationLossModel (propModel);
98 channel->SetPropagationDelayModel (delayModel);
110 sender0Mobility->SetPosition (Vector (0,0,0));
111 dev0->
GetPhy ()->SetMobility (sender0Mobility);
116 sender1Mobility->SetPosition (Vector (0,1,0));
117 dev1->
GetPhy ()->SetMobility (sender1Mobility);
122 sender2Mobility->SetPosition (Vector (30,0,0));
123 dev2->
GetPhy ()->SetMobility (sender2Mobility);
145 std::cout <<
"*** First test " << std::endl;
148 Simulator::Schedule (
Seconds (0.1),
149 &LrWpanMac::McpsDataRequest,
150 dev0->
GetMac (), params, p0);
153 Simulator::Schedule (
Seconds (0.1),
154 &LrWpanMac::McpsDataRequest,
155 dev1->
GetMac (), params, p1);
162 std::cout <<
"*** Second test " << std::endl;
167 Simulator::Schedule (
Seconds (0.1),
168 &LrWpanMac::McpsDataRequest,
169 dev0->
GetMac (), params, p0);
172 Simulator::Schedule (
Seconds (0.1),
173 &LrWpanMac::McpsDataRequest,
174 dev1->
GetMac (), params, p1);
181 std::cout <<
"*** Third test " << std::endl;
190 Simulator::Schedule (
Seconds (0.0001),
191 &LrWpanMac::McpsDataRequest,
192 dev2->
GetMac (), params, p2);
195 Simulator::Schedule (
Seconds (0.0002),
196 &LrWpanMac::McpsDataRequest,
197 dev1->
GetMac (), params, p0);
201 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
205 std::cout <<
"*** Fourth test " << std::endl;
210 Simulator::Schedule (
Seconds (0.1),
211 &LrWpanMac::McpsDataRequest,
212 dev1->
GetMac (), params, p0);
215 Simulator::Schedule (
Seconds (0.1),
216 &LrWpanMac::McpsDataRequest,
217 dev2->
GetMac (), params, p1);
221 std::cout <<
"m_rxPackets = " << int(
m_rxPackets) << std::endl;
224 Simulator::Destroy ();
virtual ~LrWpanCollisionTestCase()
uint8_t m_rxPackets
Rx packets counter.
void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when DataIndication is hit.
virtual void DoRun(void)
Implementation to actually run this TestCase.
LrWpanCollisionTestCase()
LrWpan Collision TestSuite.
LrWpanCollisionTestSuite()
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress ()
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
Ptr< LrWpanCsmaCa > GetCsmaCa(void) const
Get the CSMA/CA implementation used by this NetDevice.
This class can contain 16 bit addresses.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
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.
static void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when a Data indication is invoked.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
MCPS-DATA.indication params.
MCPS-DATA.request params.
LrWpanAddressMode m_srcAddrMode
Source address mode.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
uint16_t m_dstPanId
Destination PAN identifier.
Mac16Address m_dstAddr
Destination address.
uint8_t m_msduHandle
MSDU handle.
uint8_t m_txOptions
Tx Options (bitfield)