brocaar / chirpstack-application-server

ChirpStack Application Server is an open-source LoRaWAN application-server.
https://www.chirpstack.io
MIT License
501 stars 325 forks source link

Add possibility for sending data to class A device without queuing packet #257

Closed x0y1z2 closed 6 years ago

x0y1z2 commented 6 years ago

In some cases it is necessary to be able to send a packet to the device at the current receiving an uplink packet from the device. If the server did not send the packet, server must not put the packet to the queue and send it next time, because the data is no longer relevant. This feature is needed, for example, for synchronization time on class A devices.

brocaar commented 6 years ago

The reason why this is not possible is because LoRa Server handles the sending of the application payload async. E.g. when LoRa App Server takes a long time to respond, LoRa Server is still able to respond to the device in the Class-A receive window(s). The delay is configurable in loraserver.toml.

This feature is needed, for example, for synchronization time on class A devices.

I suggest using the DeviceTime mac-command for this (you need GPS time-synced gateways). This is the most accurate way to sync the device time and is supported by LoRa Server.

882 5.9 DeviceTime commands (DeviceTimeReq, DeviceTimeAns) 883 This MAC command is only available if the device is activated on a LoRaWAN1.0.3 or later 884 compatible Network Server. LoRaWAN1.0.2 or earlier servers do not implement this MAC 885 command. 886 With the DeviceTimeReq command, an end-device MAY request from the network the current 887 network time. This allows the device to synchronize its internal clock to the network’s clock.