Downlink Request / Downlink Response

The Downlink Request is a message that is used by the NS to let the AS know that the NS has an opportunity (TX window) to send downlink message to a certain device. In order to send downlink messages, the AS should generate a response message that will contain the necessary data for the device.

In other words, if the AS has anything to send back to the end device, it should send downlink_response
message to the NS.

You may ask why do we have such a complicated method of sending downlink messages to the end device and why is the NS an initiator of the downlink message. Why not to use the AS as an initiator and just store this message on the NS side?

Unfortunately, it is not possible in this case, since the NS does not have access to AppSKey or AppKey of the device. Uplink and downlink counters should be encrypted on the client side, which is a major obstacle to implement simplified AS-driven downlinks.

Please review this sequence diagram for a better understanding of how downlink_request and downlink_response works:

On the diagram above, you may see the following actions/events:

  • The NS receives an uplink message from the end device and processes it.
  • The NS sends an uplink message to the **AS.
  • The NS calculates the moment of time when the downlink should be transmitted to the device and sends a downlink_request to the AS.
  • The AS processes the downlink_request and builds a payload for downlink message
  • The AS sends a downlink_response to the NS.
  • The NS receives a downlink_response from the AS
  • The NS builds a downlink message for the end device and sends data to it.
  • The NS creates a message with type=downlink and transmits it to the AS.

Please note that downlink message could be received by the AS even if it never emitted downlink_response to the NS.
For example, the NS received confirmed an uplink message and should acknowledge it according to LoRaWAN specification. It means that the NS will send a downlink to the device and a message with type downlink will be transmitted to the AS.

Here, we describe all the **parameters that are included into the downlink_request message from the NS to the AS.

Params

Name Description
tx_time float, UNIX timestamp of future packet transmit time, required
counter_down integer, Downlink packets counter, required
max_size integer, Maximum size of payload that can be delivered, required

Example

{
    "meta": {
        "network": "75697b95",
        "packet_hash": "79f664df2c2073af798fa87497305d8d",
        "application": "70b3d54b17db0106",
        "device_addr": "36c365b4",
        "time": 1504806731.258602,
        "device": "faa73111a2aead2c",
        "packet_id": "fdbb09021c4523d9f28bb815ca872c70",
        "gateway": "7c95bd79864622a4",
        "history": true
    },
    "type": "downlink_request",
    "params": {
        "counter_down": 71,
        "max_size": 51,
        "tx_time": 1504806733.249041
    }
}

Here, we describe all the parameters that are included into the downlink_response message from the AS to the NS.

Params

Name Description
pending boolean, FPending, True if there is more data awaits sending, optional, default: false
confirmed boolean, Confirmed message, Network server will wait for delivery confirmation from device, optional, default: false
counter_down integer, FCntDown (FCnt), Reassign downlink packets counter, optional, default: value from NS downlink message
port integer, FPort, Frame port, optional, default: 1
payload string-base64-encoded, Message (BASE64-encoded, plain). Use this in case of app_key is provided to Network. Encryption will be provided by Network.
encrypted_payload string-base64-encoded, FRMPayload, Message (BASE64-encoded, encrypted). Use this in case of Application Server is performing encryption procedure.
queue_if_late boolean, optional, default: false. If the application is late to answer, send the payload for the next downlink slot, if it had not been overridden.

Example

{
    "meta": {
        "network": "75697b95",
        "packet_hash": "79f664df2c2073af798fa87497305d8d",
        "application": "70b3d54b17db0106",
        "device_addr": "36c365b4",
        "time": 1504806731.258602,
        "device": "faa73111a2aead2c",
        "packet_id": "fdbb09021c4523d9f28bb815ca872c70",
        "gateway": "7c95bd79864622a4",
        "history": true
    },
    "type": "downlink_response",
    "params": {
        "pending": false,
        "confirmed": true,
        "counter_down": 71,
        "port": 25,
        "payload": "a0f1hh"
    }
}

results matching ""

    No results matching ""