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

menu "BT management"

rsource "controller_config/Kconfig"

#----------------------------------------------------------------------------#
menu "Power control"

config BLE_LE_POWER_CONTROL_ENABLED
	bool "Enable the Bluetooth LE power control feature"
	default n
	help
	  The Bluetooth LE power control feature makes devices be able to change TX power
	  dynamically and automatically during connection, which may reduce power consumption.

config WDT_CTLR
	bool "Enable watchdog for controller"
	default y
	help
	  When true, the controller will be polled at regular intervals to check that it is alive.
	  Turn off to reduce overhead, or HCI traffic.
	  The watchdog will be deactivated automatically for DFU procedures.

choice	BLE_CONN_TX_POWER
	prompt "Default TX power for the Bluetooth LE connections"
	default BLE_CONN_TX_POWER_0DBM
	help
	  Set the default TX power for Bluetooth LE connections.

config BLE_CONN_TX_POWER_0DBM
	bool "0dBm"

config BLE_CONN_TX_POWER_NEG_1DBM
	bool "-1dBm"

config BLE_CONN_TX_POWER_NEG_2DBM
	bool "-2dBm"

config BLE_CONN_TX_POWER_NEG_3DBM
	bool "-3dBm"

config BLE_CONN_TX_POWER_NEG_4DBM
	bool "-4dBm"

config BLE_CONN_TX_POWER_NEG_5DBM
	bool "-5dBm"

config BLE_CONN_TX_POWER_NEG_6DBM
	bool "-6dBm"

config BLE_CONN_TX_POWER_NEG_7DBM
	bool "-7dBm"

config BLE_CONN_TX_POWER_NEG_8DBM
	bool "-8dBm"

config BLE_CONN_TX_POWER_NEG_12DBM
	bool "-12dBm"

config BLE_CONN_TX_POWER_NEG_16DBM
	bool "-14dBm"

config BLE_CONN_TX_POWER_NEG_20DBM
	bool "-20dBm"

config BLE_CONN_TX_POWER_NEG_40DBM
	bool "-40dBm"

endchoice

config BLE_CONN_TX_POWER_DBM
	int
	default 0 if BLE_CONN_TX_POWER_0DBM
	default -1 if BLE_CONN_TX_POWER_NEG_1DBM
	default -2 if BLE_CONN_TX_POWER_NEG_2DBM
	default -3 if BLE_CONN_TX_POWER_NEG_3DBM
	default -4 if BLE_CONN_TX_POWER_NEG_4DBM
	default -5 if BLE_CONN_TX_POWER_NEG_5DBM
	default -6 if BLE_CONN_TX_POWER_NEG_6DBM
	default -7 if BLE_CONN_TX_POWER_NEG_7DBM
	default -8 if BLE_CONN_TX_POWER_NEG_8DBM
	default -12 if BLE_CONN_TX_POWER_NEG_12DBM
	default -16 if BLE_CONN_TX_POWER_NEG_16DBM
	default -20 if BLE_CONN_TX_POWER_NEG_20DBM
	default -40 if BLE_CONN_TX_POWER_NEG_40DBM

choice	BLE_ADV_TX_POWER
	prompt "Default TX power for the Bluetooth LE advertising"
	default BLE_ADV_TX_POWER_0DBM
	help
	  Set the default TX power for the Bluetooth LE advertising.

config BLE_ADV_TX_POWER_0DBM
	bool "0dBm"

config BLE_ADV_TX_POWER_NEG_1DBM
	bool "-1dBm"

config BLE_ADV_TX_POWER_NEG_2DBM
	bool "-2dBm"

config BLE_ADV_TX_POWER_NEG_3DBM
	bool "-3dBm"

config BLE_ADV_TX_POWER_NEG_4DBM
	bool "-4dBm"

config BLE_ADV_TX_POWER_NEG_5DBM
	bool "-5dBm"

config BLE_ADV_TX_POWER_NEG_6DBM
	bool "-6dBm"

config BLE_ADV_TX_POWER_NEG_7DBM
	bool "-7dBm"

config BLE_ADV_TX_POWER_NEG_8DBM
	bool "-8dBm"

config BLE_ADV_TX_POWER_NEG_12DBM
	bool "-12dBm"

config BLE_ADV_TX_POWER_NEG_16DBM
	bool "-14dBm"

config BLE_ADV_TX_POWER_NEG_20DBM
	bool "-20dBm"

config BLE_ADV_TX_POWER_NEG_40DBM
	bool "-40dBm"

endchoice

config BLE_ADV_TX_POWER_DBM
	int
	default 0 if BLE_ADV_TX_POWER_0DBM
	default -1 if BLE_ADV_TX_POWER_NEG_1DBM
	default -2 if BLE_ADV_TX_POWER_NEG_2DBM
	default -3 if BLE_ADV_TX_POWER_NEG_3DBM
	default -4 if BLE_ADV_TX_POWER_NEG_4DBM
	default -5 if BLE_ADV_TX_POWER_NEG_5DBM
	default -6 if BLE_ADV_TX_POWER_NEG_6DBM
	default -7 if BLE_ADV_TX_POWER_NEG_7DBM
	default -8 if BLE_ADV_TX_POWER_NEG_8DBM
	default -12 if BLE_ADV_TX_POWER_NEG_12DBM
	default -16 if BLE_ADV_TX_POWER_NEG_16DBM
	default -20 if BLE_ADV_TX_POWER_NEG_20DBM
	default -40 if BLE_ADV_TX_POWER_NEG_40DBM

endmenu # Power control

menu "Thread priorities"

config CTLR_POLL_WORK_Q_PRIO
	int "Work queue priority for controller poll"
	default 6
	help
	  This is a preemptible work queue.
	  This work queue will poll the controller to check it is alive.

endmenu # Thread priorities

rsource "dfu/Kconfig"
rsource "advertising/Kconfig"
rsource "scanning/Kconfig"

#----------------------------------------------------------------------------#
menu "Log level"

module = BT_MGMT
module-str = bt-mgmt
source "subsys/logging/Kconfig.template.log_config"

endmenu # Log level
endmenu # BT management
