A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
one-shot-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 ONE_SHOT_SENDER_H
21#define ONE_SHOT_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
29namespace ns3
30{
31namespace lorawan
32{
33
34/**
35 * \ingroup lorawan
36 *
37 * Packet sender application to send a single packet
38 */
40{
41 public:
42 OneShotSender(); //!< Default constructor
43 ~OneShotSender() override; //!< Destructor
44
45 /**
46 * Construct a new OneShotSender object with provided send time.
47 *
48 * \param sendTime The Time of sending.
49 */
50 OneShotSender(Time sendTime);
51
52 /**
53 * Register this type.
54 * \return The object TypeId.
55 */
56 static TypeId GetTypeId();
57
58 /**
59 * Send a packet using the LoraNetDevice's Send method.
60 */
61 void SendPacket();
62
63 /**
64 * Set the time at which this app will send a packet.
65 *
66 * \param sendTime The Time of sending.
67 */
68 void SetSendTime(Time sendTime);
69
70 /**
71 * Start the application by scheduling the first SendPacket event.
72 */
73 void StartApplication() override;
74
75 /**
76 * Stop the application.
77 */
78 void StopApplication() override;
79
80 private:
81 Time m_sendTime; //!< The time at which to send the packet.
82 EventId m_sendEvent; //!< The sending event.
83 Ptr<LorawanMac> m_mac; //!< The MAC layer of this node.
84};
85
86} // namespace lorawan
87
88} // namespace ns3
89#endif /* ONE_SHOT_APPLICATION */
The base class for all ns3 applications.
Definition: application.h:62
An identifier for simulation events.
Definition: event-id.h:56
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Packet sender application to send a single packet.
EventId m_sendEvent
The sending event.
void SendPacket()
Send a packet using the LoraNetDevice's Send method.
Ptr< LorawanMac > m_mac
The MAC layer of this node.
~OneShotSender() override
Destructor.
void StartApplication() override
Start the application by scheduling the first SendPacket event.
OneShotSender()
Default constructor.
static TypeId GetTypeId()
Register this type.
void SetSendTime(Time sendTime)
Set the time at which this app will send a packet.
void StopApplication() override
Stop the application.
Time m_sendTime
The time at which to send the packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.