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 <iterator>
34 
35 namespace ns3
36 {
37 
47 class LoraNetworkStatus : public Object
48 {
49  public:
50  static TypeId GetTypeId(void);
51 
53  virtual ~LoraNetworkStatus();
54 
58  void AddNode(Ptr<LorawanMacEndDeviceClassA> edMac);
59 
65  void AddGateway(Address& address, Ptr<LoraGatewayStatus> gwStatus);
66 
73  void OnReceivedPacket(Ptr<const Packet> packet, const Address& gwaddress);
74 
80  bool NeedsReply(LoraDeviceAddress deviceAddress);
81 
88  Address GetBestGatewayForDevice(LoraDeviceAddress deviceAddress, int window);
89 
97  void SendThroughGateway(Ptr<Packet> packet, Address gwAddress);
98 
102  Ptr<Packet> GetReplyForDevice(LoraDeviceAddress edAddress, int windowNumber);
103 
107  Ptr<LoraEndDeviceStatus> GetEndDeviceStatus(Ptr<const Packet> packet);
108 
112  Ptr<LoraEndDeviceStatus> GetEndDeviceStatus(LoraDeviceAddress address);
113 
117  int CountEndDevices(void);
118 
119  public:
120  std::map<LoraDeviceAddress, Ptr<LoraEndDeviceStatus>> m_endDeviceStatuses;
121  std::map<Address, Ptr<LoraGatewayStatus>> m_gatewayStatuses;
122 };
123 
124 } // namespace ns3
125 #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.
Ptr< Packet > GetReplyForDevice(LoraDeviceAddress edAddress, int windowNumber)
Get the reply for the specified device address.
void AddGateway(Address &address, Ptr< LoraGatewayStatus > gwStatus)
Add this gateway to the list of gateways connected to the network.
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.
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
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.