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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
#ifndef PERIODIC_SENDER_H
10
#define PERIODIC_SENDER_H
11
12
#include "ns3/application.h"
13
#include "ns3/random-variable-stream.h"
14
15
namespace
ns3
16
{
17
namespace
lorawan
18
{
19
20
class
LorawanMac
;
21
22
/**
23
* @ingroup lorawan
24
*
25
* Implements a sender application generating packets following a periodic point process.
26
*/
27
class
PeriodicSender
:
public
Application
28
{
29
public
:
30
PeriodicSender
();
//!< Default constructor
31
~PeriodicSender
()
override
;
//!< Destructor
32
33
/**
34
* Register this type.
35
* @return The object TypeId.
36
*/
37
static
TypeId
GetTypeId
();
38
39
/**
40
* Set the sending interval.
41
*
42
* @param interval The interval between two packet send instances.
43
*/
44
void
SetInterval
(
Time
interval);
45
46
/**
47
* Get the sending interval.
48
*
49
* @return The interval between two packet sends.
50
*/
51
Time
GetInterval
()
const
;
52
53
/**
54
* Set the initial delay of this application.
55
*
56
* @param delay The initial delay value.
57
*/
58
void
SetInitialDelay
(
Time
delay);
59
60
/**
61
* Set packet size.
62
*
63
* @param size The base packet size value in bytes.
64
*/
65
void
SetPacketSize
(uint8_t size);
66
67
/**
68
* Set to add randomness to the base packet size.
69
*
70
* On each call to SendPacket(), an integer number is picked from a random variable. That
71
* integer number is then added to the base packet size to create the new packet.
72
*
73
* @param rv The random variable used to extract the additional number of packet bytes.
74
* Extracted values can be negative, but if they are lower than the base packet size they
75
* produce a runtime error. This check is left to the caller during definition of the random
76
* variable.
77
*/
78
void
SetPacketSizeRandomVariable
(
Ptr<RandomVariableStream>
rv);
79
80
/**
81
* Send a packet using the LoraNetDevice's Send method.
82
*/
83
void
SendPacket
();
84
85
/**
86
* Start the application by scheduling the first SendPacket event.
87
*/
88
void
StartApplication
()
override
;
89
90
/**
91
* Stop the application.
92
*/
93
void
StopApplication
()
override
;
94
95
private
:
96
Time
m_interval
;
//!< The interval between to consecutive send events.
97
Time
m_initialDelay
;
//!< The initial delay of this application.
98
EventId
m_sendEvent
;
//!< The sending event scheduled as next.
99
Ptr<LorawanMac>
m_mac
;
//!< The MAC layer of this node.
100
uint8_t
m_basePktSize
;
//!< The packet size.
101
Ptr<RandomVariableStream>
102
m_pktSizeRV
;
//!< The random variable that adds bytes to the packet size.
103
};
104
105
}
// namespace lorawan
106
}
// namespace ns3
107
108
#endif
/* SENDER_APPLICATION */
ns3::Application::Application
Application()
Definition
application.cc:49
ns3::EventId
An identifier for simulation events.
Definition
event-id.h:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:95
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:50
ns3::lorawan::LorawanMac
Class representing the LoRaWAN MAC layer.
Definition
lorawan-mac.h:36
ns3::lorawan::PeriodicSender::m_pktSizeRV
Ptr< RandomVariableStream > m_pktSizeRV
The random variable that adds bytes to the packet size.
Definition
periodic-sender.h:102
ns3::lorawan::PeriodicSender::m_interval
Time m_interval
The interval between to consecutive send events.
Definition
periodic-sender.h:96
ns3::lorawan::PeriodicSender::~PeriodicSender
~PeriodicSender() override
Destructor.
Definition
periodic-sender.cc:56
ns3::lorawan::PeriodicSender::GetInterval
Time GetInterval() const
Get the sending interval.
Definition
periodic-sender.cc:69
ns3::lorawan::PeriodicSender::m_mac
Ptr< LorawanMac > m_mac
The MAC layer of this node.
Definition
periodic-sender.h:99
ns3::lorawan::PeriodicSender::SetInterval
void SetInterval(Time interval)
Set the sending interval.
Definition
periodic-sender.cc:62
ns3::lorawan::PeriodicSender::SetPacketSize
void SetPacketSize(uint8_t size)
Set packet size.
Definition
periodic-sender.cc:89
ns3::lorawan::PeriodicSender::StartApplication
void StartApplication() override
Start the application by scheduling the first SendPacket event.
Definition
periodic-sender.cc:119
ns3::lorawan::PeriodicSender::SetInitialDelay
void SetInitialDelay(Time delay)
Set the initial delay of this application.
Definition
periodic-sender.cc:76
ns3::lorawan::PeriodicSender::SetPacketSizeRandomVariable
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set to add randomness to the base packet size.
Definition
periodic-sender.cc:83
ns3::lorawan::PeriodicSender::m_initialDelay
Time m_initialDelay
The initial delay of this application.
Definition
periodic-sender.h:97
ns3::lorawan::PeriodicSender::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
periodic-sender.cc:26
ns3::lorawan::PeriodicSender::SendPacket
void SendPacket()
Send a packet using the LoraNetDevice's Send method.
Definition
periodic-sender.cc:95
ns3::lorawan::PeriodicSender::m_sendEvent
EventId m_sendEvent
The sending event scheduled as next.
Definition
periodic-sender.h:98
ns3::lorawan::PeriodicSender::PeriodicSender
PeriodicSender()
Default constructor.
Definition
periodic-sender.cc:46
ns3::lorawan::PeriodicSender::StopApplication
void StopApplication() override
Stop the application.
Definition
periodic-sender.cc:142
ns3::lorawan::PeriodicSender::m_basePktSize
uint8_t m_basePktSize
The packet size.
Definition
periodic-sender.h:100
ns3::lorawan
Definition
forwarder-helper.cc:19
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
periodic-sender.h
Generated on
for ns-3 by
1.15.0