Loading...
Searching...
No Matches
lorawan-mac-end-device-class-a.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2017 University of Padova
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Davide Magrin <magrinda@dei.unipd.it>
19 * Martina Capuzzo <capuzzom@dei.unipd.it>
20 *
21 * Modified by: Peggy Anderson <peggy.anderson@usask.ca>
22 * Bastien Tauran <bastien.tauran@viveris.fr>
23 */
24
25#ifndef LORAWAN_MAC_END_DEVICE_CLASS_A_H
26#define LORAWAN_MAC_END_DEVICE_CLASS_A_H
27
28#include "lora-device-address.h"
29#include "lora-frame-header.h" // RxParamSetupReq
30#include "lorawan-mac-end-device.h" // LorawanMacEndDevice
31#include "lorawan-mac.h" // Packet
32
33#include <stdint.h>
34
35namespace ns3
36{
37
42{
43 public:
44 static TypeId GetTypeId(void);
45
47 LorawanMacEndDeviceClassA(Ptr<Node> node,
48 uint32_t satId,
49 uint32_t beamId,
50 Ptr<SatSuperframeSeq> seq);
51
60 virtual void NotifyConstructionCompleted() override;
61
63
65 // Sending methods //
67
73 virtual void SendToPhy(Ptr<Packet> packet);
74
76 // Receiving methods //
78
87 virtual void Receive(Ptr<Packet> packet);
88
89 virtual void FailedReception(Ptr<const Packet> packet);
90
96 virtual void TxFinished();
97
103 void SetRaModel(SatEnums::RandomAccessModel_t randomAccessModel);
104
108 void OpenFirstReceiveWindow(void);
109
113 void OpenSecondReceiveWindow(void);
114
118 void CloseFirstReceiveWindow(void);
119
123 void CloseSecondReceiveWindow(void);
124
126 // Getters and Setters //
128
136 virtual Time GetNextClassTransmissionDelay(Time waitingTime);
137
143 uint8_t GetFirstReceiveWindowDataRate(void);
144
150 void SetSecondReceiveWindowDataRate(uint8_t dataRate);
151
157 uint8_t GetSecondReceiveWindowDataRate(void);
158
164 void SetSecondReceiveWindowFrequency(double frequencyMHz);
165
172
174 // MAC command methods //
176
186 virtual void OnRxClassParamSetupReq(Ptr<RxParamSetupReq> rxParamSetupReq);
187
188 private:
192 Ptr<SatSuperframeSeq> m_superframeSeq;
193
198
203
208
213
218
225
232
240
245
250
255
256}; /* LorawanMacEndDeviceClassA */
257} /* namespace ns3 */
258#endif /* LORAWAN_MAC_END_DEVICE_CLASS_A_H */
EventId m_secondReceiveWindow
The event of the second receive window opening.
uint8_t GetFirstReceiveWindowDataRate(void)
Get the Data Rate that will be used in the first receive window.
Time m_secondWindowDelay
Time to wait between end of message transmission and opening of second reception window.
virtual void TxFinished()
Perform the actions that are required after a packet send.
SatEnums::PacketType_t m_packetType
Packet type used on RTN channel.
virtual void OnRxClassParamSetupReq(Ptr< RxParamSetupReq > rxParamSetupReq)
Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Devic...
virtual void SendToPhy(Ptr< Packet > packet)
Add headers and send a packet with the sending function of the physical layer.
Time m_secondWindowDuration
Duration of second reception window.
virtual Time GetNextClassTransmissionDelay(Time waitingTime)
Find the minimum waiting time before the next possible transmission based on End Device's Class Type.
Time m_firstWindowDuration
Duration of first reception window.
double GetSecondReceiveWindowFrequency(void)
Get the frequency that is used for the second receive window.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
Ptr< SatSuperframeSeq > m_superframeSeq
Used superframe sequence for the return link.
EventId m_closeSecondWindow
The event of the closing the second receive window.
void CloseFirstReceiveWindow(void)
Perform operations needed to close the first receive window.
void OpenFirstReceiveWindow(void)
Perform operations needed to open the first receive window.
void OpenSecondReceiveWindow(void)
Perform operations needed to open the second receive window.
void SetSecondReceiveWindowDataRate(uint8_t dataRate)
Set the Data Rate to be used in the second receive window.
virtual void FailedReception(Ptr< const Packet > packet)
Function called by lower layers to inform this layer that reception of a packet we were locked on fai...
void SetSecondReceiveWindowFrequency(double frequencyMHz)
Set the frequency that will be used for the second receive window.
void CloseSecondReceiveWindow(void)
Perform operations needed to close the second receive window.
uint8_t m_rx1DrOffset
The RX1DROffset parameter value.
double m_secondReceiveWindowFrequency
The frequency to listen on for the second receive window.
virtual void Receive(Ptr< Packet > packet)
Receive a packet.
Time m_firstWindowDelay
Time to wait between end of message transmission and opening of first reception window.
EventId m_closeFirstWindow
The event of the closing the first receive window.
uint8_t GetSecondReceiveWindowDataRate(void)
Get the Data Rate that will be used in the second receive window.
void SetRaModel(SatEnums::RandomAccessModel_t randomAccessModel)
Set the random access model.
uint8_t m_secondReceiveWindowDataRate
The Data Rate to listen for during the second downlink transmission.
RandomAccessModel_t
The defined random access models.
PacketType_t
Packet types.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.