27 #include <ns3/double.h>
29 #include <ns3/pointer.h>
30 #include <ns3/string.h>
35 NS_LOG_COMPONENT_DEFINE(
"LoraPeriodicSender");
37 NS_OBJECT_ENSURE_REGISTERED(LoraPeriodicSender);
42 static TypeId tid = TypeId(
"ns3::LoraPeriodicSender")
43 .SetParent<Application>()
44 .AddConstructor<LoraPeriodicSender>()
45 .AddAttribute(
"Interval",
46 "The interval between packet sends of this app",
47 TimeValue(Seconds(0)),
60 : m_interval(Seconds(10)),
61 m_initialDelay(Seconds(1)),
66 NS_LOG_FUNCTION_NOARGS();
71 NS_LOG_FUNCTION_NOARGS();
77 NS_LOG_FUNCTION(
this << interval);
84 NS_LOG_FUNCTION(
this);
91 NS_LOG_FUNCTION(
this << delay);
110 NS_LOG_FUNCTION(
this);
128 NS_LOG_DEBUG(
"Sent a packet of size " << packet->GetSize());
134 NS_LOG_FUNCTION(
this);
137 if (
m_mac ==
nullptr)
139 Ptr<SatLorawanNetDevice> loraNetDevice;
140 for (uint32_t i = 0; i < m_node->GetNDevices(); i++)
142 loraNetDevice = DynamicCast<SatLorawanNetDevice>(m_node->GetDevice(i));
143 if (loraNetDevice !=
nullptr)
149 NS_ASSERT(loraNetDevice !=
nullptr);
151 m_mac = DynamicCast<LorawanMac>(loraNetDevice->GetMac());
152 NS_ASSERT(
m_mac !=
nullptr);
157 NS_LOG_DEBUG(
"Starting up application with a first event with a " <<
m_initialDelay.GetSeconds()
158 <<
" seconds delay");
160 NS_LOG_DEBUG(
"Event Id: " <<
m_sendEvent.GetUid());
166 NS_LOG_FUNCTION_NOARGS();
Time m_initialDelay
The initial delay of this application.
void StartApplication(void)
Start the application by scheduling the first SendPacket event.
void SendPacket(void)
Send a packet using the LoraNetDevice's Send method.
uint8_t m_basePktSize
The packet size.
Ptr< LorawanMac > m_mac
The MAC layer of this node.
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set if using randomness in the packet size.
void SetPacketSize(uint8_t size)
Set packet size.
Time GetInterval(void) const
Get the sending inteval.
void SetInterval(Time interval)
Set the sending interval.
static TypeId GetTypeId(void)
Time m_interval
The interval between to consecutive send events.
Ptr< RandomVariableStream > m_pktSizeRV
The random variable that adds bytes to the packet size.
EventId m_sendEvent
The sending event scheduled as next.
void SetInitialDelay(Time delay)
Set the initial delay of this application.
void StopApplication(void)
Stop the application.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.