lora-sub-band.cc
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 #include "lora-sub-band.h"
24 
25 #include <ns3/log.h>
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("LoraSubBand");
31 
32 NS_OBJECT_ENSURE_REGISTERED(LoraSubBand);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::LoraSubBand").SetParent<Object>();
38  return tid;
39 }
40 
42 {
43  NS_LOG_FUNCTION(this);
44 }
45 
46 LoraSubBand::LoraSubBand(double firstFrequency,
47  double lastFrequency,
48  double dutyCycle,
49  double maxTxPowerDbm)
50  : m_firstFrequency(firstFrequency),
51  m_lastFrequency(lastFrequency),
52  m_dutyCycle(dutyCycle),
53  m_nextTransmissionTime(Seconds(0)),
54  m_maxTxPowerDbm(maxTxPowerDbm)
55 {
56  NS_LOG_FUNCTION(this << firstFrequency << lastFrequency << dutyCycle << maxTxPowerDbm);
57 }
58 
60 {
61  NS_LOG_FUNCTION(this);
62 }
63 
64 double
66 {
67  return m_firstFrequency;
68 }
69 
70 double
72 {
73  return m_dutyCycle;
74 }
75 
76 bool
78 {
79  return (frequency > m_firstFrequency) && (frequency < m_lastFrequency);
80 }
81 
82 bool
83 LoraSubBand::BelongsToLoraSubBand(Ptr<LoraLogicalChannel> logicalChannel)
84 {
85  double frequency = logicalChannel->GetFrequency();
86  return BelongsToLoraSubBand(frequency);
87 }
88 
89 void
91 {
92  m_nextTransmissionTime = nextTime;
93 }
94 
95 Time
97 {
99 }
100 
101 void
102 LoraSubBand::SetMaxTxPowerDbm(double maxTxPowerDbm)
103 {
104  m_maxTxPowerDbm = maxTxPowerDbm;
105 }
106 
107 double
109 {
110  return m_maxTxPowerDbm;
111 }
112 } // namespace ns3
double GetFirstFrequency(void)
Get the lowest frequency of the LoraSubBand.
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this LoraSubBand.
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this LoraSubBand.
Time GetNextTransmissionTime(void)
Returns the next time from which transmission on this LoraSubBand will be possible.
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
double m_firstFrequency
Starting frequency of the LoraSubBand, in MHz.
virtual ~LoraSubBand()
Time m_nextTransmissionTime
The next time a transmission will be allowed in this LoraSubBand.
double m_dutyCycle
The duty cycle that needs to be enforced on this LoraSubBand.
double GetMaxTxPowerDbm(void)
Return the maximum transmission power that is allowed on this LoraSubBand.
bool BelongsToLoraSubBand(double frequency)
Return whether or not a frequency belongs to this LoraSubBand.
static TypeId GetTypeId(void)
double GetDutyCycle(void)
Get the last frequency of the LoraSubBand.
double m_lastFrequency
Ending frequency of the LoraSubBand, in MHz.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.