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 #include <stdint.h>
33 
34 namespace ns3
35 {
36 
37 class LoraPeriodicSender : public Application
38 {
39  public:
42 
43  static TypeId GetTypeId(void);
44 
49  void SetInterval(Time interval);
50 
55  Time GetInterval(void) const;
56 
60  void SetInitialDelay(Time delay);
61 
65  void SetPacketSize(uint8_t size);
66 
70  void SetPacketSizeRandomVariable(Ptr<RandomVariableStream> rv);
71 
75  void SendPacket(void);
76 
80  void StartApplication(void);
81 
85  void StopApplication(void);
86 
87  private:
91  Time m_interval;
92 
97 
101  EventId m_sendEvent;
102 
106  Ptr<LorawanMac> m_mac;
107 
111  uint8_t m_basePktSize;
112 
116  Ptr<RandomVariableStream> m_pktSizeRV;
117 };
118 
119 } // namespace ns3
120 
121 #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.