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" 87 virtual void DoRun (
void);
97 :
TestCase (
"Test the 802.15.4 ACK handling")
115 params.m_dstPanId = 0;
117 params.m_msduHandle = 0;
121 dev->
GetMac ()->McpsDataRequest (params, p);
145 if (dev->
GetMac ()->GetExtendedAddress () ==
Mac64Address (
"00:00:00:00:00:00:00:02"))
151 params.m_dstPanId = 0;
152 params.m_dstExtAddr =
Mac64Address (
"00:00:00:00:00:00:00:01");
153 params.m_msduHandle = 0;
157 dev->
GetMac ()->McpsDataRequest (params, p);
168 if (dev->
GetMac ()->GetExtendedAddress () ==
Mac64Address (
"00:00:00:00:00:00:00:01"))
193 RngSeedManager::SetSeed (1);
194 RngSeedManager::SetRun (6);
204 dev0->AssignStreams (0);
205 dev1->AssignStreams (10);
214 channel->AddPropagationLossModel (propModel);
215 channel->SetPropagationDelayModel (delayModel);
222 n1->AddDevice (dev1);
226 dev0->GetPhy ()->SetMobility (sender0Mobility);
230 dev1->GetPhy ()->SetMobility (sender1Mobility);
234 dev0->GetMac ()->SetMcpsDataConfirmCallback (cb0);
238 dev0->GetMac ()->SetMcpsDataIndicationCallback (cb1);
242 dev1->GetMac ()->SetMcpsDataConfirmCallback (cb2);
246 dev1->GetMac ()->SetMcpsDataIndicationCallback (cb3);
252 params.m_dstPanId = 0;
254 params.m_msduHandle = 0;
257 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p0);
276 dev0->GetMac()->SetExtendedAddress (
Mac64Address (
"00:00:00:00:00:00:00:01"));
277 dev1->GetMac()->SetExtendedAddress (
Mac64Address (
"00:00:00:00:00:00:00:02"));
281 dev0->GetMac ()->SetMcpsDataConfirmCallback (cb0);
284 dev0->GetMac ()->SetMcpsDataIndicationCallback (cb1);
287 dev1->GetMac ()->SetMcpsDataConfirmCallback (cb2);
290 dev1->GetMac ()->SetMcpsDataIndicationCallback (cb3);
295 params.m_dstPanId = 0;
296 params.m_dstExtAddr =
Mac64Address (
"00:00:00:00:00:00:00:02");
297 params.m_msduHandle = 0;
300 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p0);
309 Simulator::Destroy ();
static LrWpanAckTestSuite g_lrWpanAckTestSuite
Static variable for test initialization.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
static void ExtendedAddressingDataIndication(LrWpanAckTestCase *testCase, Ptr< LrWpanNetDevice > dev, McpsDataIndicationParams params, Ptr< Packet > p)
Function called when DataIndication is hit in extended addressing test.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Time m_replyArrivalTime
Reply arrival time.
Time m_requestAckTime
Request ack time.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual Address GetAddress(void) const
This method indirects to LrWpanMac::SetShortAddress ()
static void DataIndication(LrWpanAckTestCase *testCase, Ptr< LrWpanNetDevice > dev, McpsDataIndicationParams params, Ptr< Packet > p)
Function called when DataIndication is hit.
static void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
static void DataConfirm(LrWpanAckTestCase *testCase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params)
Function called when DataConfirm is hit.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
MCPS-DATA.confirm params.
uint8_t m_srcAddrMode
Source address mode.
LrWpanAddressMode m_srcAddrMode
Source address mode.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void DoRun(void)
Implementation to actually run this TestCase.
This class can contain 16 bit addresses.
void SetPosition(const Vector &position)
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time m_replyTime
Reply time.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
Time m_replyAckTime
Reply ack time.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
MCPS-DATA.request params.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
static void ExtendedAddressingDataConfirm(LrWpanAckTestCase *testCase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params)
Function called when DataConfirm is hit in extended addressing test.
Time m_requestTime
Request time.
static void DataConfirm(McpsDataConfirmParams params)
MCPS-DATA.indication params.