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

# Deferred logging helps improve LPN power consumption
# when friendship is established.
CONFIG_LOG_MODE_DEFERRED=y

# General configuration
CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="Mesh Light Fixture"
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_NVS_LOOKUP_CACHE=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS_NAME_CACHE=y
CONFIG_HWINFO=y
CONFIG_DK_LIBRARY=y
CONFIG_PWM=y
CONFIG_PM_SINGLE_IMAGE=y
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE=y

# Bluetooth configuration
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME="Mesh Light Fixture"
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
CONFIG_BT_OBSERVER=y
CONFIG_BT_PERIPHERAL=y

# Disable unused Bluetooth features
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_PRIVACY=n

# Bluetooth Mesh configuration
CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_MESH_FRIEND=y
CONFIG_BT_MESH_TX_SEG_MAX=10
CONFIG_BT_MESH_PB_GATT=y
CONFIG_BT_MESH_PROXY_USE_DEVICE_NAME=y
CONFIG_BT_MESH_GATT_PROXY=y
CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE=y
CONFIG_BT_MESH_DK_PROV=y
CONFIG_BT_MESH_NLC_PERF_CONF=y
CONFIG_BT_MESH_NLC_PERF_LIGHTNESS_CTRL=y
CONFIG_BT_MESH_MODEL_EXTENSIONS=y
CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE=33
# Enabling BT_MESH_NLC_PERF_CONF enables support for 3 application keys by
# default. Therefore, allow up to 3 application key bindings per model instance.
CONFIG_BT_MESH_MODEL_KEY_COUNT=3

# Bluetooth Mesh models
CONFIG_BT_MESH_LIGHT_CTRL_SRV=y
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_ON=3
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_PROLONG=3
CONFIG_BT_MESH_LIGHT_CTRL_SRV_RESUME_DELAY=30
CONFIG_BT_MESH_SCENE_SRV=y
CONFIG_BT_MESH_SENSOR_SRV=y

CONFIG_BT_MESH_LIGHT_CTL_SRV=y

CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK=y
CONFIG_SEGGER_DEBUGMON=y
CONFIG_BT_MESH_LIGHT_TEMP_SRV=y

# increase log buffer size 
CONFIG_LOG_BUFFER_SIZE=20480

CONFIG_BT_MESH_PLVL_SRV=y






# CONFIG_TEST=y
# CONFIG_UART_PIPE=y
# CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=4000
CONFIG_BT_RX_STACK_SIZE=4000


CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_PRIVACY=n
CONFIG_BT_SMP=y
CONFIG_BT_SMP_ENFORCE_MITM=n
CONFIG_BT_SIGNING=y
CONFIG_BT_BONDABLE=y
CONFIG_BT_ATT_PREPARE_COUNT=4
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_DEVICE_NAME="Tester"
CONFIG_BT_DEVICE_NAME_MAX=32
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y

CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_MESH_PB_ADV=y
CONFIG_BT_MESH_PB_GATT=y
CONFIG_BT_MESH_LOW_POWER=y
CONFIG_BT_MESH_LPN_AUTO=n
CONFIG_BT_MESH_GATT_PROXY=y
CONFIG_BT_MESH_LABEL_COUNT=2
CONFIG_BT_MESH_SUBNET_COUNT=2
# CONFIG_BT_MESH_MODEL_GROUP_COUNT=2
CONFIG_BT_MESH_APP_KEY_COUNT=4
CONFIG_BT_MESH_IV_UPDATE_TEST=y

CONFIG_BT_MESH_CFG_CLI=y
CONFIG_BT_MESH_HEALTH_CLI=y
CONFIG_BT_MESH_FRIEND=y
CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=32
CONFIG_BT_MESH_RX_SEG_MAX=13
CONFIG_BT_MESH_TX_SEG_MSG_COUNT=2
CONFIG_BT_MESH_LPN_POLL_TIMEOUT=100
CONFIG_BT_MESH_TX_SEG_MAX=24
CONFIG_BT_MESH_MODEL_EXTENSIONS=y

CONFIG_BT_MESH_PLVL_SRV=y
CONFIG_BT_MESH_BATTERY_SRV=y
CONFIG_BT_MESH_LOC_SRV=y
CONFIG_BT_MESH_PROP_SRV=y
CONFIG_BT_MESH_SENSOR_SRV=y
CONFIG_BT_MESH_TIME_SRV=y
CONFIG_BT_MESH_LIGHTNESS_SRV=y
CONFIG_BT_MESH_LIGHT_CTRL_SRV=y
CONFIG_BT_MESH_SCENE_SRV=y
CONFIG_BT_MESH_LIGHT_CTL_SRV=y
CONFIG_BT_MESH_ONOFF_CLI=y
CONFIG_BT_MESH_LVL_CLI=y
CONFIG_BT_MESH_DTT_CLI=y
CONFIG_BT_MESH_PONOFF_CLI=y
CONFIG_BT_MESH_PLVL_CLI=y
CONFIG_BT_MESH_BATTERY_CLI=y
CONFIG_BT_MESH_LOC_CLI=y
CONFIG_BT_MESH_PROP_CLI=y
CONFIG_BT_MESH_SENSOR_CLI=y
CONFIG_BT_MESH_TIME_CLI=y
CONFIG_BT_MESH_LIGHTNESS_CLI=y
CONFIG_BT_MESH_LIGHT_CTRL_CLI=y
CONFIG_BT_MESH_SCENE_CLI=y
CONFIG_BT_MESH_LIGHT_CTL_CLI=y
CONFIG_BT_MESH_LIGHT_TEMP_SRV=y
CONFIG_BT_MESH_LIGHT_XYL_CLI=y
CONFIG_BT_MESH_LIGHT_XYL_SRV=y
CONFIG_BT_MESH_LIGHT_HSL_CLI=y
CONFIG_BT_MESH_LIGHT_HSL_SRV=y
CONFIG_BT_MESH_SCHEDULER_CLI=y
CONFIG_BT_MESH_SCHEDULER_SRV=y
CONFIG_BT_MESH_SCENES_MAX=10

CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_ON=5
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_PROLONG=30
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_STANDBY_AUTO=30
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_STANDBY_MANUAL=5
CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_PROLONG=120

CONFIG_SETTINGS=y 
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE=y

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_TESTING=y

#CONFIG_UART_CONSOLE=n
CONFIG_BT_MESH_COMP_PAGE_1=y
CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE=60

CONFIG_BT_MESH_DTT_SRV=y

# MAX_CONN = 1 seems to fix provisioning issue but it is unknown why.  Might be a problem
# later if we need, e.g., proxy and firmware update  

# I: Firmware: Standard Bluetooth controller (0x00) Version 254.63788 Build 573996906
# I: No ID address. App must call settings_load()
# Bluetooth initialized
# W: Unused space in relation list: 14
# I: Identity: EC:2C:E8:3F:5C:0E (random)
# I: HCI: version 6.0 (0x0e) revision 0x104e, manufacturer 0x0059
# I: LMP: version 6.0 (0x0e) subver 0x104e
# I: Device UUID: 5c0b7b01-159d-4da6-a3f4-84feea62c259
# Mesh initialized
# W: opcode 0x2039 status 0x0d 
# E: Failed to start advertiser
# E: Advertising failed: err -12
CONFIG_BT_MAX_CONN=3
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_BT_BUF_CMD_TX_COUNT=5





