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

In other words, if 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 to send downlink message to the end device and why is NS is an initiator of the downlink message. Why not to use AS as an initiator and just store this message in the NS side?

Unfortunately, it is not possible in case of NS do not have an 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 a simplified AS driven downlinks.

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

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

  • NS receives uplink message from end device and process it.

  • NS sends uplink message to AS.

  • NS calculates moment of time when downlink should be transmitted to the device and sends downlink_request to AS.

  • AS process downlink_request and build a payload for downlink message

  • AS sends downlink_response to NS

  • NS receives downlink_response from AS

  • NS build downlink message for the end device and send data to it.

  • NS creates message with type=downlink and transmit it to the AS.

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

Here we describe all parameters that are included into the downlink_request message from NS to 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 parameters that are included into the downlink_response message from AS to 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 would not been overriden.

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 ""