35 #include "ns3/singleton.h"
41 NS_LOG_COMPONENT_DEFINE(
"LoraNetworkServer");
43 NS_OBJECT_ENSURE_REGISTERED(LoraNetworkServer);
49 TypeId(
"ns3::LoraNetworkServer")
50 .SetParent<Application>()
51 .AddConstructor<LoraNetworkServer>()
54 "Trace source that is fired when a packet arrives at the Network Server",
56 "ns3::Packet::TracedCallback");
65 NS_LOG_FUNCTION_NOARGS();
70 NS_LOG_FUNCTION_NOARGS();
76 NS_LOG_FUNCTION_NOARGS();
82 NS_LOG_FUNCTION_NOARGS();
88 NS_LOG_FUNCTION(
this << gateway);
91 Ptr<PointToPointNetDevice> p2pNetDevice;
92 for (uint32_t i = 0; i < gateway->GetNDevices(); i++)
94 p2pNetDevice = gateway->GetDevice(i)->GetObject<PointToPointNetDevice>();
95 if (p2pNetDevice !=
nullptr)
103 Address gatewayAddress = p2pNetDevice->GetAddress();
106 switch (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode())
109 Ptr<SatLorawanNetDevice> satLoraNetDevice =
110 DynamicCast<SatLorawanNetDevice>(gateway->GetDevice(1));
111 Ptr<LorawanMacGateway> gwMac = DynamicCast<LorawanMacGateway>(satLoraNetDevice->GetMac());
113 Ptr<LoraGatewayStatus> gwStatus =
114 Create<LoraGatewayStatus>(gatewayAddress, netDevice, gwMac);
115 m_status->AddGateway(gateway, gatewayAddress, gwStatus);
120 Ptr<LoraGatewayStatus> gwStatus =
121 Create<LoraGatewayStatus>(gatewayAddress, netDevice,
nullptr);
122 m_status->AddGateway(gateway, gatewayAddress, gwStatus);
126 NS_FATAL_ERROR(
"Incorrect regeneration mode for LORA");
133 NS_LOG_FUNCTION_NOARGS();
136 NodeContainer::Iterator it;
137 for (it = nodes.Begin(); it != nodes.End(); it++)
146 NS_LOG_FUNCTION(
this << node);
149 Ptr<SatLorawanNetDevice> loraNetDevice;
150 for (uint32_t i = 0; i < node->GetNDevices(); i++)
152 loraNetDevice = DynamicCast<SatLorawanNetDevice>(node->GetDevice(i));
153 if (loraNetDevice !=
nullptr)
161 Ptr<LorawanMacEndDeviceClassA> edLorawanMac =
162 DynamicCast<LorawanMacEndDeviceClassA>(loraNetDevice->GetMac());
170 Ptr<const Packet> packet,
172 const Address& address)
174 NS_LOG_FUNCTION(
this << packet << protocol << address);
183 m_status->OnReceivedPacket(packet, address);
194 NS_LOG_FUNCTION(
this << component);
199 Ptr<LoraNetworkStatus>
This class collects a series of components that deal with various aspects of managing the network,...
bool Receive(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &address)
Receive a packet from a gateway.
TracedCallback< Ptr< const Packet > > m_receivedPacket
static TypeId GetTypeId(void)
virtual ~LoraNetworkServer()
void StartApplication(void)
Start the NS application.
void AddGateway(Ptr< Node > gateway, Ptr< NetDevice > netDevice)
Add this gateway to the list of gateways connected to this NS.
Ptr< LoraNetworkStatus > m_status
void AddNodes(NodeContainer nodes)
Inform the LoraNetworkServer that these nodes are connected to the network.
Ptr< LoraNetworkScheduler > m_scheduler
void AddNode(Ptr< Node > node)
Inform the LoraNetworkServer that this node is connected to the network.
void StopApplication(void)
Stop the NS application.
void AddComponent(Ptr< LoraNetworkControllerComponent > component)
A NetworkControllerComponent to this LoraNetworkServer instance.
Ptr< LoraNetworkController > m_controller
Ptr< LoraNetworkStatus > GetNetworkStatus(void)
This class represents the knowledge about the state of the network that is available at the Network S...
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.