Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: lib: nrf_cloud_fota_poll: API Improvements for asynchronous use #20545

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/net/nrf_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ enum nrf_cloud_fota_status {
NRF_CLOUD_FOTA_CANCELED = 5,
NRF_CLOUD_FOTA_REJECTED = 6,
NRF_CLOUD_FOTA_DOWNLOADING = 7,

/* Validation for Full modem FOTA needed, disconnect from LTE network and call
* nrf_cloud_fota_poll_update_apply(). This event is not reported to nRF Cloud and is only
* used internally to signal the application to apply the full modem FOTA update.
*/
NRF_CLOUD_FOTA_FMFU_VALIDATION_NEEDED = 8,
};

/** @brief FOTA update type. */
Expand Down
11 changes: 11 additions & 0 deletions include/net/nrf_cloud_fota_poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct nrf_cloud_fota_poll_ctx {
/* Internal variables */
struct nrf_cloud_rest_context *rest_ctx;
struct k_work_delayable timeout_work;
struct k_work_delayable cancel_work;
bool is_nonblocking;
bool full_modem_fota_supported;
const char *device_id;
Expand Down Expand Up @@ -136,6 +137,16 @@ int nrf_cloud_fota_poll_process_pending(struct nrf_cloud_fota_poll_ctx *ctx);
*/
int nrf_cloud_fota_poll_process(struct nrf_cloud_fota_poll_ctx *ctx);

/**
* @brief Apply downloaded image. For full modem FOTA this must be called after the network has
* been disconnected. Only applicable in non-blocking mode.
*
* @param[in] ctx Pointer to context used for FOTA polling operations.
*
* @return 0 on success, negative value on failure.
*/
int nrf_cloud_fota_poll_update_apply(struct nrf_cloud_fota_poll_ctx *ctx);

/** @} */

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion samples/cellular/nrf_cloud_multi_service/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ CONFIG_FCB=y

# Download Client - used by FOTA and PGPS
CONFIG_DOWNLOADER=y
CONFIG_DOWNLOADER_STACK_SIZE=4096
CONFIG_DOWNLOADER_STACK_SIZE=4352
CONFIG_DOWNLOADER_MAX_HOSTNAME_SIZE=128

# Flash - Used by FOTA and PGPS
Expand Down
1 change: 1 addition & 0 deletions samples/cellular/nrf_cloud_rest_fota/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_DFU_TARGET=y
CONFIG_DOWNLOADER=y
CONFIG_DOWNLOADER_STACK_SIZE=2048

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
Expand Down
2 changes: 1 addition & 1 deletion subsys/net/lib/downloader/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ comment "Thread and stack buffers"

config DOWNLOADER_STACK_SIZE
int "Thread stack size"
range 768 4096
range 768 8192
default 1280

config DOWNLOADER_MAX_HOSTNAME_SIZE
Expand Down
1 change: 1 addition & 0 deletions subsys/net/lib/nrf_cloud/Kconfig.nrf_cloud_fota
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ config NRF_CLOUD_FOTA_POLL
bool "FOTA job polling helpers (REST/CoAP)"
depends on !NRF_CLOUD_FOTA
depends on FOTA_DOWNLOAD
select FOTA_DOWNLOAD_PROGRESS_EVT
help
When enabled, nRF Cloud FOTA job polling helpers will be built. These
functions make it easy to request, download, and handle modem, boot,
Expand Down
Loading