#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menuconfig FOTA_DOWNLOAD
	bool "FOTA Download"
	depends on DOWNLOAD_CLIENT
	depends on DFU_TARGET
	select SYS_HASH_FUNC32
	imply FW_INFO

if (FOTA_DOWNLOAD)

config FOTA_SOCKET_RETRIES
	int "Number of retries for socket-related download issues"
	default 2

config FOTA_DOWNLOAD_PROGRESS_EVT
	bool "Emit progress event upon receiving a download fragment"

config FOTA_CLIENT_AUTOSCHEDULE_UPDATE
	bool "Mark target images to be updated when downloaded"
	default y

config FOTA_DOWNLOAD_MCUBOOT_FLASH_BUF_SZ
	int "Size of buffer used for flash write operations during MCUboot updates"
	depends on DFU_TARGET_MCUBOOT
	default 512
	help
	  Buffer size must be aligned to the minimal flash write block size

config FOTA_DOWNLOAD_FULL_MODEM_BUF_SZ
	int "Size of buffer used for flash write operations during full modem updates"
	depends on DFU_TARGET_FULL_MODEM
	default 4096
	help
	  Buffer size must be aligned to the minimal flash write block size

config FOTA_DOWNLOAD_NATIVE_TLS
	bool "Enable native TLS socket"
	help
	  Enabling this option will configure the socket to be native for TLS
	  instead of offloading TLS operations to the modem.

config FOTA_DOWNLOAD_FILE_NAME_LENGTH
	int "Size of buffer used for file name"
	default 128

config FOTA_DOWNLOAD_HOST_NAME_LENGTH
	int "Size of buffer used for host name"
	default 128

config FOTA_DOWNLOAD_RESOURCE_LOCATOR_LENGTH
	int "Size of buffer used for Resource locator"
	default 512

config FOTA_DOWNLOAD_SEC_TAG_LIST_SIZE_MAX
	int "Size of security tag list"
	default 5
	help
	  Maximum size of the list of security tags used to store TLS credentials.

config FOTA_DOWNLOAD_EXTERNAL_DL
	bool "Use external download events to perform FOTA updates"
	select EXPERIMENTAL

module=FOTA_DOWNLOAD
module-dep=LOG
module-str=Firmware Over the Air Download
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

endif # FOTA_DOWNLOAD
