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

rsource "Kconfig.defaults"

menu "Broadcast"

choice BT_AUDIO_BROADCAST_BAP_CONFIGURATION
	prompt "Broadcast codec configuration"
	depends on TRANSPORT_BIS
	default BT_AUDIO_BROADCAST_CONFIGURABLE
	help
	  Select the broadcast codec configuration as given
	  in Table 6.4 of the Bluetooth Audio Profile specification.
	  USB only supports 48-kHz sampling rate.

config BT_AUDIO_BROADCAST_CONFIGURABLE
	bool "Configurable broadcast settings"
	depends on TRANSPORT_BIS
	help
	  Configurable option that doesn't follow any preset. Allows for more flexibility.

config BT_BAP_BROADCAST_16_2_1
	bool "16_2_1"
	depends on TRANSPORT_BIS
	help
	  Broadcast mandatory codec capability 16_2_1.
	  16kHz, 32kbps, 2 retransmits, 10ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_16_2_2
	bool "16_2_2"
	depends on TRANSPORT_BIS
	help
	  Broadcast mandatory codec capability 16_2_2.
	  16kHz, 32kbps, 4 retransmits, 60ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_24_2_1
	bool "24_2_1"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 24_2_1.
	  24kHz, 48kbps, 2 retransmits, 10ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_24_2_2
	bool "24_2_2"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 24_2_2.
	  24kHz, 48kbps, 4 retransmits, 60ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_48_2_1
	bool "48_2_1"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_2_1.
	  48kHz, 80kbps, 4 retransmits, 20ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_48_2_2
	bool "48_2_2"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_2_2.
	  48kHz, 80kbps, 4 retransmits, 65ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_48_4_1
	bool "48_4_1"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_4_1.
	  48kHz, 96kbps, 4 retransmits, 20ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_48_4_2
	bool "48_4_2"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_4_2.
	  48kHz, 96kbps, 4 retransmits, 65ms transport latency, and 40ms presentation delay.


config BT_BAP_BROADCAST_48_6_1
	bool "48_6_1"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_6_1.
	  48kHz, 124kbps, 4 retransmits, 20ms transport latency, and 40ms presentation delay.

config BT_BAP_BROADCAST_48_6_2
	bool "48_6_2"
	depends on TRANSPORT_BIS
	help
	  Broadcast codec capability 48_6_2.
	  48kHz, 124kbps, 4 retransmits, 65ms transport latency, and 40ms presentation delay.
endchoice

config BT_AUDIO_BROADCAST_NAME
	string "Broadcast name"
	default "NRF5340_BROADCASTER"
	# TODO: Add back 'depends on TRANSPORT_BIS' once applications are ready
	help
	  Name of the broadcast; not the same as BT_DEVICE_NAME.

config BT_AUDIO_BROADCAST_NAME_ALT
	string "Alternative broadcast name"
	default "NRF5340_BROADCASTER_ALT"
	# TODO: Add back 'depends on TRANSPORT_BIS' once applications are ready
	help
	  Alternative name of the broadcast.

config BT_AUDIO_USE_BROADCAST_NAME_ALT
	bool "Use the alternative broadcast name"
	default n
	# TODO: Add back 'depends on TRANSPORT_BIS' once applications are ready
	help
	  Use the alternative broadcast name.

config BT_AUDIO_BROADCAST_ENCRYPTED
	bool "Encrypted broadcast"
	depends on TRANSPORT_BIS
	default n
	help
	  Encrypt the broadcast to limit the connection possibilities.

config BT_AUDIO_BROADCAST_ENCRYPTION_KEY
	string "Broadcast encryption key"
	depends on TRANSPORT_BIS
	default "NRF5340_BIS_DEMO"
	help
	  Key to use for encryption and decryption, with maximum BT_ISO_BROADCAST_CODE_SIZE
	  characters. Encryption keys larger than BT_ISO_BROADCAST_CODE_SIZE will be truncated to
	  BT_ISO_BROADCAST_CODE_SIZE.

choice BT_AUDIO_BROADCAST_ID_TYPE
	prompt "Broadcast ID"
	depends on TRANSPORT_BIS
	default BT_AUDIO_USE_BROADCAST_ID_FICR
	help
	  Select the broadcast ID to use for the broadcast.

config BT_AUDIO_USE_BROADCAST_ID_FICR
	bool "Use the FICR broadcast ID"
	depends on TRANSPORT_BIS
	help
	  Use the FICR broadcast ID. This is a fixed broadcast ID that is unique to each device.
	  It is stored in the FICR NFC.TAGHEADER0 register.

config BT_AUDIO_USE_BROADCAST_ID_RANDOM
	bool "Use a random broadcast ID"
	depends on TRANSPORT_BIS
	help
	  Use a randomly generated broadcast ID.

config BT_AUDIO_USE_BROADCAST_ID_FIXED
	bool "Use a fixed broadcast ID"
	depends on TRANSPORT_BIS
	help
	  Use a fixed broadcast ID. This is useful for debugging purposes.

endchoice

config BT_AUDIO_BROADCAST_ID_FIXED
	hex "Fixed broadcast ID"
	depends on TRANSPORT_BIS
	default 0x123456
	help
	  Fixed broadcast ID; 3 octets. Will only be used if BT_AUDIO_USE_BROADCAST_ID_FIXED=y.
	  Only use for debugging.

config BT_AUDIO_BROADCAST_PBA_METADATA_SIZE
	int "Configure PBA meta data buffer size"
	depends on TRANSPORT_BIS && AURACAST
	default 16
	help
	  Configure the maximum size of the Public Broadcast Announcement meata data buffer in octets.
	  This is the number of meta data LVT records, or the number of meta data items multiplied by
	  the size of the LTV (sizeof(bt_data)). Configurable option that doesn't follow any preset.
	  Allows for more flexibility.

config BT_AUDIO_BROADCAST_PARENTAL_RATING
	hex "Parental rating"
	depends on TRANSPORT_BIS
	default 0x00
	range 0x00 0x0F
	help
	  Set the parental rating for the broadcast.
	  BT_AUDIO_PARENTAL_RATING_NO_RATING        = 0x00,
	  BT_AUDIO_PARENTAL_RATING_AGE_ANY          = 0x01,
	  BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE   = 0x02,
	  BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE   = 0x03,
	  BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE   = 0x04,
	  BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE   = 0x05,
	  BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE   = 0x06,
	  BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE  = 0x07,
	  BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE  = 0x08,
	  BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE  = 0x09,
	  BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE  = 0x0A,
	  BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE  = 0x0B,
	  BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE  = 0x0C,
	  BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE  = 0x0D,
	  BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE  = 0x0E,
	  BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE  = 0x0F

config BT_AUDIO_BROADCAST_IMMEDIATE_FLAG
	bool "Immediate rendering flag"
	depends on TRANSPORT_BIS
	default n
	help
	  Set the immediate rendering flag.

config AURACAST
	bool "Enable Auracast"
	depends on TRANSPORT_BIS
	default y
	help
	  When Auracast is enabled, a Public Broadcast Announcement will be included
	  when advertising.

config BT_AUDIO_BITRATE_BROADCAST_SRC
	int "ISO stream bitrate"
	depends on TRANSPORT_BIS
	default 96000 if BT_AUDIO_BROADCAST_CONFIGURABLE
	default 32000 if BT_BAP_BROADCAST_16_2_1 || BT_BAP_BROADCAST_16_2_2
	default 48000 if BT_BAP_BROADCAST_24_2_1 || BT_BAP_BROADCAST_24_2_2
	default 80000 if BT_BAP_BROADCAST_48_2_1 || BT_BAP_BROADCAST_48_2_2
	default 96000 if BT_BAP_BROADCAST_48_4_1 || BT_BAP_BROADCAST_48_4_2
	default 124000 if BT_BAP_BROADCAST_48_6_1 || BT_BAP_BROADCAST_48_6_2
	help
	  Bitrate for the broadcast source ISO stream.

config BT_AUDIO_SCAN_DELEGATOR
	bool "Enable scan delegator"
	depends on TRANSPORT_BIS
	select BT_CAP_ACCEPTOR
	select BT_CSIP_SET_MEMBER
	select BT_CAP_ACCEPTOR_SET_MEMBER
	select BT_GAP_PERIPHERAL_PREF_PARAMS
	select BT_VCP_VOL_REND
	select BT_PER_ADV_SYNC_TRANSFER_RECEIVER
	help
	  When scan delegator feature is enabled, the broadcast sink will not
	  search for a predefined broadcast source. Instead, it will wait for a
	  broadcast assistant to connect and control.

config BT_SET_IDENTITY_RESOLVING_KEY_DEFAULT
	string
	default "NRF5340_BIS_DEMO"
	help
	  Default string to configure the Set Identify Resolving Key (SIRK), must
	  be changed before production uniquely for each coordinated set.

config BT_SET_IDENTITY_RESOLVING_KEY
	string "String used to configure the SIRK"
	default BT_SET_IDENTITY_RESOLVING_KEY_DEFAULT
	help
	  Defines a string to configure the Set Identify Resolving Key (SIRK), must
	  be changed before production uniquely for each coordinated set. The SIRK
	  must be 16 characters (16 bytes).

config BT_AUDIO_BROADCAST_ZBUS_EVT_STREAM_SENT
	bool "Enable Zephyr bus event for stream sent"
	help
	  Enable ZBUS event signalling that a stream has been sent, and that the next frame can
	  be prepared. As this event will trigger once for each frame it will cause significant
	  overhead, even if the event is not used.

#----------------------------------------------------------------------------#
menu "Log levels"

module = BROADCAST_SOURCE
module-str = broadcast_source
source "subsys/logging/Kconfig.template.log_config"

module = BROADCAST_SINK
module-str = broadcast_sink
source "subsys/logging/Kconfig.template.log_config"

endmenu # Log levels
endmenu # Broadcast
