A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
periodic-sender.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 University of Padova
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Davide Magrin <magrinda@dei.unipd.it>
18
*/
19
20
#ifndef PERIODIC_SENDER_H
21
#define PERIODIC_SENDER_H
22
23
#include "
lorawan-mac.h
"
24
25
#include "ns3/application.h"
26
#include "ns3/attribute.h"
27
#include "ns3/nstime.h"
28
29
namespace
ns3
30
{
31
namespace
lorawan
32
{
33
34
/**
35
* \ingroup lorawan
36
*
37
* Implements a sender application generating packets following a periodic point process.
38
*/
39
class
PeriodicSender
:
public
Application
40
{
41
public
:
42
PeriodicSender
();
//!< Default constructor
43
~PeriodicSender
()
override
;
//!< Destructor
44
45
/**
46
* Register this type.
47
* \return The object TypeId.
48
*/
49
static
TypeId
GetTypeId
();
50
51
/**
52
* Set the sending interval.
53
*
54
* \param interval The interval between two packet send instances.
55
*/
56
void
SetInterval
(
Time
interval);
57
58
/**
59
* Get the sending interval.
60
*
61
* \return The interval between two packet sends.
62
*/
63
Time
GetInterval
()
const
;
64
65
/**
66
* Set the initial delay of this application.
67
*
68
* \param delay The initial delay value.
69
*/
70
void
SetInitialDelay
(
Time
delay);
71
72
/**
73
* Set packet size.
74
*
75
* \param size The base packet size value in bytes.
76
*/
77
void
SetPacketSize
(uint8_t size);
78
79
/**
80
* Set to add randomness to the base packet size.
81
*
82
* On each call to SendPacket(), an integer number is picked from a random variable. That
83
* integer number is then added to the base packet size to create the new packet.
84
*
85
* \param rv The random variable used to extract the additional number of packet bytes.
86
* Extracted values can be negative, but if they are lower than the base packet size they
87
* produce a runtime error. This check is left to the caller during definition of the random
88
* variable.
89
*/
90
void
SetPacketSizeRandomVariable
(
Ptr<RandomVariableStream>
rv);
91
92
/**
93
* Send a packet using the LoraNetDevice's Send method.
94
*/
95
void
SendPacket
();
96
97
/**
98
* Start the application by scheduling the first SendPacket event.
99
*/
100
void
StartApplication
()
override
;
101
102
/**
103
* Stop the application.
104
*/
105
void
StopApplication
()
override
;
106
107
private
:
108
Time
m_interval
;
//!< The interval between to consecutive send events.
109
Time
m_initialDelay
;
//!< The initial delay of this application.
110
EventId
m_sendEvent
;
//!< The sending event scheduled as next.
111
Ptr<LorawanMac>
m_mac
;
//!< The MAC layer of this node.
112
uint8_t
m_basePktSize
;
//!< The packet size.
113
Ptr<RandomVariableStream>
114
m_pktSizeRV
;
//!< The random variable that adds bytes to the packet size.
115
};
116
117
}
// namespace lorawan
118
119
}
// namespace ns3
120
#endif
/* SENDER_APPLICATION */
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:62
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:56
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::lorawan::PeriodicSender
Implements a sender application generating packets following a periodic point process.
Definition:
periodic-sender.h:40
ns3::lorawan::PeriodicSender::m_pktSizeRV
Ptr< RandomVariableStream > m_pktSizeRV
The random variable that adds bytes to the packet size.
Definition:
periodic-sender.h:114
ns3::lorawan::PeriodicSender::m_interval
Time m_interval
The interval between to consecutive send events.
Definition:
periodic-sender.h:108
ns3::lorawan::PeriodicSender::~PeriodicSender
~PeriodicSender() override
Destructor.
Definition:
periodic-sender.cc:69
ns3::lorawan::PeriodicSender::GetInterval
Time GetInterval() const
Get the sending interval.
Definition:
periodic-sender.cc:82
ns3::lorawan::PeriodicSender::m_mac
Ptr< LorawanMac > m_mac
The MAC layer of this node.
Definition:
periodic-sender.h:111
ns3::lorawan::PeriodicSender::SetInterval
void SetInterval(Time interval)
Set the sending interval.
Definition:
periodic-sender.cc:75
ns3::lorawan::PeriodicSender::SetPacketSize
void SetPacketSize(uint8_t size)
Set packet size.
Definition:
periodic-sender.cc:102
ns3::lorawan::PeriodicSender::StartApplication
void StartApplication() override
Start the application by scheduling the first SendPacket event.
Definition:
periodic-sender.cc:132
ns3::lorawan::PeriodicSender::SetInitialDelay
void SetInitialDelay(Time delay)
Set the initial delay of this application.
Definition:
periodic-sender.cc:89
ns3::lorawan::PeriodicSender::SetPacketSizeRandomVariable
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set to add randomness to the base packet size.
Definition:
periodic-sender.cc:96
ns3::lorawan::PeriodicSender::m_initialDelay
Time m_initialDelay
The initial delay of this application.
Definition:
periodic-sender.h:109
ns3::lorawan::PeriodicSender::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
periodic-sender.cc:39
ns3::lorawan::PeriodicSender::SendPacket
void SendPacket()
Send a packet using the LoraNetDevice's Send method.
Definition:
periodic-sender.cc:108
ns3::lorawan::PeriodicSender::m_sendEvent
EventId m_sendEvent
The sending event scheduled as next.
Definition:
periodic-sender.h:110
ns3::lorawan::PeriodicSender::PeriodicSender
PeriodicSender()
Default constructor.
Definition:
periodic-sender.cc:59
ns3::lorawan::PeriodicSender::StopApplication
void StopApplication() override
Stop the application.
Definition:
periodic-sender.cc:155
ns3::lorawan::PeriodicSender::m_basePktSize
uint8_t m_basePktSize
The packet size.
Definition:
periodic-sender.h:112
lorawan-mac.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
periodic-sender.h
Generated on Mon Aug 12 2024 11:16:15 for ns-3 by
1.9.6