# LTM-LoRaWAN: A Multi-Hop Communication System for LoRaWAN
## 3 Proposed Protocol Design
### MAC Mechanism to Facilitate Transmission and Forwarding  
End devices in the proposed system implement the class A approach, which is the most implemented class, consumes the least amount of power compared to other classes, and provides the least functionalities of the LoRaWAN network. Similar to other classes, class A uses ALOHA as the medium access algorithm. An uplink transmission by an end device is followed by two short receive windows named RX1 and RX2. However, the proposed system opts for optimizing the ALOHA protocol by out-of-range devices to allow them to deliver their traffic to the main network server. Thus extending the coverage of the LoRaWAN network using a multi-hop strategy. Once an end device finds itself out of the range of the gateway based on phase one, it immediately employs a different scheme for medium access similar to Listen-Before-Talk (LBT) named Listen-To-Talk (LTT).  
Differently from the traditional access scheme employed using the standard end device, the proposed medium access scheme forbids out-of-range devices to directly transmit their messages whenever they need to. Instead, the proposed system requires an out-of-range device to employ the Listen-To-Talk scheme. According to the utilized LTT, an out-of-range device starts the lifecycle of transmission by listening to other neighboring devices in advance of transmitting its traffic. Once the device senses an uplink transmission, the Listening phase of the LTT mechanism is finished. The listened uplink transmission indicates that there would be two receive windows following the transmission. This is possible since end devices use broadcasting when transmitting their messages toward LoRaWAN gateways, and hence, such transmission by closer-to-the-edge devices can be sensed by out-of-range devices. Thus, the proposed system utilizes these two windows to coincide out-of-range device transmission with one of the aforementioned two receive windows. In other words, the two receive windows of standard end devices are utilized by out-of-range devices to initiate their uplink communication. This constitutes the Talk phase of the employed LTT by the out-of-range device. Figure 4 shows the standard MAC operations for in-range and the LTT operation for out-of-range devices. After sensing and receiving a transmission, an out-of-range device delays its transmission for a while, then starts the transmission, hoping that such uplink traffic would coincide with one of the two receive windows. Once the transmission finishes, the end device sleeps until the next transmission is needed. The process of transmitting an uplink message for an end device in the proposed system is illustrated in Figure 5.  
Figure 4: MAC operation timing for the proposed system.  
The second part of the second phase is the forwarding procedure that must be accomplished using other LoRaWAN end devices that have just received the message from an out-of-range device. The forwarding end device is expected to receive the message for forwarding during one of its two receive windows. Upon receiving and recognizing the message as a message for forwarding, the forwarding device cancels the other receiving window if it was in the first, sets its transmission parameters, such as SF and transmission power, to the received frame, and starts the transmission. It should be noted that the forwarding end device does not open any other receive windows and should go to sleep mode after the forwarding procedure. The pseudocode for the forwarding procedure is shown in Algorithm 2.  
```
1:PKT: End device Packet for transmission
2:SF: Spreading Factor
3:TP: Transmission Power
4:TTL: Time-To-Live
5:RCVW: Receive Window
6:For each received PKT do
7:If (PKT for forwarding & I can see the gateway)
8:decrease PKT's TTL
9:set SF & TP
10: cancel other RCVW if any
11:insert PKT into Transmission Queue
12:schedule PKT for transmission
13:End if
14:End for
```  
**Algorithm 2**Pseudocode for the Forwarding Procedure  
Figure 5: Transmission of an uplink message diagram.