10#include "ns3/rng-seed-manager.h"
11#include <ns3/constant-position-mobility-model.h>
12#include <ns3/core-module.h>
14#include <ns3/lr-wpan-module.h>
15#include <ns3/packet.h>
16#include <ns3/propagation-delay-model.h>
17#include <ns3/propagation-loss-model.h>
18#include <ns3/simulator.h>
19#include <ns3/single-model-spectrum-channel.h>
90 void DoRun()
override;
123 RxPacket->RemoveHeader(receivedMacHdr);
153 RxPacket->RemoveHeader(receivedMacHdr);
215 channel->AddPropagationLossModel(propModel);
216 channel->SetPropagationDelayModel(delayModel);
218 dev0->SetChannel(channel);
219 dev1->SetChannel(channel);
226 dev0->GetMac()->TraceConnectWithoutContext(
229 dev0->GetMac()->TraceConnectWithoutContext(
232 dev0->GetPhy()->TraceConnectWithoutContext(
235 dev1->GetMac()->TraceConnectWithoutContext(
241 sender0Mobility->SetPosition(Vector(0, 0, 0));
242 dev0->GetPhy()->SetMobility(sender0Mobility);
246 sender1Mobility->SetPosition(Vector(0, 10, 0));
247 dev1->GetPhy()->SetMobility(sender1Mobility);
251 dev0->GetMac()->SetMcpsDataConfirmCallback(cb0);
255 dev1->GetMac()->SetMcpsDataConfirmCallback(cb1);
259 params.m_dstPanId = 0;
264 params.m_msduHandle = 0;
288 "Wrong Short InterFrame Space (SIFS) Size after dataframe Tx");
289 std::cout <<
"----------------------------------\n";
310 "Wrong Long InterFrame Space (LIFS) Size after dataframe Tx");
311 std::cout <<
"----------------------------------\n";
333 "Wrong Short InterFrame Space (SIFS) Size after ACK Rx");
334 std::cout <<
"----------------------------------\n";
356 "Wrong Long InterFrame Space (LIFS) Size after ACK Rx");
357 std::cout <<
"----------------------------------\n";
369 dev0->GetCsmaCa()->SetMacMinBE(0);
370 dev1->GetCsmaCa()->SetMacMinBE(0);
373 params.m_dstPanId = 0;
377 params.m_msduHandle = 0;
390 "Error, IFS end time should be greater than PHY start Rx time");
LrWpan Dataframe transmission with Interframe Space.
~LrWpanDataIfsTestCase() override
static void IfsEnd(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Time IfsTime)
Function called when the IFS ends.
Time m_endIfs
The time where the Interframe Space ended.
static void DataReceivedDev1(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet >)
Function called when DataConfirm is hit.
void DoRun() override
Implementation to actually run this TestCase.
Time m_phyStartRx
The time the phy start receiving a packet.
Time m_lastTxTime
The time of the last transmitted packet.
static void DataReceivedDev0(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when DataReceived is hit.
Time m_ackRxTime
The time of the received acknowledgment.
static void PhyDataRxStart(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when PhyDataRxStart is hit.
static void DataConfirm(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params)
Function called when DataConfirm is hit.
This class can contain 16 bit addresses.
bool IsBroadcast() const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
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.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
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.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
static LrWpanIfsTestSuite lrWpanIfsTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
MCPS-DATA.confirm params.
MCPS-DATA.request params.
AddressMode m_dstAddrMode
Destination address mode.
Mac16Address m_dstAddr
Destination address.
uint16_t m_dstPanId
Destination PAN identifier.
AddressMode m_srcAddrMode
Source address mode.
uint8_t m_msduHandle
MSDU handle.