-
Notifications
You must be signed in to change notification settings - Fork 132
/
one-shot-sender.h
78 lines (64 loc) · 1.57 KB
/
one-shot-sender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (c) 2017 University of Padova
*
* SPDX-License-Identifier: GPL-2.0-only
*
* Author: Davide Magrin <[email protected]>
*/
#ifndef ONE_SHOT_SENDER_H
#define ONE_SHOT_SENDER_H
#include "lorawan-mac.h"
#include "ns3/application.h"
#include "ns3/attribute.h"
#include "ns3/nstime.h"
namespace ns3
{
namespace lorawan
{
/**
* \ingroup lorawan
*
* Packet sender application to send a single packet
*/
class OneShotSender : public Application
{
public:
OneShotSender(); //!< Default constructor
~OneShotSender() override; //!< Destructor
/**
* Construct a new OneShotSender object with provided send time.
*
* \param sendTime The Time of sending.
*/
OneShotSender(Time sendTime);
/**
* Register this type.
* \return The object TypeId.
*/
static TypeId GetTypeId();
/**
* Send a packet using the LoraNetDevice's Send method.
*/
void SendPacket();
/**
* Set the time at which this app will send a packet.
*
* \param sendTime The Time of sending.
*/
void SetSendTime(Time sendTime);
/**
* Start the application by scheduling the first SendPacket event.
*/
void StartApplication() override;
/**
* Stop the application.
*/
void StopApplication() override;
private:
Time m_sendTime; //!< The time at which to send the packet.
EventId m_sendEvent; //!< The sending event.
Ptr<LorawanMac> m_mac; //!< The MAC layer of this node.
};
} // namespace lorawan
} // namespace ns3
#endif /* ONE_SHOT_APPLICATION */