Function anj_coap_downloader_terminate

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. It has effect only when the downloader is in the ANJ_COAP_DOWNLOADER_STATUS_STARTING or ANJ_COAP_DOWNLOADER_STATUS_DOWNLOADING state. If called in any other state, the function has no effect.

After calling this function, 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.