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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#ifndef ONE_SHOT_SENDER_H
10#define ONE_SHOT_SENDER_H
11
12#include "ns3/application.h"
13
14namespace ns3
15{
16namespace lorawan
17{
18
19class LorawanMac;
20
21/**
22 * @ingroup lorawan
23 *
24 * Packet sender application to send a single packet
25 */
27{
28 public:
29 OneShotSender(); //!< Default constructor
30 ~OneShotSender() override; //!< Destructor
31
32 /**
33 * Construct a new OneShotSender object with provided send time.
34 *
35 * @param sendTime The Time of sending.
36 */
37 OneShotSender(Time sendTime);
38
39 /**
40 * Register this type.
41 * @return The object TypeId.
42 */
43 static TypeId GetTypeId();
44
45 /**
46 * Send a packet using the LoraNetDevice's Send method.
47 */
48 void SendPacket();
49
50 /**
51 * Set the time at which this app will send a packet.
52 *
53 * @param sendTime The Time of sending.
54 */
55 void SetSendTime(Time sendTime);
56
57 /**
58 * Start the application by scheduling the first SendPacket event.
59 */
60 void StartApplication() override;
61
62 /**
63 * Stop the application.
64 */
65 void StopApplication() override;
66
67 private:
68 Time m_sendTime; //!< The time at which to send the packet.
69 EventId m_sendEvent; //!< The sending event.
70 Ptr<LorawanMac> m_mac; //!< The MAC layer of this node.
71};
72
73} // namespace lorawan
74} // namespace ns3
75
76#endif /* ONE_SHOT_APPLICATION */
An identifier for simulation events.
Definition event-id.h:45
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
Class representing the LoRaWAN MAC layer.
Definition lorawan-mac.h:36
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.