lora-network-status.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 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  * Authors: Martina Capuzzo <capuzzom@dei.unipd.it>
19  * Davide Magrin <magrinda@dei.unipd.it>
20  *
21  * Modified by: Bastien Tauran <bastien.tauran@viveris.fr>
22  */
23 
24 #ifndef LORA_NETWORK_STATUS_H
25 #define LORA_NETWORK_STATUS_H
26 
27 #include "lora-device-address.h"
28 #include "lora-end-device-status.h"
29 #include "lora-gateway-status.h"
30 #include "lora-network-scheduler.h"
32 
33 #include <ns3/point-to-point-net-device.h>
34 
35 #include <iterator>
36 #include <map>
37 
38 namespace ns3
39 {
40 
50 class LoraNetworkStatus : public Object
51 {
52  public:
53  static TypeId GetTypeId(void);
54 
56  virtual ~LoraNetworkStatus();
57 
61  void AddNode(Ptr<LorawanMacEndDeviceClassA> edMac);
62 
68  void AddGateway(Ptr<Node> gw, Address& address, Ptr<LoraGatewayStatus> gwStatus);
69 
76  void OnReceivedPacket(Ptr<const Packet> packet, const Address& gwaddress);
77 
83  bool NeedsReply(LoraDeviceAddress deviceAddress);
84 
91  Address GetBestGatewayForDevice(LoraDeviceAddress deviceAddress, int window);
92 
100  void SendThroughGateway(Ptr<Packet> packet, Address gwAddress);
101 
105  Ptr<Packet> GetReplyForDevice(LoraDeviceAddress edAddress, int windowNumber);
106 
110  Ptr<LoraEndDeviceStatus> GetEndDeviceStatus(Ptr<const Packet> packet);
111 
115  Ptr<LoraEndDeviceStatus> GetEndDeviceStatus(LoraDeviceAddress address);
116 
120  int CountEndDevices(void);
121 
122  public:
123  std::map<LoraDeviceAddress, Ptr<LoraEndDeviceStatus>> m_endDeviceStatuses;
124  std::map<Address, Ptr<LoraGatewayStatus>> m_gatewayStatuses;
125 
126  std::map<Ptr<Node>, Ptr<PointToPointNetDevice>> m_gws;
127 
129 
130  Ptr<UniformRandomVariable> m_uniform;
131 };
132 
133 } // namespace ns3
134 #endif /* LORA_NETWORK_STATUS_H */
This class represents the device address of a LoraWAN End Device.
This class represents the knowledge about the state of the network that is available at the Network S...
void AddNode(Ptr< LorawanMacEndDeviceClassA > edMac)
Add a device to the ones that are tracked by this LoraNetworkStatus object.
void OnReceivedPacket(Ptr< const Packet > packet, const Address &gwaddress)
Update network status on the received packet.
std::map< Ptr< Node >, Ptr< PointToPointNetDevice > > m_gws
void AddGateway(Ptr< Node > gw, Address &address, Ptr< LoraGatewayStatus > gwStatus)
Add this gateway to the list of gateways connected to the network.
Ptr< Packet > GetReplyForDevice(LoraDeviceAddress edAddress, int windowNumber)
Get the reply for the specified device address.
Address GetBestGatewayForDevice(LoraDeviceAddress deviceAddress, int window)
Return whether we have a gateway that is available to send a reply to the specified device.
static TypeId GetTypeId(void)
Ptr< LoraEndDeviceStatus > GetEndDeviceStatus(Ptr< const Packet > packet)
Get the EndDeviceStatus for the device that sent a packet.
Ptr< UniformRandomVariable > m_uniform
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
bool NeedsReply(LoraDeviceAddress deviceAddress)
Return whether the specified device needs a reply.
int CountEndDevices(void)
Return the number of end devices currently managed by the server.
void SendThroughGateway(Ptr< Packet > packet, Address gwAddress)
Send a packet through a Gateway.
std::map< Address, Ptr< LoraGatewayStatus > > m_gatewayStatuses
std::map< LoraDeviceAddress, Ptr< LoraEndDeviceStatus > > m_endDeviceStatuses
RegenerationMode_t
The regeneration mode used in satellites.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.