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

source "Kconfig.zephyr"

menu "Nordic Modem Shell config"

config MOSH_IPERF3
	bool "iPerf3"
	default y
	select NRF_IPERF3

config NRF_IPERF3_PROMPTLESS
	bool
	default y

config MOSH_SOCK
	bool "Socket tool"
	default y
	help
	  Socket tool with TCP, UDP, RAW, IPv4, IPv6 and packet socket support.

config MOSH_PING
	bool "ICMP ping"
	default y
	help
	  Ping is a tool for testing the reachability of a host on an IP network.

config MOSH_LINK
	bool "Link control"
	depends on LTE_LINK_CONTROL
	depends on MODEM_INFO
	depends on SETTINGS
	default y
	help
	  Link control changes and queries the state of the LTE connection.

config MOSH_CURL
	bool "cURL"
	default y
	select NRF_CURL

config NRF_CURL_PROMPTLESS
	bool
	default y

config MOSH_GNSS
	bool "GNSS"
	default y
	help
	  GNSS feature for searching the location of the device.

config MOSH_PPP
	bool "PPP"
	help
	  Point-to-Point Protocol for enabling dial-up access to the Internet.

config MOSH_SMS
	bool "SMS"
	default y
	help
	  SMS tool for sending and receiving SMS messages.

config MOSH_LOCATION
	bool "Location"
	default y
	select LOCATION
	select NRF_CLOUD_LOCATION if MOSH_CLOUD_MQTT && (LOCATION_METHOD_CELLULAR || LOCATION_METHOD_WIFI)
	help
	  Tool for location queries via location library.

config MOSH_FOTA
	bool "FOTA"
	default y
	help
	  FOTA for performing software updates over-the-air for both modem and application side.

config MOSH_REST
	bool "REST client"
	default y
	select REST_CLIENT
	help
	  REST client for sending and receiving simple REST requests/responses.

config MOSH_CLOUD_REST
	bool "nRFCloud commands over REST"
	default y
	select NRF_CLOUD_REST
	select MODEM_JWT
	select NRF_CLOUD_AGNSS_FILTERED if NRF_CLOUD_AGNSS && !NRF_CLOUD_MQTT
	select NRF_CLOUD_AGNSS_FILTERED_RUNTIME if NRF_CLOUD_AGNSS && !NRF_CLOUD_MQTT

config MOSH_CLOUD_MQTT
	bool "MQTT connection to nRF Cloud"
	select NRF_CLOUD_MQTT
	help
	  MQTT connection to nRF Cloud.

config MOSH_CLOUD_COAP
	bool "CoAP connection to nRF Cloud"
	select NRF_CLOUD_COAP
	select MODEM_JWT
	help
	  CoAP connection to nRF Cloud.

config MOSH_CLOUD_LWM2M
	bool "Cloud connection using LwM2M"
	help
	  Cloud connection using LwM2M.

config MOSH_AT_CMD_MODE
	bool "Specific AT command mode"
	default y

config MOSH_PRINT_BUFFER_SIZE
	int "Buffer size used when printing modem shell output"
	default 1024
	help
	  If the printed string exceeds this buffer, an error message is printed first and
	  then the requested string cut into the length of this buffer.

config MOSH_COMMON_WORKQUEUE_STACK_SIZE
	int "Common workqueue stack size"
	default 7168 if MOSH_CLOUD_REST || MOSH_CLOUD_MQTT
	default 6144 if MOSH_STARTUP_CMDS && MOSH_CURL
	default 4096

config MOSH_COMMON_WORKQUEUE_PRIORITY
	int "Common workqueue priority"
	default 5

if MOSH_IPERF3 || MOSH_PING
menu "MoSH iperf3 and ping command selections"

config MOSH_WORKER_THREADS
	bool "Possibility to run iperf3 or ping instances in separate threads"
	default y

config MOSH_STARTUP_CMDS
	bool "Possibility to run stored MoSh commands from settings after bootup"
	default y

config MOSH_NRF91_NON_OFFLOADING_DEV
	bool "Possibility to run iperf3 with Zephyr TCP/IP stack"

endmenu
endif

if MOSH_AT_CMD_MODE
choice
	prompt "Command termination"
	default MOSH_AT_CMD_MODE_CR_LF_TERMINATION
	help
		Sets the command termination ending from the serial terminal
		Levels are:
		-  NULL Termination
		-  CR Termination
		-  LF Termination
		-  CR+LF Termination
	config MOSH_AT_CMD_MODE_NULL_TERMINATION
		bool "NULL Termination"
	config MOSH_AT_CMD_MODE_CR_TERMINATION
		bool "CR Termination"
	config MOSH_AT_CMD_MODE_LF_TERMINATION
		bool "LF Termination"
	config MOSH_AT_CMD_MODE_CR_LF_TERMINATION
		bool "CR+LF Termination"
endchoice
config MOSH_AT_CMD_MODE_TERMINATION
	int
	default 0 if MOSH_AT_CMD_MODE_NULL_TERMINATION
	default 1 if MOSH_AT_CMD_MODE_CR_TERMINATION
	default 2 if MOSH_AT_CMD_MODE_LF_TERMINATION
	default 3 if MOSH_AT_CMD_MODE_CR_LF_TERMINATION
endif

if MOSH_LINK
menu "MoSH link control selections"

config MOSH_LINK_SETT_NORMAL_MODE_AT_CMD_STR_LEN
	int "Link settings AT command length"
	default 127
	help
	  String length for custom AT commands stored into settings to be used
	  when going to normal mode.

endmenu
endif #MOSH_LINK

if MOSH_WORKER_THREADS

config MOSH_WORKER_THREADS_OUTPUT_BUFFER_SIZE
	int "Buffer size for storing output of the background thread commands"
	default 4096

config MOSH_WORKER_THREADS_STACK_SIZE
	int "Worker thread stack size"
	default 4096

endif #MOSH_WORKER_THREADS

if MOSH_CLOUD_LWM2M

config MOSH_LWM2M_PSK
	string "LwM2M pre-shared key for communication"
	help
	  Pre-shared key must be identical to the PSK registered with the device on the LwM2M server.
	  Use the hexadecimal representation.

config MOSH_LWM2M_ENDPOINT_PREFIX
	string "Prefix used in the LwM2M endpoint name"
	default "urn:imei:"
	help
	  Sets the prefix of the endpoint name used when connecting to the LwM2M server.

# Make AVSystem the default LwM2M server.
config LWM2M_CLIENT_UTILS_SERVER
	string "LwM2M server address"
	default "coaps://eu.iot.avsystem.cloud:5684"
	help
	  Kconfig redefinition, please see the help text of the original definition.

endif # MOSH_CLOUD_LWM2M

# For power measurement purposes, activate low power mode for asynchronous UARTs.
if UART_0_ASYNC

config UART_0_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	default y

endif # UART_0_ASYNC

if UART_1_ASYNC

config UART_1_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	default y

endif # UART_1_ASYNC

endmenu # Modem Shell
