A Discrete-Event Network Simulator
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
10
11#include "ns3/log.h"
12
13namespace ns3
14{
15namespace lorawan
16{
17
18NS_LOG_COMPONENT_DEFINE("LogicalLoraChannel");
19
20NS_OBJECT_ENSURE_REGISTERED(LogicalLoraChannel);
21
22TypeId
24{
25 static TypeId tid =
26 TypeId("ns3::LogicalLoraChannel").SetParent<Object>().SetGroupName("lorawan");
27 return tid;
28}
29
31 : m_frequency(0),
32 m_minDataRate(0),
33 m_maxDataRate(5),
34 m_enabledForUplink(true)
35{
36 NS_LOG_FUNCTION(this);
37}
38
43
45 : m_frequency(frequency),
46 m_enabledForUplink(true)
47{
48 NS_LOG_FUNCTION(this);
49}
50
51LogicalLoraChannel::LogicalLoraChannel(double frequency, uint8_t minDataRate, uint8_t maxDataRate)
52 : m_frequency(frequency),
53 m_minDataRate(minDataRate),
54 m_maxDataRate(maxDataRate),
55 m_enabledForUplink(true)
56{
57 NS_LOG_FUNCTION(this);
58}
59
60double
65
66void
68{
69 m_minDataRate = minDataRate;
70}
71
72void
74{
75 m_maxDataRate = maxDataRate;
76}
77
78uint8_t
83
84uint8_t
89
90void
95
96void
101
102bool
107
108bool
110{
111 double thisFreq = first->GetFrequency();
112 double otherFreq = second->GetFrequency();
113
114 NS_LOG_DEBUG("Checking equality between logical lora channels: " << thisFreq << " "
115 << otherFreq);
116
117 NS_LOG_DEBUG("Result:" << (thisFreq == otherFreq));
118 return (thisFreq == otherFreq);
119}
120
121bool
126} // namespace lorawan
127} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
uint8_t m_minDataRate
The minimum data rate that is allowed on this channel.
uint8_t GetMaximumDataRate() const
Get the maximum data rate that is allowed on this channel.
static TypeId GetTypeId()
Register this type.
void SetMinimumDataRate(uint8_t minDataRate)
Set the minimum data rate that is allowed on this channel.
double GetFrequency() const
Get the frequency (MHz).
double m_frequency
The central frequency of this channel, in MHz.
void SetEnabledForUplink()
Set this channel as enabled for uplink.
void DisableForUplink()
Set this channel as disabled for uplink.
void SetMaximumDataRate(uint8_t maxDataRate)
Set the maximum data rate that is allowed on this channel.
bool IsEnabledForUplink() const
Test whether this channel is marked as enabled for uplink.
bool m_enabledForUplink
Whether this channel can be used for uplink or not.
uint8_t GetMinimumDataRate() const
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Definition first.py:1
bool operator!=(const Ptr< LogicalLoraChannel > &first, const Ptr< LogicalLoraChannel > &second)
Overload the != operator to compare different instances of the same LogicalLoraChannel.
bool operator==(const Ptr< LogicalLoraChannel > &first, const Ptr< LogicalLoraChannel > &second)
Overload of the == operator to compare different instances of the same LogicalLoraChannel.
Every class exported by the ns3 library is enclosed in the ns3 namespace.