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

◆ download_client_evt_id

#include <include/net/download_client.h>

Download client event IDs.

Enumerator
DOWNLOAD_CLIENT_EVT_FRAGMENT 

Event contains a fragment. The application may return any non-zero value to stop the download.

DOWNLOAD_CLIENT_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

In case of errors on the socket during send() or recv() (ECONNRESET), 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 client will not attempt to reconnect and ignores the return value.

In case the download is stopped, and it was started using download_client_get, the download client automatically closes the connection. The application should wait for DOWNLOAD_CLIENT_EVT_CLOSED before attempting another download. If download is stopped, and it was started using download_client_start the application should manually disconnect (download_client_disconnect) to clean up the network socket and wait for DOWNLOAD_CLIENT_EVT_CLOSED before attempting another download.

DOWNLOAD_CLIENT_EVT_DONE 

Download complete.

DOWNLOAD_CLIENT_EVT_CLOSED 

Connection have been closed. Client is now idle, ready for next download