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
namespace
ns3
12
{
13
namespace
lorawan
14
{
15
16
NS_LOG_COMPONENT_DEFINE
(
"LogicalLoraChannel"
);
17
18
LogicalLoraChannel::LogicalLoraChannel
(
uint32_t
frequencyHz,
19
uint8_t minDataRate,
20
uint8_t maxDataRate)
21
:
m_frequencyHz
(frequencyHz),
22
m_minDataRate
(minDataRate),
23
m_maxDataRate
(maxDataRate),
24
m_enabledForUplink
(true)
25
{
26
NS_LOG_FUNCTION
(
this
);
27
}
28
29
uint32_t
30
LogicalLoraChannel::GetFrequency
()
const
31
{
32
return
m_frequencyHz
;
33
}
34
35
uint8_t
36
LogicalLoraChannel::GetMinimumDataRate
()
const
37
{
38
return
m_minDataRate
;
39
}
40
41
uint8_t
42
LogicalLoraChannel::GetMaximumDataRate
()
const
43
{
44
return
m_maxDataRate
;
45
}
46
47
void
48
LogicalLoraChannel::EnableForUplink
()
49
{
50
m_enabledForUplink
=
true
;
51
}
52
53
void
54
LogicalLoraChannel::DisableForUplink
()
55
{
56
m_enabledForUplink
=
false
;
57
}
58
59
bool
60
LogicalLoraChannel::IsEnabledForUplink
()
const
61
{
62
return
m_enabledForUplink
;
63
}
64
65
bool
66
operator==
(
const
Ptr<LogicalLoraChannel>
&
first
,
const
Ptr<LogicalLoraChannel>
&
second
)
67
{
68
uint32_t
thisFreq =
first
->GetFrequency();
69
uint32_t
otherFreq =
second
->GetFrequency();
70
71
NS_LOG_DEBUG
(
"Checking equality between logical lora channels: "
<< thisFreq <<
" "
72
<< otherFreq);
73
74
NS_LOG_DEBUG
(
"Result:"
<< (thisFreq == otherFreq));
75
return
(thisFreq == otherFreq);
76
}
77
78
bool
79
operator!=
(
const
Ptr<LogicalLoraChannel>
&
first
,
const
Ptr<LogicalLoraChannel>
&
second
)
80
{
81
return
!(
first
==
second
);
82
}
83
84
}
// namespace lorawan
85
}
// namespace ns3
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
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:30
ns3::lorawan::LogicalLoraChannel::GetMaximumDataRate
uint8_t GetMaximumDataRate() const
Get the maximum data rate that is allowed on this channel.
Definition
logical-lora-channel.cc:42
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:18
ns3::lorawan::LogicalLoraChannel::DisableForUplink
void DisableForUplink()
Set this channel as disabled for uplink.
Definition
logical-lora-channel.cc:54
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:60
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:48
ns3::lorawan::LogicalLoraChannel::GetMinimumDataRate
uint8_t GetMinimumDataRate() const
Get the minimum data rate that is allowed on this channel.
Definition
logical-lora-channel.cc:36
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:194
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:260
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:231
logical-lora-channel.h
first
Definition
first.py:1
ns3::lorawan
Definition
forwarder-helper.cc:19
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:79
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:66
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second
Definition
second.py:1
src
lorawan
model
logical-lora-channel.cc
Generated on
for ns-3 by
1.15.0