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

menuconfig ZIGBEE_FOTA
	bool "Enable Zigbee FOTA"
	imply BOOTLOADER_MCUBOOT
	imply MCUMGR
	imply DFU_TARGET
	imply DFU_MULTI_IMAGE
	imply DFU_MULTI_IMAGE_PACKAGE_BUILD if !ZIGBEE_FOTA_GENERATE_LEGACY_IMAGE_TYPE

if ZIGBEE_FOTA

config ZIGBEE_FOTA_GENERATE_LEGACY_IMAGE_TYPE
	bool "Generate legacy .zigbee image"
	help
	  Since NCS v2.0 the following changes were made to the Zigbee FOTA image format:
	   - The FW contains a multi-image binary, instead of the bare MCUboot image
	   - The Zigbee FW follows the subelement structure, instead of putting the
	     firmware blob right after the OTA header.
	  If this option is enabled, the old image format will be used for .zigbee image generation,
	  but the FOTA library will still understand only the new image structure.
	  The purpose of this option is to provide a possibility to upgrade old devices.

config ZIGBEE_FOTA_HW_VERSION
	int "Zigbee hardware version"
	range 0 65535
	default 52

config ZIGBEE_FOTA_DATA_BLOCK_SIZE
	int "Maximum data size of Query Block Image"
	default 64
	range 4 64

config ZIGBEE_FOTA_ENDPOINT
	int "Zigbee OTA endpoint"
	default 10
	range 1 240

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

config ZIGBEE_FOTA_MANUFACTURER_ID
	hex "Manufacturer ID"
	default 0x127F
	range 0x0000 0xFFFF
	help
	  This is the ZigBee assigned identifier for each member company.
	  0x127F - Nordic Semiconductor
	  0xFFFF - wild card value has a 'match all' effect.

config ZIGBEE_FOTA_IMAGE_TYPE
	hex "Image type"
	default 0x0141
	range 0x0000 0xFFFF
	help
	  0x0000 - 0xFFBF Manufacturer Specific
	  0xFFC0 - Client Security credentials
	  0xFFC1 - Client Configuration
	  0xFFC2 - Server Log
	  0xFFC3 - Picture
	  0xFFFF - Wild card value has a 'match all' effect.

config ZIGBEE_FOTA_COMMENT
	string "OTA header string"
	default ""
	help
	  Firmware comment to be used in Zigbee OTA header.

config ENABLE_ZIGBEE_FOTA_MIN_HW_VERSION
	bool "Enable Zigbee OTA minimum hw version"

config ZIGBEE_FOTA_MIN_HW_VERSION
	hex "Zigbee OTA minimum hw version"
	default 0
	range 0x00 0xFF
	depends on ENABLE_ZIGBEE_FOTA_MIN_HW_VERSION

config ENABLE_ZIGBEE_FOTA_MAX_HW_VERSION
	bool "Enable Zigbee OTA maximum hw version"

config ZIGBEE_FOTA_MAX_HW_VERSION
	hex "Zigbee OTA maximum hw version"
	default 0
	range 0x00 0xFF
	depends on ENABLE_ZIGBEE_FOTA_MAX_HW_VERSION

config ZIGBEE_FOTA_SERVER_DISOVERY_INTERVAL_HRS
	int "Time interval between queries for the Zigbee FOTA server"
	default 24

config ZIGBEE_FOTA_IMAGE_QUERY_INTERVAL_MIN
	int "Time interval between queries for the available Zigbee FOTA images"
	default 60

module=ZIGBEE_FOTA
module-dep=LOG
module-str=Zigbee FOTA
source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config"

endif #ZIGBEE_FOTA
