lora-tag.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  *
20  * Modified by: Bastien Tauran <bastien.tauran@viveris.fr>
21  */
22 
23 #ifndef LORA_TAG_H
24 #define LORA_TAG_H
25 
26 #include "satellite-enums.h"
27 
28 #include <ns3/tag.h>
29 
30 #include <ostream>
31 #include <stdint.h>
32 
33 namespace ns3
34 {
35 
40 class LoraTag : public Tag
41 {
42  public:
43  static TypeId GetTypeId(void);
44  virtual TypeId GetInstanceTypeId(void) const;
45 
52  LoraTag(uint8_t sf = 0, uint8_t destroyedBy = 0);
53 
54  virtual ~LoraTag();
55 
56  virtual void Serialize(TagBuffer i) const;
57  virtual void Deserialize(TagBuffer i);
58  virtual uint32_t GetSerializedSize() const;
59  virtual void Print(std::ostream& os) const;
60 
66  uint8_t GetSpreadingFactor() const;
67 
73  uint8_t GetDestroyedBy() const;
74 
80  double GetReceivePower() const;
81 
87  void SetSpreadingFactor(uint8_t sf);
88 
94  void SetDestroyedBy(uint8_t sf);
95 
101  void SetReceivePower(double receivePower);
102 
112  void SetFrequency(double frequency);
113 
117  double GetFrequency(void);
118 
124  uint8_t GetDataRate(void);
125 
131  void SetDataRate(uint8_t dataRate);
132 
138  uint8_t GetModcod(void);
139 
145  void SetModcod(uint8_t modcod);
146 
147  private:
148  uint8_t m_sf;
149  uint8_t m_modcod;
150  uint8_t m_destroyedBy;
151  double m_receivePower;
152  uint8_t m_dataRate;
154  double m_frequency;
155 };
156 } // namespace ns3
157 
158 #endif
Tag used to save various data about a packet, like its Spreading Factor and data about interference.
Definition: lora-tag.h:41
uint8_t m_sf
The Spreading Factor used by the packet.
Definition: lora-tag.h:148
double GetFrequency(void)
Get the frequency of the packet.
Definition: lora-tag.cc:142
uint8_t m_modcod
The Modcod ID used by the packet.
Definition: lora-tag.h:149
void SetSpreadingFactor(uint8_t sf)
Set which Spreading Factor this packet was transmitted with.
Definition: lora-tag.cc:124
static TypeId GetTypeId(void)
Definition: lora-tag.cc:36
virtual ~LoraTag()
Definition: lora-tag.cc:58
uint8_t m_dataRate
The Data Rate that needs to be used to send this.
Definition: lora-tag.h:152
uint8_t GetSpreadingFactor() const
Read which Spreading Factor this packet was transmitted with.
Definition: lora-tag.cc:100
double m_receivePower
The reception power of this packet.
Definition: lora-tag.h:151
void SetDestroyedBy(uint8_t sf)
Set which Spreading Factor this packet was destroyed by.
Definition: lora-tag.cc:118
uint8_t GetDataRate(void)
Get the data rate for this packet.
Definition: lora-tag.cc:148
virtual TypeId GetInstanceTypeId(void) const
Definition: lora-tag.cc:43
virtual uint32_t GetSerializedSize() const
Definition: lora-tag.cc:63
void SetDataRate(uint8_t dataRate)
Set the data rate for this packet.
Definition: lora-tag.cc:154
uint8_t GetModcod(void)
Get the modcod for this packet.
Definition: lora-tag.cc:160
virtual void Serialize(TagBuffer i) const
Definition: lora-tag.cc:71
void SetFrequency(double frequency)
Set the frequency of the packet.
Definition: lora-tag.cc:136
double GetReceivePower() const
Read the power this packet arrived with.
Definition: lora-tag.cc:112
virtual void Deserialize(TagBuffer i)
Definition: lora-tag.cc:82
void SetReceivePower(double receivePower)
Set the power this packet was received with.
Definition: lora-tag.cc:130
virtual void Print(std::ostream &os) const
Definition: lora-tag.cc:93
double m_frequency
packet.
Definition: lora-tag.h:154
void SetModcod(uint8_t modcod)
Set the modcod for this packet.
Definition: lora-tag.cc:166
LoraTag(uint8_t sf=0, uint8_t destroyedBy=0)
Create a LoraTag with a given spreading factor and collision.
Definition: lora-tag.cc:48
uint8_t GetDestroyedBy() const
Read which Spreading Factor this packet was destroyed by.
Definition: lora-tag.cc:106
uint8_t m_destroyedBy
The Spreading Factor that destroyed the packet.
Definition: lora-tag.h:150
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.