Loading...
Searching...
No Matches
lora-logical-channel.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
24
25#include "ns3/log.h"
26
27namespace ns3
28{
29
30NS_LOG_COMPONENT_DEFINE("LoraLogicalChannel");
31
32NS_OBJECT_ENSURE_REGISTERED(LoraLogicalChannel);
33
34TypeId
36{
37 static TypeId tid = TypeId("ns3::LoraLogicalChannel").SetParent<Object>();
38 return tid;
39}
40
42 : m_frequency(0),
46{
47 NS_LOG_FUNCTION(this);
48}
49
51{
52 NS_LOG_FUNCTION(this);
53}
54
56 : m_frequency(frequency),
58{
59 NS_LOG_FUNCTION(this);
60}
61
62LoraLogicalChannel::LoraLogicalChannel(double frequency, uint8_t minDataRate, uint8_t maxDataRate)
63 : m_frequency(frequency),
64 m_minDataRate(minDataRate),
65 m_maxDataRate(maxDataRate),
67{
68 NS_LOG_FUNCTION(this);
69}
70
71double
73{
74 return m_frequency;
75}
76
77void
79{
80 m_minDataRate = minDataRate;
81}
82
83void
85{
86 m_maxDataRate = maxDataRate;
87}
88
89uint8_t
94
95uint8_t
100
101void
106
107void
112
113bool
118
119bool
120operator==(const Ptr<LoraLogicalChannel>& first, const Ptr<LoraLogicalChannel>& second)
121{
122 double thisFreq = first->GetFrequency();
123 double otherFreq = second->GetFrequency();
124
125 NS_LOG_DEBUG("Checking equality between logical lora channels: " << thisFreq << " "
126 << otherFreq);
127
128 NS_LOG_DEBUG("Result:" << (thisFreq == otherFreq));
129 return (thisFreq == otherFreq);
130}
131
132bool
133operator!=(const Ptr<LoraLogicalChannel>& first, const Ptr<LoraLogicalChannel>& second)
134{
135 return !(first == second);
136}
137} // namespace ns3
This class represents a logical LoRaWAN channel.
bool m_enabledForUplink
Whether this channel can be used for uplink or not.
uint8_t GetMaximumDataRate(void)
Get the maximum Data Rate that is allowed on this channel.
static TypeId GetTypeId(void)
bool IsEnabledForUplink(void)
Test whether this channel is marked as enabled for uplink.
void SetEnabledForUplink(void)
Set this channel as enabled for uplink.
void SetMinimumDataRate(uint8_t minDataRate)
Set the frequency (MHz).
uint8_t GetMinimumDataRate(void)
Get the minimum Data Rate that is allowed on this channel.
uint8_t m_maxDataRate
The maximum Data Rate that is allowed on this channel.
double GetFrequency(void) const
Get the frequency (MHz).
void DisableForUplink(void)
Set this channel as disabled for uplink.
double m_frequency
The central frequency of this channel, in MHz.
uint8_t m_minDataRate
The minimum Data Rate that is allowed on this channel.
void SetMaximumDataRate(uint8_t maxDataRate)
Set the maximum Data Rate that is allowed on this channel.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
bool operator==(const Ptr< LoraLogicalChannel > &first, const Ptr< LoraLogicalChannel > &second)
Overload of the == operator to compare different instances of the same LoraLogicalChannel.
bool operator!=(const Ptr< LoraLogicalChannel > &first, const Ptr< LoraLogicalChannel > &second)
Overload the != operator to compare different instances of the same LoraLogicalChannel.