39 NS_LOG_COMPONENT_DEFINE(
"LoraNetworkServer");
41 NS_OBJECT_ENSURE_REGISTERED(LoraNetworkServer);
47 TypeId(
"ns3::LoraNetworkServer")
48 .SetParent<Application>()
49 .AddConstructor<LoraNetworkServer>()
52 "Trace source that is fired when a packet arrives at the Network Server",
54 "ns3::Packet::TracedCallback");
63 NS_LOG_FUNCTION_NOARGS();
68 NS_LOG_FUNCTION_NOARGS();
74 NS_LOG_FUNCTION_NOARGS();
80 NS_LOG_FUNCTION_NOARGS();
86 NS_LOG_FUNCTION(
this << gateway);
89 Ptr<PointToPointNetDevice> p2pNetDevice;
90 for (uint32_t i = 0; i < gateway->GetNDevices(); i++)
92 p2pNetDevice = gateway->GetDevice(i)->GetObject<PointToPointNetDevice>();
93 if (p2pNetDevice !=
nullptr)
101 Ptr<SatLorawanNetDevice> satLoraNetDevice =
102 DynamicCast<SatLorawanNetDevice>(gateway->GetDevice(1));
103 Ptr<LorawanMacGateway> gwMac = DynamicCast<LorawanMacGateway>(satLoraNetDevice->GetMac());
104 NS_ASSERT(gwMac !=
nullptr);
107 Address gatewayAddress = p2pNetDevice->GetAddress();
110 Ptr<LoraGatewayStatus> gwStatus = Create<LoraGatewayStatus>(gatewayAddress, netDevice, gwMac);
112 m_status->AddGateway(gatewayAddress, gwStatus);
118 NS_LOG_FUNCTION_NOARGS();
121 NodeContainer::Iterator it;
122 for (it = nodes.Begin(); it != nodes.End(); it++)
131 NS_LOG_FUNCTION(
this << node);
134 Ptr<SatLorawanNetDevice> loraNetDevice;
135 for (uint32_t i = 0; i < node->GetNDevices(); i++)
137 loraNetDevice = DynamicCast<SatLorawanNetDevice>(node->GetDevice(i));
138 if (loraNetDevice !=
nullptr)
146 Ptr<LorawanMacEndDeviceClassA> edLorawanMac =
147 DynamicCast<LorawanMacEndDeviceClassA>(loraNetDevice->GetMac());
155 Ptr<const Packet> packet,
157 const Address& address)
159 NS_LOG_FUNCTION(
this << packet << protocol << address);
168 m_status->OnReceivedPacket(packet, address);
179 NS_LOG_FUNCTION(
this << component);
184 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.