## 4 Proposed Solution
### Lightweight Dynamic Communication Protocol  
Along with the LoRa interface, the WSN coverage can be further enhanced by introducing a mobile DS. However, mobility in the WSN makes the topology dynamic; hence, the communication protocol becomes complicated, demanding more processing resources and energy. Therefore, a lightweight and dynamic protocol is crucial to cope with the dynamic topology while maintaining a long WSN lifetime. This protocol involves both the SNs and DS to keep the WSN homogenous (in terms of energy consumption of the SNs) and to make it dynamic for the mobile DS. The SN needs to have the capability to reconfigure itself for the different network topologies, such as star and tree topology. In the star topology, all the SNs will communicate directly with the DS. In the tree or mesh type, most SNs communicate with another SN called the repeater node (RN) which maintains the DS's connectivity. A lightweight algorithm for the SN is also developed to reconfigure it as an edge SN or RN dynamically, depending on the direct or single-hop routing requirement for the proposed LDAP. As the proposed LDAP is based on the LoRa-PHY layer, unlike LoRaWAN, a DS-controlled channel access scheme is implemented along with pre-configured addressing for the SNs. The main assumptions are:  
* Each SN and DS has its unique fixed ID;
* All the SNs are homogeneous in terms of resource and residual energy;
* The SN is static, and the DS is static or mobile;
* All SNs and the DS transmit their signals at a fixed transmit power; and
* The mobile DS travel path is well planned prior to data acquisition. This proposed protocol is a master-initiated communication protocol to keep better synchronization in the WSN. Figure 4 shows the message format without the LoRa packet header. A single packet can be 12 to 256 bytes. Packet transmitter and receiver types (ST, RT) can be any of the DS, RN, or SN. Table 3 describes all the fields of the WARM-packet with example values. ST and RT facilitate the SN and DS to configure the WSN dynamically as a star or tree topology according to the WARM requirement. SQN keeps track of the link between the data request to data received in order to cope with the multi-node transmission, mainly in a tree network. PLT and EOM facilitate a multi-packet data transfer for a payload larger than 245 bytes. A multi-packet data transfer can be implemented for offline data acquisition by the mobile DS or for sensor data acquisition at a very high rate, such as multiple samples for every transfer interval. The payload consists of the sensor data, measured parameter unit, and timestamp. It also includes the node ID to implement the message transfer by the repeater node. The LDAP has three phases: initialization, configuration, and routing. In the initialization phase, the SN configures itself automatically with the sensors connected. The parameters need to be acquired, including the interval for data acquisition and the node's initial energy state. This configuration can also be done at the beginning of the WSN deployment or at any time required by using the configuration message (MID = 5). For the mobility of at DS, both configuration and routing phases are performed simultaneously in the data transfer request message (MID = 1). The WARM configuration message (MID = 4) is also implemented for a fixed topology while using a static DS. The acknowledgment message (MID = 2) is implemented for the synchronization of the data transmission message (MID = 3) to enable sensor data transmission from the edge SN to the DS or RN, and from the RN to the DS. Figure 5a shows the direct DS to SN data transfer protocol. Figure 5b shows the configuration and data transmission from the DS to SN through the RN, and Figure 5c shows the data transfer protocol between the SN and RN. Every data transfer from the SN to DS through the RN ensures a single-hop data transmission to reduce data transfer energy consumption.