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

# General config
CONFIG_PICOLIBC=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_FPU=y

# Heap and stacks
#CONFIG_HEAP_MEM_POOL_SIZE=47250
CONFIG_HEAP_MEM_POOL_SIZE=40250
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HW_STACK_PROTECTION=y
# Increase AT monitor heap size to be able to fit both neighbor cell measurement
# and other AT notifications that may come in rapid succession.
CONFIG_AT_MONITOR_HEAP_SIZE=1024

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_CLOUD_INTEGRATION_LOG_LEVEL_DBG=y
CONFIG_CLOUD_MODULE_LOG_LEVEL_DBG=y
#CONFIG_MODEM_MODULE_LOG_LEVEL_DBG=y
CONFIG_MODEM_MODULE_LOG_LEVEL_INF=y
CONFIG_APPLICATION_MODULE_LOG_LEVEL_DBG=y
CONFIG_CLOUD_CODEC_LOG_LEVEL_DBG=y
CONFIG_DATA_MODULE_LOG_LEVEL_DBG=y
CONFIG_SENSOR_MODULE_LOG_LEVEL_DBG=y
#CONFIG_CENTRAL_UART_LOG_LEVEL_DBG=y

# nRF modem library
CONFIG_NRF_MODEM_LIB=y
CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y

# AT Host library - Used to send AT commands directy from an UART terminal and to allow
#		    integration with nRF Connect for Desktop LTE Link monitor application.
#CONFIG_AT_HOST_LIBRARY=y
CONFIG_AT_HOST_LIBRARY=n

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y

# LTE link control
## Power saving timers.
### 320 hours PSM.
CONFIG_LTE_PSM_REQ=y
CONFIG_LTE_PSM_REQ_RPTAU="11000001"
### 20 seconds active time.
CONFIG_LTE_PSM_REQ_RAT="00001010"
### Enable required modules
CONFIG_LTE_LC_EDRX_MODULE=y
CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE=y
CONFIG_LTE_LC_PSM_MODULE=y
CONFIG_LTE_LC_MODEM_SLEEP_MODULE=y
CONFIG_LTE_LC_PDN_MODULE=y

# Settings - Used to store real-time device configuration to flash.
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_FCB=y

#BMS FOTA
# FOTA
CONFIG_DOWNLOADER=y
CONFIG_DOWNLOADER_STACK_SIZE=4096
CONFIG_DFU_TARGET=y

# Flash - Used in FOTA, settings and storage for P-GPS.
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# MCUBOOT
#SB is for V3
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_SECURE_BOOT=y

# Watchdog
CONFIG_WATCHDOG_APPLICATION=n

# Application Event Manager
CONFIG_APP_EVENT_MANAGER=y
CONFIG_APP_EVENT_MANAGER_LOG_EVENT_TYPE=n

# cJSON - Used in cloud data encoding.
CONFIG_CJSON_LIB=y

# CAF - Common Application Framework
CONFIG_CAF=y
CONFIG_LED=y
CONFIG_CAF_LEDS=y
CONFIG_CAF_INIT_LOG_LED_READY_EVENTS=n
CONFIG_CAF_INIT_LOG_LED_EVENTS=n
CONFIG_CAF_INIT_LOG_MODULE_STATE_EVENTS=n

# Location related configuration
CONFIG_LOCATION_MODULE=n

# Default cloud transport service
CONFIG_AWS_IOT=y
CONFIG_AWS_FOTA=y
#CONFIG_AWS_IOT_THREAD_STACK_SIZE=4096
CONFIG_FOTA_DOWNLOAD=y
CONFIG_HW_ID_LIBRARY=y
CONFIG_HW_ID_LIBRARY_SOURCE_IMEI=y

#added TJM
CONFIG_LOG_BUFFER_SIZE=10240

# central_uart_tjm prj.conf
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_CONSOLE_GETCHAR=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_PICOLIBC_IO_FLOAT=y

# Enable the BLE stack with GATT Client configuration
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y

###############################################
# added for BT multilpe simultaneous connections
# Enable Bluetooth Central role
#CONFIG_BT_CENTRAL=y
# Disable auto-connect to just one
#CONFIG_BT_CENTRAL_UART_AUTO_CONNECT=n 

# Increase max connections (e.g., 4)
CONFIG_BT_MAX_CONN=4
CONFIG_BT_MAX_PAIRED=4
CONFIG_BT_CONN_CTX=y

# Increase max pending connections during scanning
#CONFIG_BT_SCAN_FILTER_MUTABLE=y
#CONFIG_BT_CONN_TX_MAX=4

# Ensure sufficient memory for multiple links
#CONFIG_BT_BUF_ACL_RX_COUNT=10
#CONFIG_BT_BUF_ACL_TX_COUNT=10

###############################################

# Enable the BLE modules from NCS
CONFIG_BT_NUS_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
CONFIG_BT_SCAN_ADDRESS_CNT=1
CONFIG_BT_GATT_DM=y
#CONFIG_HEAP_MEM_POOL_SIZE=2048
#CONFIG_BT_CLASSIC=y

# This example requires more stack
#CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Config logger
#CONFIG_LOG=y
#CONFIG_USE_SEGGER_RTT=y
#CONFIG_LOG_BACKEND_RTT=y
#CONFIG_LOG_BACKEND_UART=n
#CONFIG_LOG_PRINTK=n

CONFIG_ASSERT=y

# added TJM
CONFIG_REBOOT=y

#CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_WDT_LOG_LEVEL_DBG=y
CONFIG_WATCHDOG=y
CONFIG_WDT_DISABLE_AT_BOOT=n
CONFIG_THREAD_NAME=y

#CONFIG_MCUBOOT_UTIL_LOG_LEVEL_DBG=y
#CONFIG_LOG_MODE_MINIMAL=n
