LoRa communication from PHP
PHP Class LoraComm
Communication via LRC (Thingpark) with your LoRa devices, secured by the PreSharedKey.
Short (simplified) introduction to LoRa communication
Your device communicates with short encoded hexvalue messages over the air with a LoRa antenna, that is connected with the LoRaController (LRC). Thingpark is such a LRC. The LRC can communicate over https with your application.
Uplink messages
- Your devices send an encoded hexvalue, over the air, to the LRC
- LRC optionally decodes the message.
- LRC sends a message, over the public internet, to your webserver by HTTPS POST, to your application. The LRC includes a Token, based on the PreSharedKey, so you can check the integrity of the message.
Downlink messages
- Your application does a HTTPS POST, via the public internet, to the LRC. The post contains a short hexvalue message for your device, the DevEUI of the device, and a Token.
- The LRC uses the Token to check the integrity of the message.
- The LRC queues the hexvalue message for delivery to your device.
- After the addressed device sends a new uplink message, the LRC sends your hexvalue to the device.
- The device may respond with another uplink message to acknowledge the received message.
Where does LoraComm fit in?
The PHP class LoraComm resides on your php enabled web application. It handles all communication with the LRC. Because the LRC is your gateway to your device, you could see LoraComm as the connection to your device.
How to use
Minimal example
$lora = new LoraComm($psk, $as_id, $baseUrl);
$lora->send( $DevEUI, $Payload, $Fport);
$incomingData = $lora->receive();
Full documentation
Latest source file
Warning
These urls may change at any time. If you want to link to the documentation, link to http://berloth.net/coding/loracomm
Any comments or questions?
Contact the author.