A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
logical-lora-channel.h
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#ifndef LOGICAL_LORA_CHANNEL_H
10#define LOGICAL_LORA_CHANNEL_H
11
12#include "sub-band.h"
13
14#include "ns3/object.h"
15
16namespace ns3
17{
18namespace lorawan
19{
20
21class SubBand;
22
23/**
24 * \ingroup lorawan
25 *
26 * This class represents a logical LoRaWAN channel.
27 *
28 * A logical channel is characterized by a central frequency and a range of data
29 * rates that can be sent on it.
30 *
31 * Furthermore, a LogicalLoraChannel can be marked as enabled or disabled for
32 * uplink transmission.
33 */
35{
36 public:
37 /**
38 * Register this type.
39 * \return The object TypeId.
40 */
41 static TypeId GetTypeId();
42
43 LogicalLoraChannel(); //!< Default constructor
44 ~LogicalLoraChannel() override; //!< Destructor
45
46 /**
47 * Construct a new LogicalLoraChannel object initializing the carrier frequency.
48 *
49 * \param frequency The carrier frequency [MHz].
50 */
51 LogicalLoraChannel(double frequency);
52
53 /**
54 * Constructor providing initialization of frequency and data rate limits.
55 *
56 * \param frequency This channel's frequency [MHz].
57 * \param minDataRate This channel's minimum data rate.
58 * \param maxDataRate This channel's maximum data rate.
59 */
60 LogicalLoraChannel(double frequency, uint8_t minDataRate, uint8_t maxDataRate);
61
62 /**
63 * Get the frequency (MHz).
64 *
65 * \return The center frequency of this channel.
66 */
67 double GetFrequency() const;
68
69 // void SetFrequency (double frequencyMHz);
70
71 /**
72 * Set the minimum data rate that is allowed on this channel.
73 *
74 * \param minDataRate The minimum data rate value.
75 */
76 void SetMinimumDataRate(uint8_t minDataRate);
77
78 /**
79 * Set the maximum data rate that is allowed on this channel.
80 *
81 * \param maxDataRate The maximum data rate value.
82 */
83 void SetMaximumDataRate(uint8_t maxDataRate);
84
85 /**
86 * Get the minimum data rate that is allowed on this channel.
87 *
88 * \return The minimum data rate value.
89 */
90 uint8_t GetMinimumDataRate() const;
91
92 /**
93 * Get the maximum data rate that is allowed on this channel.
94 *
95 * \return The maximum data rate value.
96 */
97 uint8_t GetMaximumDataRate() const;
98
99 /**
100 * Set this channel as enabled for uplink.
101 */
102 void SetEnabledForUplink();
103
104 /**
105 * Set this channel as disabled for uplink.
106 */
107 void DisableForUplink();
108
109 /**
110 * Test whether this channel is marked as enabled for uplink.
111 *
112 * \return True if the channel can be used for uplink, false otherwise.
113 */
114 bool IsEnabledForUplink() const;
115
116 private:
117 double m_frequency; //!< The central frequency of this channel, in MHz.
118 uint8_t m_minDataRate; //!< The minimum data rate that is allowed on this channel.
119 uint8_t m_maxDataRate; //!< The maximum data rate that is allowed on this channel.
120 bool m_enabledForUplink; //!< Whether this channel can be used for uplink or not.
121};
122
123/**
124 * Overload of the == operator to compare different instances of the same LogicalLoraChannel
125 */
127
128/**
129 * Overload the != operator to compare different instances of the same LogicalLoraChannel
130 */
132
133} // namespace lorawan
134
135} // namespace ns3
136#endif /* LOGICAL_LORA_CHANNEL_H */
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
This class represents a logical LoRaWAN channel.
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.
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.