Gateway TLG3901B/BLV2 Series User Manual
V2.0.4
39
December 2020
4.1.3.
Implement a Simple Protocol
This section provides a simple protocol written in LoRaScript, List 4-6, that a beacon packet
is emitted every 10 seconds and received packets is forwarding to remote server. In addition,
it also accepts downlink data from network to sending the data to LoRa nodes. By utilizing
this protocol, a TDMA protocol can be implemented on LoRa nodes. Each LoRa node waits
for a beacon and sends packet in predefined delay after receiving a beacon, as shown in
Figure 4-3 Illustration of TDMA. Because gateway can simultaneously receive 49 different
channels, each channel presents a TDMA protocol. Therefore, a lot of nodes can be served
in the same time. But note that channels with different spreading factor have different data
rate, it must be careful to calculate transmission time of data and assign period of each time
slot.
Figure 4-3 Illustration of TDMA
List 4-6 A Simple Protocol in LoRaScript
var dgram;
//server address for forwarding uplink data
var server_port = 5555;
var server_ip = '192.168.31.200';
var udp_sock;
//command port for accepting downlink data
var cmd_port = 5556;
var cmd_sock;
var update_cmd = false;
var cmd_node_address;
var cmd_node_data;
var beacon_channel = {
imme:true,
freq:915.1,