25 #include <ns3/double.h>
27 #include <ns3/lora-forwarder.h>
28 #include <ns3/random-variable-stream.h>
29 #include <ns3/satellite-topology.h>
30 #include <ns3/simulator.h>
31 #include <ns3/singleton.h>
32 #include <ns3/string.h>
33 #include <ns3/trace-source-accessor.h>
38 NS_LOG_COMPONENT_DEFINE(
"LoraForwarderHelper");
43 NS_OBJECT_ENSURE_REGISTERED(LoraForwarderHelper);
48 static TypeId tid = TypeId(
"ns3::LoraForwarderHelper")
50 .AddConstructor<LoraForwarderHelper>();
56 m_factory.SetTypeId(
"ns3::LoraForwarder");
72 switch (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode())
81 NS_FATAL_ERROR(
"Incorrect regeneration mode for LORA");
88 ApplicationContainer apps;
89 for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
100 NS_LOG_FUNCTION(
this << node);
105 node->AddApplication(app);
108 for (uint32_t i = 0; i < node->GetNDevices(); i++)
110 Ptr<NetDevice> currentNetDevice = node->GetDevice(i);
113 Ptr<SatLorawanNetDevice> loraNetDevice =
115 uint8_t beamId = loraNetDevice->
GetMac()->GetBeamId();
116 app->SetLoraNetDevice(beamId, loraNetDevice);
117 loraNetDevice->SetReceiveNetworkServerCallback(
120 else if (currentNetDevice->GetObject<PointToPointNetDevice>() !=
nullptr)
122 Ptr<PointToPointNetDevice> pointToPointNetDevice =
123 currentNetDevice->GetObject<PointToPointNetDevice>();
124 app->SetPointToPointNetDevice(pointToPointNetDevice);
125 pointToPointNetDevice->SetReceiveCallback(
136 NS_LOG_FUNCTION(
this << node);
141 node->AddApplication(app);
144 for (uint32_t i = 0; i < node->GetNDevices(); i++)
146 Ptr<NetDevice> currentNetDevice = node->GetDevice(i);
149 Ptr<SatLorawanNetDevice> loraNetDevice =
151 uint8_t beamId = loraNetDevice->
GetMac()->GetBeamId();
152 app->SetLoraNetDevice(beamId, loraNetDevice);
153 loraNetDevice->SetReceiveNetworkServerCallback(
156 else if (currentNetDevice->GetObject<PointToPointNetDevice>() !=
nullptr)
158 Ptr<PointToPointNetDevice> pointToPointNetDevice =
159 currentNetDevice->GetObject<PointToPointNetDevice>();
160 app->SetPointToPointNetDevice(pointToPointNetDevice);
161 pointToPointNetDevice->SetReceiveCallback(
Ptr< Application > InstallPrivGwDvb(Ptr< Node > node) const
Install if ground GW is a DVB GW.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< Application > InstallPrivGwLora(Ptr< Node > node) const
Install if ground GW is a Lora GW.
ApplicationContainer Install(NodeContainer c) const
static TypeId GetTypeId(void)
Get the type ID.
This application forwards packets between NetDevices: SatLorawanNetDevice -> PointToPointNetDevice an...
bool ReceiveFromLora(Ptr< SatLorawanNetDevice > loraNetDevice, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the LoraNetDevice.
bool ReceiveFromPointToPoint(Ptr< NetDevice > pointToPointNetDevice, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the PointToPointNetDevice.
SatLorawanNetDevice to be utilized in the UT and GW nodes for IoT configuration.
Ptr< SatMac > GetMac(void) const
Get a Mac pointer.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.