Function anj_coap_downloader_terminate
Defined in File coap_downloader.h
Function Documentation
-
void anj_coap_downloader_terminate(anj_coap_downloader_t *coap_downloader)
Terminates the current download operation and cleans up the CoAP downloader.
This function should be called when the download is no longer needed or when an error condition requires aborting the transfer. Only a download that has already been started and is not being finalized can be terminated. This also applies when the download is suspended or temporarily waiting to continue. If no download has been started, or the download is already being finalized or has ended, the function has no effect.
When termination is initiated, the downloader’s status will be set to ANJ_COAP_DOWNLOADER_STATUS_FINISHING, and anj_coap_downloader_get_error will return ANJ_COAP_DOWNLOADER_ERR_TERMINATED.
Subsequent calls to anj_coap_downloader_step will complete the termination sequence by closing the CoAP exchange and terminating the connection. Once finished, the final status will be ANJ_COAP_DOWNLOADER_STATUS_FAILED.
- Parameters:
coap_downloader – CoAP downloader state.