nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ downloader_evt_id

#include <include/net/downloader.h>

Downloader event IDs.

Enumerator
DOWNLOADER_EVT_FRAGMENT 

Event contains a fragment of data received from the server. When using range requests the amount of data per fragment may be less than the range requested. The application may return any non-zero value to stop the download.

DOWNLOADER_EVT_ERROR 

An error has occurred during download and the connection to the server has been lost.

Error reason may be one of the following:

  • -ECONNRESET: Socket error, peer closed connection.
  • -ECONNREFUSED: Socket error, connection refused by server.
  • -ENETDOWN: Socket error, network down.
  • -ETIMEDOUT: Socket error, connection timed out.
  • -EHOSTDOWN: Host went down during download.
  • -EBADMSG: HTTP response header not as expected.
  • -ERANGE: HTTP response does not support range requests.
  • -E2BIG: HTTP response header could not fit in buffer.
  • -EPROTONOSUPPORT: Protocol is not supported.
  • -EINVAL: Invalid configuration.
  • -EAFNOSUPPORT: Unsupported address family (IPv4/IPv6).
  • -EHOSTUNREACH: Failed to resolve the target address.
  • -EMSGSIZE: TLS packet is larger than the nRF91 Modem can handle.
  • -EMLINK: Maximum number of redirects reached.

In case of ECONNRESET errors, returning zero from the callback will let the library attempt to reconnect to the server and download the last fragment again. Otherwise, the application may return any non-zero value to stop the download. On any other error code than ECONNRESET, the downloader will not attempt to reconnect and will ignore the return value.

In case the download is stopped or completed, and the downloader_host_cfg.keep_connection flag is set, the downloader will stay connected to the server. If a new download is initiated towards a different server, the current connection is closed and the downloader will connect to the new server. The connection can be closed by deinitializing the downloader, which will also free its resources.

If the downloader_host_cfg.keep_connection flag is not set, the downloader will automatically close the connection. The application should wait for the DOWNLOADER_EVT_STOPPED event before attempting another download.

DOWNLOADER_EVT_DONE 

Download complete. Downloader is ready for new download.

DOWNLOADER_EVT_STOPPED 

Download has been stopped. Downloader is ready for new download.

DOWNLOADER_EVT_DEINITIALIZED 

Downloader deinitialized. Memory can be freed.