This class represents the knowledge about the state of the network that is available at the Network Server. More...
#include "lora-network-status.h"
Public Member Functions | |
LoraNetworkStatus () | |
virtual | ~LoraNetworkStatus () |
void | AddGateway (Address &address, Ptr< LoraGatewayStatus > gwStatus) |
Add this gateway to the list of gateways connected to the network. More... | |
void | AddNode (Ptr< LorawanMacEndDeviceClassA > edMac) |
Add a device to the ones that are tracked by this LoraNetworkStatus object. More... | |
int | CountEndDevices (void) |
Return the number of end devices currently managed by the server. More... | |
Address | GetBestGatewayForDevice (LoraDeviceAddress deviceAddress, int window) |
Return whether we have a gateway that is available to send a reply to the specified device. More... | |
Ptr< LoraEndDeviceStatus > | GetEndDeviceStatus (LoraDeviceAddress address) |
Get the EndDeviceStatus corresponding to a LoraDeviceAddress. More... | |
Ptr< LoraEndDeviceStatus > | GetEndDeviceStatus (Ptr< const Packet > packet) |
Get the EndDeviceStatus for the device that sent a packet. More... | |
Ptr< Packet > | GetReplyForDevice (LoraDeviceAddress edAddress, int windowNumber) |
Get the reply for the specified device address. More... | |
bool | NeedsReply (LoraDeviceAddress deviceAddress) |
Return whether the specified device needs a reply. More... | |
void | OnReceivedPacket (Ptr< const Packet > packet, const Address &gwaddress) |
Update network status on the received packet. More... | |
void | SendThroughGateway (Ptr< Packet > packet, Address gwAddress) |
Send a packet through a Gateway. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Public Attributes | |
std::map< LoraDeviceAddress, Ptr< LoraEndDeviceStatus > > | m_endDeviceStatuses |
std::map< Address, Ptr< LoraGatewayStatus > > | m_gatewayStatuses |
This class represents the knowledge about the state of the network that is available at the Network Server.
It is essentially a collection of two maps: one containing DeviceStatus objects, and the other containing GatewayStatus objects.
This class is meant to be queried by NetworkController components, which can decide to take action based on the current status of the network.
Definition at line 47 of file lora-network-status.h.
ns3::LoraNetworkStatus::LoraNetworkStatus | ( | ) |
Definition at line 51 of file lora-network-status.cc.
|
virtual |
Definition at line 56 of file lora-network-status.cc.
void ns3::LoraNetworkStatus::AddGateway | ( | Address & | address, |
Ptr< LoraGatewayStatus > | gwStatus | ||
) |
Add this gateway to the list of gateways connected to the network.
Each GW is identified by its Address in the NS-GW network.
Definition at line 83 of file lora-network-status.cc.
References m_gatewayStatuses.
void ns3::LoraNetworkStatus::AddNode | ( | Ptr< LorawanMacEndDeviceClassA > | edMac | ) |
Add a device to the ones that are tracked by this LoraNetworkStatus object.
Definition at line 62 of file lora-network-status.cc.
References m_endDeviceStatuses, and ns3::LoraDeviceAddress::Print().
int ns3::LoraNetworkStatus::CountEndDevices | ( | void | ) |
Return the number of end devices currently managed by the server.
Definition at line 251 of file lora-network-status.cc.
References m_endDeviceStatuses.
Address ns3::LoraNetworkStatus::GetBestGatewayForDevice | ( | LoraDeviceAddress | deviceAddress, |
int | window | ||
) |
Return whether we have a gateway that is available to send a reply to the specified device.
deviceAddress | the address of the device we are interested in. |
Definition at line 127 of file lora-network-status.cc.
References m_endDeviceStatuses, and m_gatewayStatuses.
Ptr< LoraEndDeviceStatus > ns3::LoraNetworkStatus::GetEndDeviceStatus | ( | LoraDeviceAddress | address | ) |
Get the EndDeviceStatus corresponding to a LoraDeviceAddress.
Definition at line 234 of file lora-network-status.cc.
References m_endDeviceStatuses.
Ptr< LoraEndDeviceStatus > ns3::LoraNetworkStatus::GetEndDeviceStatus | ( | Ptr< const Packet > | packet | ) |
Get the EndDeviceStatus for the device that sent a packet.
Definition at line 211 of file lora-network-status.cc.
References ns3::LoraFrameHeader::GetAddress(), and m_endDeviceStatuses.
Ptr< Packet > ns3::LoraNetworkStatus::GetReplyForDevice | ( | LoraDeviceAddress | edAddress, |
int | windowNumber | ||
) |
Get the reply for the specified device address.
Definition at line 180 of file lora-network-status.cc.
References m_endDeviceStatuses, ns3::LoraBeamTag::SetBeamId(), ns3::LoraTag::SetDataRate(), ns3::LoraTag::SetFrequency(), and ns3::LoraTag::SetModcod().
|
static |
Definition at line 45 of file lora-network-status.cc.
bool ns3::LoraNetworkStatus::NeedsReply | ( | LoraDeviceAddress | deviceAddress | ) |
Return whether the specified device needs a reply.
deviceAddress | the address of the device we are interested in. |
Definition at line 120 of file lora-network-status.cc.
References m_endDeviceStatuses.
void ns3::LoraNetworkStatus::OnReceivedPacket | ( | Ptr< const Packet > | packet, |
const Address & | gwaddress | ||
) |
Update network status on the received packet.
packet | the received packet. |
address | the gateway this packet was received from. |
Definition at line 99 of file lora-network-status.cc.
References ns3::LoraFrameHeader::GetAddress(), m_endDeviceStatuses, and ns3::LoraFrameHeader::SetAsUplink().
void ns3::LoraNetworkStatus::SendThroughGateway | ( | Ptr< Packet > | packet, |
Address | gwAddress | ||
) |
Send a packet through a Gateway.
This function assumes that the packet is already tagged with a LoraTag that will inform the gateway of the parameters to use for the transmission.
Definition at line 172 of file lora-network-status.cc.
References m_gatewayStatuses.
std::map<LoraDeviceAddress, Ptr<LoraEndDeviceStatus> > ns3::LoraNetworkStatus::m_endDeviceStatuses |
Definition at line 120 of file lora-network-status.h.
Referenced by AddNode(), CountEndDevices(), GetBestGatewayForDevice(), GetEndDeviceStatus(), GetReplyForDevice(), NeedsReply(), and OnReceivedPacket().
std::map<Address, Ptr<LoraGatewayStatus> > ns3::LoraNetworkStatus::m_gatewayStatuses |
Definition at line 121 of file lora-network-status.h.
Referenced by AddGateway(), GetBestGatewayForDevice(), and SendThroughGateway().