www.dragino.com
LG02 LoRa Gateway User Manual
34 / 63
5.
Example 2: Control LoRa radio directly as general LoRa transceiver
There are two ways to use the LoRa Radio of Gateway: a) Through pkt_fwd process , b) Use the
Radio SPI device 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 lg02_pkt_fwd will auto start. It will
listen the LoRa Radio Channel 1 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)