www.dragino.com
LG01-N/OLG01-N Gateway User Manual
34 / 61
5.
Example 2: Manually send / receive LoRa packets
There are two ways to use the LoRa Radio of Gateway: a) Through pkt_fwd process , b) Use the
Radio separately.
5.1
User LoRa Radio via pkt_fwd
5.1.1
Use pkt_fwd to receive
When user chooses the MQTT/TCP-IP/Customized mode, the lg01_pkt_fwd will auto start. It will
listen the LoRa Radio Channel base on the setting in the web setting.
If the LoRa end node send data in the match format, the pkt_fwd will store the data for further
use, the logic of this receive part please see
5.1.2
Use pkt_fwd to transmit
(This is a new feature since 2019-Jan-30)
The pkt_fwd also open a thread to listen to local files under directory
/var/iot/push/
. Once there
is a file in this directory, the thread will check if it is an outgoing file and send out the LoRa
message if format match. Below is the file example (json format):
{"txpk":{"imme":false,"tmst":861608339,"freq":925.1,"rfch":0,"powe":20,"modu":"L
ORA","datr":"SF7BW500","codr":"4/5","ipol":true,"size":22,"ncrc":true,"data":"YEklB
CaqCgADQAIAcQM6AP8B9TYzUA=="}}
Explain:
Name | Type | Function
:----:|:------:|--------------------------------------------------------------
imme | bool | Send packet immediately (will ignore tmst & time)
tmst | number | Send packet on a certain timestamp value (will ignore time)
tmms | number | Send packet at a certain GPS time (GPS synchronization required)
freq | number | TX central frequency in MHz (unsigned float, Hz precision)
rfch | number | Concentrator "RF chain" used for TX (unsigned integer)
powe | number | TX output power in dBm (unsigned integer, dBm precision)
modu | string | Modulation identifier "LORA" or "FSK"
datr | string | LoRa datarate identifier (eg. SF12BW500)