## 3 Hybrid Topology Architecture
### Procedure Description  
LoRaWAN specifications describe a star-shaped topology as the design to be used for the wireless end of the network. That is, using point-to-point connections between end devices and gateways without any routing or alternative processes for enabling communication. In a typical LoRaWAN network, the gateway bridges the wireless end of the network, which uses the LoRa physical layer specifications, with the wired end, which utilizes the MQTT protocol to exchange uplink and downlink information with the LoRaWAN server tasked with managing the network. However, LoRaWAN specifications do not include other topology functionalities that would help address some of LoRaWAN's limitations, specifically, those related to extending the coverage of the network. Our proposal provides a solution allowing for the coexistence of star and mesh adaptable network topologies in LoRaWAN, as illustrated in Figure 1.  
LoRaWAN networks require end devices to be activated prior to network establishment. The proposed adaptable hybrid network topology coexistence functionality sets the elements of the network to use a star topology by default with ABP (activation by personalization) as the activation method. Using the manual configuration of cipher keys \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Reference** & **Protocol** & **Topology** & **Topology Coexistence** &
\begin{tabular}{c} **Dynamic Network** \\ **Configuration** \\ \end{tabular} \\ \hline
[31] & LoRaWAN/LoRaMesh & Star and mesh & Yes & No \\ \hline
[33] & LoRaWAN & Multi-hop (Relay) & No & No \\ \hline
[23] & LoRaWAN/LoRaMesh & Star and mesh & \
\begin{tabular}{c} No (switches from \\ only star to only mesh) \\ \end{tabular} &
\begin{tabular}{c} Yes \\ (complete network) \\ \end{tabular} \\ \hline
[34] & LoRaWAN/LoRaMesh & Star and mesh & Yes & No \\ \hline Our proposal & LoRaWAN & Star and mesh & Yes & Yes (device per device) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of LoRaWAN hybrid solutions. Figure 1: Architecture of a LoRaWAN network with the proposed hybrid topology procedure. from ABP ensures the correct handling of messages even when the operation mode is changed to mesh. The end devices send data to the gateway, which is connected to the Internet and has been previously configured with the connection establishment parameters associated with the LoRaWAN server. Data is then formatted in JSON (JavaScript object notation) and transmitted to the Server using the MQTT publish-subscribe protocol. As the proposed mechanism allows multi-hop communication between LoRaWAN end devices, the MQTT packets that one end device delivers to the MQTT broker may originate from other end devices. Thus, the MQTT packets are first published in an intermediate topic at the MQTT broker. Then, data packets are sorted and published in their respective default Chirpstack topics according to their end device of origin. Data received at the server are then stored for later analysis and visualization. This new hybrid topology functionality for LoRaWAN has been designed to be fully compliant with the approved specifications defining the LoRaWAN protocol. Therefore, it can be deployed in the existing infrastructure in a simple, seamless, fast, and effective way. The hybrid topology procedure is agnostic to the LoRaWAN server and introduces a new element called the topology manager. It provides the control plane with intelligent capabilities, enabling the topology change of the wireless end of the network while being completely transparent to the Chirpstack LoRaWAN server. SNR and RSSI network link quality data are provided in LoRaWAN messages. These data are available at the LoRaWAN server, but are extracted and stored in a separate database for the topology manager to analyze them. The topology manager uses this information to assess performance and reaches a decision about the need to change the topology.