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

menu "Multi Service Sample Settings"

config APP_VERSION
	string "Multi Service Sample version"
	default "1.0.0"

config CLOUD_CONNECTION_RETRY_TIMEOUT_SECONDS
	int "Cloud connection retry timeout (seconds)"
	default 30
	help
	  If connecting to nRF Cloud takes longer than this timeout, it will be
	  reattempted.

config CLOUD_READY_TIMEOUT_SECONDS
	int "Cloud readiness timeout (seconds)"
	default 600
	help
	  If the connection to nRF Cloud does not become ready within this
	  timeout, the sample will reset its connection and try again.

config DATE_TIME_ESTABLISHMENT_TIMEOUT_SECONDS
	int "Modem date and time establishment timeout (seconds)"
	default 300
	help
	  The sample will wait this many seconds for the modem to determine the
	  current date and time before giving up and moving on.

config APPLICATION_THREAD_STACK_SIZE
	int "Application Thread Stack Size (bytes)"
	default 2048
	help
	  Sets the stack size (in bytes) for the application thread of the
	  sample.

config CONNECTION_THREAD_STACK_SIZE
	int "Connection Thread Stack Size (bytes)"
	default 2048
	help
	  Sets the stack size (in bytes) for the connection thread of the
	  sample.

config MESSAGE_THREAD_STACK_SIZE
	int "Message Queue Thread Stack Size (bytes)"
	default 2048
	help
	  Sets the stack size (in bytes) for the message queue processing
	  thread of the sample.

config LED_THREAD_STACK_SIZE
	int "LED Thread Stack Size (bytes)"
	default 1024
	help
	  Sets the stack size (in bytes) for the LED thread.

config MAX_OUTGOING_MESSAGES
	int "Outgoing message maximum"
	default 25
	help
	  Sets the maximum number of device messages which may be enqueued
	  before further messages are dropped.
	  Increasing this value may require an increase to CONFIG_HEAP_MEM_POOL_SIZE.

config MAX_CONSECUTIVE_SEND_FAILURES
	int "Max outgoing consecutive send failures"
	default 5
	help
	  Sets the maximum number of device messages which may fail to send
	  before a connection reset and cooldown is triggered.

config CONSECUTIVE_SEND_FAILURE_COOLDOWN_SECONDS
	int "Cooldown after max consecutive send failures exceeded"
	default 10
	help
	  If a connection reset is triggered by too many failed device
	  messages, the sample will wait this long (in seconds) before trying
	  again.

config SENSOR_SAMPLE_INTERVAL_SECONDS
	int "Sensor sampling interval (seconds)"
	default 60
	help
	  Sets the time to wait between each sensor sample.

menuconfig LOCATION_TRACKING
	bool "Location tracking service"
	default y
	help
	  Uses GNSS, LTE, and/or Wi-Fi information to determine and report device
	  location.

if LOCATION_TRACKING

config LOCATION_TRACKING_SAMPLE_INTERVAL_SECONDS
	int "Location sampling interval (seconds)"
	default 60
	help
	  Sets the location sampling interval in seconds.

config LOCATION_TRACKING_GNSS
	bool "Use GNSS method for location tracking"
	default y
	depends on LOCATION_METHOD_GNSS
	help
	  Disable all location tracking methods to completely disable location tracking.

config LOCATION_TRACKING_CELLULAR
	bool "Use cellular method for location tracking"
	default y
	depends on LOCATION_METHOD_CELLULAR
	help
	  Disable all location tracking methods to completely disable location tracking.

config LOCATION_TRACKING_WIFI
	bool "Use Wi-Fi method for location tracking"
	default n
	depends on LOCATION_METHOD_WIFI
	help
	  Requires the use of an nRF7002 companion chip.
	  Disable all location tracking methods to completely disable location tracking.

endif

config TEMP_DATA_USE_SENSOR
	bool "Use genuine temperature data"
	depends on BOARD_THINGY91_NRF9160_NS || BOARD_THINGY91X_NRF9151_NS
	default y if BOARD_THINGY91_NRF9160_NS || BOARD_THINGY91X_NRF9151_NS
	select SENSOR
	select BME680
	help
	  Sets whether to take genuine temperature measurements from a
	  connected BME680 sensor, or just simulate sensor data.

config TEMP_TRACKING
	bool "Track temperature"
	default y
	select NRF_CLOUD_ENABLE_SVC_INF_UI_TEMP
	help
	  Sets whether to take temperature measurements.

config TEMP_ALERT_LIMIT
	int "Temperature limit to send alert"
	default 30
	help
	  Sets the temperature in degrees C over which a temperature alert will
	  be sent to the cloud.

choice
	prompt "LED indication"
	default LED_INDICATION_PWM if BOARD_THINGY91_NRF9160_NS || BOARD_THINGY91X_NRF9151_NS
	default LED_INDICATION_GPIO if BOARD_NRF9160DK_NRF9160_NS || BOARD_NRF9161DK_NRF9161_NS || $(dt_compat_enabled,gpio-leds)
	default LED_INDICATION_DISABLED

	config LED_INDICATION_PWM
		select LED
		select LED_PWM
		select PWM
		bool "Enable LED indication using the pwm-leds driver"

	config LED_INDICATION_GPIO
		select LED
		select LED_GPIO
		bool "Enable LED indication using the gpio-leds driver"

	config LED_INDICATION_DISABLED
		bool "Disable LED indication"
endchoice

choice
	prompt "LED indication LED type"
	depends on !LED_INDICATION_DISABLED
	default LED_INDICATOR_RGB if (BOARD_THINGY91_NRF9160_NS || BOARD_THINGY91X_NRF9151_NS) && LED_INDICATION_PWM
	default LED_INDICATOR_4LED if !LED_INDICATION_DISABLED
	default LED_INDICATOR_NONE

	config LED_INDICATOR_RGB
		depends on LED_INDICATION_PWM
		bool "A single RGB LED"

	config LED_INDICATOR_4LED
		depends on !LED_INDICATION_DISABLED
		bool "Four binary LEDs"

	config LED_INDICATOR_NONE
		depends on LED_INDICATION_DISABLED
		bool "No indicator LEDs"

endchoice

config LED_VERBOSE_INDICATION
	depends on !LED_INDICATION_DISABLED
	bool "Enables extra LED status indications"
	default y

config LED_CONTINUOUS_INDICATION
	depends on !LED_INDICATION_DISABLED
	bool "Show an idle pattern instead of turning LEDs off"
	default y

config GNSS_FIX_TIMEOUT_SECONDS
	int "GNSS Fix timeout"
	default 40
	help
	  On each location sample, try for this long to achieve a GNSS fix
	  before falling back to cellular positioning.
	  Set this to 20 or so seconds below the sensor sample interval so
	  that there is time left over to perform cellular positioning.
	  Otherwise, location samples may occur at a longer interval than
	  requested.

config TEST_COUNTER
	bool "Sets whether the test counter is enabled"
	help
	  When enabled, the test counter configuration setting in the shadow is ignored.

config AT_CMD_REQUESTS
	depends on !NRF_CLOUD_COAP
	bool "Enables remote execution of AT commands using device messages"
	default y

config AT_CMD_REQUEST_RESPONSE_BUFFER_LENGTH
	int "Max length (in bytes) for Modem responses during AT command requests"
	help
	  Responses to modem AT commands are stored in a buffer of this length before being sent to
	  nRF Cloud. If a response from the modem exceeds this length, it will be dropped, and an
	  error code sent in its place (-NRF_E2BIG). Cannot be less than 40 bytes.
	default 200

if NRF_CLOUD_COAP

menuconfig COAP_FOTA
	bool "FOTA service when using CoAP to connect to nRF Cloud"
	select FOTA_DOWNLOAD
	select FOTA_DOWNLOAD_PROGRESS_EVT
	select IMG_ERASE_PROGRESSIVELY
	select DFU_TARGET
	select DOWNLOAD_CLIENT
	select REBOOT
	select CJSON_LIB
	select SETTINGS
	default y

if COAP_FOTA

config COAP_FOTA_JOB_CHECK_RATE_MINUTES
	int "FOTA job check interval (minutes)"
	default 60
	help
	  Sets the time to wait between each request to get any pending FOTA job.

config COAP_FOTA_THREAD_STACK_SIZE
	int "CoAP FOTA Thread Stack Size (bytes)"
	default 2048
	help
	  Sets the stack size (in bytes) for the CoAP FOTA thread of the
	  sample.

endif

menuconfig COAP_SHADOW
	bool "Updating shadow service"
	default y
	help
	  Updates the shadow with device information. Checks for a shadow
	  delta periodically and processes it if received.

if COAP_SHADOW

config COAP_SHADOW_CHECK_RATE_SECONDS
	int "Shadow job check interval (seconds)"
	default 300
	help
	  Sets the time to wait between each request to get any change to the
	  device shadow.

config COAP_SHADOW_THREAD_STACK_SIZE
	int "CoAP Shadow Thread Stack Size (bytes)"
	default 3072
	help
	  Sets the stack size (in bytes) for the CoAP shadow thread of the
	  sample.

endif

config COAP_SEND_CONFIRMABLE
	bool "Send device messages as confirmable"
	help
	  Ensures all CoAP transfers, even for often less important messages such
	  as sensor data, are sent as confirmable messages.

endif

endmenu

if NRF_CLOUD_MQTT
module-str = MQTT Multi Service
endif
if NRF_CLOUD_COAP
module-str = CoAP Multi Service
endif
module = MULTI_SERVICE
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

menu "Zephyr Kernel"
source "Kconfig.zephyr"
endmenu
