lora-logical-channel-helper.h
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 
23 #ifndef LORA_LOGICAL_CHANNEL_HELPER_H
24 #define LORA_LOGICAL_CHANNEL_HELPER_H
25 
26 #include "lora-logical-channel.h"
27 #include "lora-sub-band.h"
28 
29 #include <ns3/nstime.h>
30 #include <ns3/object.h>
31 #include <ns3/packet.h>
32 
33 #include <iterator>
34 #include <list>
35 #include <stdint.h>
36 #include <vector>
37 
38 namespace ns3
39 {
40 
50 class LoraLogicalChannelHelper : public Object
51 {
52  public:
53  static TypeId GetTypeId(void);
54 
56  virtual ~LoraLogicalChannelHelper();
57 
64  Time GetAggregatedWaitingTime(void);
65 
78  Time GetWaitingTime(Ptr<LoraLogicalChannel> channel);
79 
86  void AddEvent(Time duration, Ptr<LoraLogicalChannel> channel);
87 
93  std::vector<Ptr<LoraLogicalChannel>> GetChannelList(void);
94 
101  std::vector<Ptr<LoraLogicalChannel>> GetEnabledChannelList(void);
102 
108  void AddChannel(double frequency);
109 
115  void AddChannel(Ptr<LoraLogicalChannel> logicalChannel);
116 
123  void SetChannel(uint8_t chIndex, Ptr<LoraLogicalChannel> logicalChannel);
124 
134  void AddLoraSubBand(double firstFrequency,
135  double lastFrequency,
136  double dutyCycle,
137  double maxTxPowerDbm);
138 
144  void AddLoraSubBand(Ptr<LoraSubBand> subBand);
145 
151  void RemoveChannel(Ptr<LoraLogicalChannel> channel);
152 
160  double GetTxPowerForChannel(Ptr<LoraLogicalChannel> logicalChannel);
161 
168  Ptr<LoraSubBand> GetLoraSubBandFromChannel(Ptr<LoraLogicalChannel> channel);
169 
176  Ptr<LoraSubBand> GetLoraSubBandFromFrequency(double frequency);
177 
183  void DisableChannel(int index);
184 
185  private:
189  std::list<Ptr<LoraSubBand>> m_subBandList;
190 
196  std::vector<Ptr<LoraLogicalChannel>> m_channelList;
197 
202 
207 };
208 } // namespace ns3
209 
210 #endif /* LORA_LOGICAL_CHANNEL_HELPER_H */
This class supports LorawanMac instances by managing a list of the logical channels that the device i...
Time GetWaitingTime(Ptr< LoraLogicalChannel > channel)
Get the time it is necessary to wait for before transmitting on a given channel.
Ptr< LoraSubBand > GetLoraSubBandFromChannel(Ptr< LoraLogicalChannel > channel)
Get the LoraSubBand a channel belongs to.
void RemoveChannel(Ptr< LoraLogicalChannel > channel)
Remove a channel.
std::vector< Ptr< LoraLogicalChannel > > m_channelList
A vector of the LoraLogicalChannels that are currently registered within this helper.
void AddLoraSubBand(double firstFrequency, double lastFrequency, double dutyCycle, double maxTxPowerDbm)
Add a new LoraSubBand to this helper.
std::list< Ptr< LoraSubBand > > m_subBandList
A list of the LoraSubBands that are currently registered within this helper.
Ptr< LoraSubBand > GetLoraSubBandFromFrequency(double frequency)
Get the LoraSubBand a frequency belongs to.
void AddEvent(Time duration, Ptr< LoraLogicalChannel > channel)
Register the transmission of a packet.
Time m_nextAggregatedTransmissionTime
The next time at which.
void SetChannel(uint8_t chIndex, Ptr< LoraLogicalChannel > logicalChannel)
Set a new channel at a fixed index.
void DisableChannel(int index)
Disable the channel at a specified index.
void AddChannel(double frequency)
Add a new channel to the list.
std::vector< Ptr< LoraLogicalChannel > > GetChannelList(void)
Get the list of LoraLogicalChannels currently registered on this helper.
Time GetAggregatedWaitingTime(void)
Get the time it is necessary to wait before transmitting again, according to the aggregate duty cycle...
std::vector< Ptr< LoraLogicalChannel > > GetEnabledChannelList(void)
Get the list of LoraLogicalChannels currently registered on this helper that have been enabled for Up...
double GetTxPowerForChannel(Ptr< LoraLogicalChannel > logicalChannel)
Returns the maximum transmission power [dBm] that is allowed on a channel.
double m_aggregatedDutyCycle
transmission will be possible according to the aggregated transmission timer
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.