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