13#include "ns3/double.h"
15#include "ns3/pointer.h"
16#include "ns3/string.h"
32 .AddConstructor<PeriodicSender>()
33 .SetGroupName(
"lorawan")
34 .AddAttribute(
"Interval",
35 "The interval between packet sends of this app",
117 NS_LOG_DEBUG(
"Sent a packet of size " << packet->GetSize());
131 m_mac = loraNetDevice->GetMac();
The base class for all ns3 applications.
Ptr< Node > m_node
The node that this application is installed on.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Smart pointer class similar to boost::intrusive_ptr.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< RandomVariableStream > m_pktSizeRV
The random variable that adds bytes to the packet size.
Time m_interval
The interval between to consecutive send events.
~PeriodicSender() override
Destructor.
Time GetInterval() const
Get the sending interval.
Ptr< LorawanMac > m_mac
The MAC layer of this node.
void SetInterval(Time interval)
Set the sending interval.
void SetPacketSize(uint8_t size)
Set packet size.
void StartApplication() override
Start the application by scheduling the first SendPacket event.
void SetInitialDelay(Time delay)
Set the initial delay of this application.
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set to add randomness to the base packet size.
Time m_initialDelay
The initial delay of this application.
static TypeId GetTypeId()
Register this type.
void SendPacket()
Send a packet using the LoraNetDevice's Send method.
EventId m_sendEvent
The sending event scheduled as next.
PeriodicSender()
Default constructor.
void StopApplication() override
Stop the application.
uint8_t m_basePktSize
The packet size.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.