The LoRa Gateway provides some socket interfaces, configurable in gateway.txt:
- ServerPort - TCP/IP server socket, allowing a single client. Sends status and packet information in JSON format. Also allows for gateway settings (e.g. frequency) to be polled or changed.
- DataPort - TCP/IP server socket, allowing a single client. Sends raw telemetry packets (e.g. $$...).
- UDPPort - UDP client broadcast socket, sending raw telemetry.
- OziPlotterPort - UDP client broadcast socket, sending basic telemetry reformatted as OziPlotter CSV format.
- OziMuxPort - UDP client broadcast socket, sending basic telemetry reformatted as OziMux JSON format.
This port has several functions:
- Sends telemetry packets, soon after they are received.
- Sends RSSI, every 100ms
- Accept single-word commands
- Accept new settings
- Accept messages to send to HAB
These are JSON packets with these fields:
- class = "POSN"
- index = Payload index - from 0 up to max payloads (32 currently) minus 1.
- channel = LoRa module channel (SPI channel) - 0 or 1
- payload = payload ID
- time = UTC time from payload
- lat = Latitude from payload
- lon = Longitude from payload
- alt = Altitude from payload
- rate = Calculated ascent (+ve) or descent (-ve) rate, as calculated by gateway
- sentence = Raw sentence sent by payload, including CRC, excluding terminating LF.
Example:
{"class":"POSN","index":0,"channel":1,"payload":"RTLS3","time":"14:59:07","lat":
51.95068,"lon":-2.54703,"alt":59,"rate":0.0,"sentence":"$$RTLS3,1,14:59:07,51.95
068,-2.54703,00059,0,0,11,34.7,26.5,987,35.7,0.50,0.00000,0.00000,0.0,0,None,92,
0,0,0,0,0.0,0.0,0.0,0.0,0.0,0,0,0,0,0,0.0,0,0,0.0,0,0,0.0,0.0*FA61"}
To Do ...
All commands are case-insensitive, and are terminated with a .
Returns the current gateway settings. Sample excerpt:
{"class":"SET","set":"tracker","val":"M0RPI/5"}
{"class":"SET","set":"EnableHabitat","val":0}
{"class":"SET","set":"EnableSSDV","val":0}
{"class":"SET","set":"LogTelemetry","val":1}
{"class":"SET","set":"LogPackets","val":0}
{"class":"SET","set":"CallingTimeout","val":60}
Saves the current gateway settings to gateway.txt.
General format is "[setting]=[new value]"
e.g.:
tracker=M0RPI
frequency_0=434.450
Format is "send:[message]"