lora-periodic-sender.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 University of Padova
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Davide Magrin <magrinda@dei.unipd.it>
19  *
20  * Modified by: Bastien Tauran <bastien.tauran@viveris.fr>
21  */
22 
23 #ifndef LORA_SENDER_APPLICATION
24 #define LORA_SENDER_APPLICATION
25 
26 #include "lorawan-mac.h"
27 
28 #include <ns3/application.h>
29 #include <ns3/attribute.h>
30 #include <ns3/nstime.h>
31 
32 namespace ns3
33 {
34 
35 class LoraPeriodicSender : public Application
36 {
37  public:
40 
41  static TypeId GetTypeId(void);
42 
47  void SetInterval(Time interval);
48 
53  Time GetInterval(void) const;
54 
58  void SetInitialDelay(Time delay);
59 
63  void SetPacketSize(uint8_t size);
64 
68  void SetPacketSizeRandomVariable(Ptr<RandomVariableStream> rv);
69 
73  void SendPacket(void);
74 
78  void StartApplication(void);
79 
83  void StopApplication(void);
84 
85  private:
89  Time m_interval;
90 
95 
99  EventId m_sendEvent;
100 
104  Ptr<LorawanMac> m_mac;
105 
109  uint8_t m_basePktSize;
110 
114  Ptr<RandomVariableStream> m_pktSizeRV;
115 };
116 
117 } // namespace ns3
118 
119 #endif /* LORA_SENDER_APPLICATION */
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.