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

# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_FPU=y
CONFIG_SSE=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=32768
CONFIG_MAIN_STACK_SIZE=1280
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_CLOUD_THREAD_STACK_SIZE=4096
CONFIG_HW_STACK_PROTECTION=y

# Logging
CONFIG_LOG=y

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

# Watchdog
CONFIG_WATCHDOG_APPLICATION=n

# Application Event Manager
CONFIG_APP_EVENT_MANAGER=y
CONFIG_APP_EVENT_MANAGER_EVENT_LOG_BUF_LEN=0
CONFIG_APP_EVENT_MANAGER_LOG_EVENT_TYPE=n

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

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

# Default cloud transport service
CONFIG_NRF_CLOUD_MQTT=y
CONFIG_NRF_CLOUD_FOTA=n

# Disable unsupported application modules
CONFIG_LOCATION_MODULE=n
CONFIG_SENSOR_MODULE=n
CONFIG_MODEM_MODULE=n
CONFIG_UI_MODULE=n

# Running the application in QEMU x86 emulator requires functionality
# that is present in the debug module
CONFIG_DEBUG_MODULE=y

# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=3
CONFIG_NET_CONTEXT_SNDTIMEO=y

# Run Arm MBED TLS in the application
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=120000
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=16384
CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED=y
CONFIG_MBEDTLS_MAC_SHA256_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_DNS_SERVER_IP_ADDRESSES=y
## Use CloudFlare as default DNS server
CONFIG_DNS_SERVER1="1.1.1.1"

# Network address config
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2"
