A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
logical-lora-channel.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 University of Padova
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
#include "
logical-lora-channel.h
"
10
11
#include "
sub-band.h
"
12
13
#include "ns3/log.h"
14
15
namespace
ns3
16
{
17
namespace
lorawan
18
{
19
20
NS_LOG_COMPONENT_DEFINE
(
"LogicalLoraChannel"
);
21
22
LogicalLoraChannel::LogicalLoraChannel
(
uint32_t
frequencyHz,
23
uint8_t minDataRate,
24
uint8_t maxDataRate)
25
: m_frequencyHz(frequencyHz),
26
m_minDataRate(minDataRate),
27
m_maxDataRate(maxDataRate),
28
m_enabledForUplink(true)
29
{
30
NS_LOG_FUNCTION
(
this
);
31
}
32
33
uint32_t
34
LogicalLoraChannel::GetFrequency
()
const
35
{
36
return
m_frequencyHz
;
37
}
38
39
uint8_t
40
LogicalLoraChannel::GetMinimumDataRate
()
const
41
{
42
return
m_minDataRate
;
43
}
44
45
uint8_t
46
LogicalLoraChannel::GetMaximumDataRate
()
const
47
{
48
return
m_maxDataRate
;
49
}
50
51
void
52
LogicalLoraChannel::EnableForUplink
()
53
{
54
m_enabledForUplink
=
true
;
55
}
56
57
void
58
LogicalLoraChannel::DisableForUplink
()
59
{
60
m_enabledForUplink
=
false
;
61
}
62
63
bool
64
LogicalLoraChannel::IsEnabledForUplink
()
const
65
{
66
return
m_enabledForUplink
;
67
}
68
69
bool
70
operator==
(
const
Ptr<LogicalLoraChannel>
&
first
,
const
Ptr<LogicalLoraChannel>
&
second
)
71
{
72
uint32_t
thisFreq =
first
->GetFrequency();
73
uint32_t
otherFreq =
second
->GetFrequency();
74
75
NS_LOG_DEBUG
(
"Checking equality between logical lora channels: "
<< thisFreq <<
" "
76
<< otherFreq);
77
78
NS_LOG_DEBUG
(
"Result:"
<< (thisFreq == otherFreq));
79
return
(thisFreq == otherFreq);
80
}
81
82
bool
83
operator!=
(
const
Ptr<LogicalLoraChannel>
&
first
,
const
Ptr<LogicalLoraChannel>
&
second
)
84
{
85
return
!(
first
==
second
);
86
}
87
88
}
// namespace lorawan
89
}
// namespace ns3
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::lorawan::LogicalLoraChannel::m_minDataRate
uint8_t m_minDataRate
The minimum data rate that is allowed on this channel.
Definition
logical-lora-channel.h:83
ns3::lorawan::LogicalLoraChannel::GetFrequency
uint32_t GetFrequency() const
Get the frequency (Hz).
Definition
logical-lora-channel.cc:34
ns3::lorawan::LogicalLoraChannel::GetMaximumDataRate
uint8_t GetMaximumDataRate() const
Get the maximum data rate that is allowed on this channel.
Definition
logical-lora-channel.cc:46
ns3::lorawan::LogicalLoraChannel::LogicalLoraChannel
LogicalLoraChannel(uint32_t frequencyHz, uint8_t minDataRate, uint8_t maxDataRate)
Constructor providing initialization of frequency and data rate limits.
Definition
logical-lora-channel.cc:22
ns3::lorawan::LogicalLoraChannel::DisableForUplink
void DisableForUplink()
Set this channel as disabled for uplink.
Definition
logical-lora-channel.cc:58
ns3::lorawan::LogicalLoraChannel::m_frequencyHz
uint32_t m_frequencyHz
The central frequency of this channel, in Hz.
Definition
logical-lora-channel.h:82
ns3::lorawan::LogicalLoraChannel::IsEnabledForUplink
bool IsEnabledForUplink() const
Test whether this channel is marked as enabled for uplink.
Definition
logical-lora-channel.cc:64
ns3::lorawan::LogicalLoraChannel::m_enabledForUplink
bool m_enabledForUplink
Whether this channel can be used for uplink or not.
Definition
logical-lora-channel.h:85
ns3::lorawan::LogicalLoraChannel::EnableForUplink
void EnableForUplink()
Set this channel as enabled for uplink.
Definition
logical-lora-channel.cc:52
ns3::lorawan::LogicalLoraChannel::GetMinimumDataRate
uint8_t GetMinimumDataRate() const
Get the minimum data rate that is allowed on this channel.
Definition
logical-lora-channel.cc:40
ns3::lorawan::LogicalLoraChannel::m_maxDataRate
uint8_t m_maxDataRate
The maximum data rate that is allowed on this channel.
Definition
logical-lora-channel.h:84
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
logical-lora-channel.h
first
Definition
first.py:1
ns3::lorawan::operator!=
bool operator!=(const Ptr< LogicalLoraChannel > &first, const Ptr< LogicalLoraChannel > &second)
Overload the != operator to compare different instances of the same LogicalLoraChannel.
Definition
logical-lora-channel.cc:83
ns3::lorawan::operator==
bool operator==(const Ptr< LogicalLoraChannel > &first, const Ptr< LogicalLoraChannel > &second)
Overload of the == operator to compare different instances of the same LogicalLoraChannel.
Definition
logical-lora-channel.cc:70
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second
Definition
second.py:1
sub-band.h
src
lorawan
model
logical-lora-channel.cc
Generated on Tue Apr 29 2025 20:45:48 for ns-3 by
1.11.0