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

# Wi-Fi
CONFIG_WIFI=y
CONFIG_WIFI_NM_WPA_SUPPLICANT=y

CONFIG_NRF70_RX_NUM_BUFS=16
CONFIG_NRF70_MAX_TX_AGGREGATION=4

# Wi-Fi credentials
CONFIG_WIFI_CREDENTIALS=y
CONFIG_WIFI_CREDENTIALS_STATIC=n

# Networking Management API
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_INFO=y
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=5200
CONFIG_L2_WIFI_CONNECTIVITY=y

# Support for shell commands
CONFIG_SHELL=y
CONFIG_NET_L2_WIFI_SHELL=y
CONFIG_WIFI_CREDENTIALS_SHELL=y
CONFIG_SHELL_STACK_SIZE=5200

# Logging
CONFIG_LOG=y

# DK library
CONFIG_DK_LIBRARY=y

# System settings
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y
CONFIG_DNS_RESOLVER=y

# Memory
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=5200



# Configure network parameters
CONFIG_NET_TC_TX_COUNT=0
CONFIG_NET_BUF_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=14
CONFIG_NET_PKT_RX_COUNT=14
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_BUF_FIXED_DATA_SIZE=y
## changed this from 256 to 512
CONFIG_NET_BUF_DATA_SIZE=256
CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048


# MQTT
CONFIG_MQTT_HELPER=y
# CONFIG_MQTT_CLEAN_SESSION=y
# STEP 1.1 - Enable TLS for the MQTT library
CONFIG_MQTT_LIB_TLS=y

# STEP 1.2 - Enable the TLS library and security relevant configurations
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_TLS_CREDENTIALS=y
CONFIG_MBEDTLS_RSA_C=y

CONFIG_MQTT_SAMPLE_PUB_TOPIC="wifi/fund/board/publish/button/topic1001"
CONFIG_MQTT_SAMPLE_SUB_TOPIC="wifi/fund/board/subscribe/led/topic99"
# STEP 2 - Change the broker hostname
CONFIG_MQTT_SAMPLE_BROKER_HOSTNAME="broker.hivemq.com"

# STEP 3 - Configure the certificate in the MQTT helper library
CONFIG_MQTT_HELPER_SEC_TAG=24
CONFIG_MQTT_HELPER_CERTIFICATES_FOLDER="src/credentials"


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

# # Wi-Fi
# CONFIG_WIFI_NRF70=y


# # Wi-Fi credentials
# CONFIG_WIFI_CREDENTIALS=y


# # Networking
# CONFIG_NET_LOG=y
# # CONFIG_NET_L2_ETHERNET=y

# # Statistics
# CONFIG_NET_STATISTICS=y
# CONFIG_NET_STATISTICS_WIFI=y
# CONFIG_NET_STATISTICS_USER_API=y


# # printing of scan results puts pressure on queues in new locking
# # design in net_mgmt. So, use a higher timeout for a crowded
# # environment.
# CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000
# CONFIG_NET_SOCKETS_POLL_MAX=12
# CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=16



# # Wifi shell example config options

# # # Networking
# # CONFIG_NET_UDP=y

# CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4
# CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
# CONFIG_NET_MAX_CONTEXTS=5
# CONFIG_NET_CONTEXT_SYNC_RECV=y

# CONFIG_INIT_STACKS=y
# CONFIG_NET_SHELL=y

# # # Debugging
# CONFIG_STACK_SENTINEL=y
# CONFIG_DEBUG_COREDUMP=y
# CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
# CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y
# CONFIG_SHELL_CMDS_RESIZE=n
# CONFIG_DEBUG=y
# CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y

# # # Kernel options
# CONFIG_ENTROPY_GENERATOR=y
# CONFIG_REBOOT=y

# # # Logging
# CONFIG_PRINTK=y
# CONFIG_SHELL_GETOPT=y
# CONFIG_DEVICE_SHELL=y
# CONFIG_POSIX_CLOCK=y
# CONFIG_DATE_SHELL=y
# CONFIG_NET_CONFIG_AUTO_INIT=n
# CONFIG_POSIX_API=y

# CONFIG_FLASH=y
# CONFIG_FLASH_PAGE_LAYOUT=y
# CONFIG_FLASH_MAP=y
# CONFIG_NVS=y
# CONFIG_SETTINGS=y
# CONFIG_SETTINGS_NVS=y

#############################################
### DOZEE S1 CONFIGS ###

# Configure network parameters
CONFIG_NET_TC_TX_COUNT=0
CONFIG_NET_BUF_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=14
CONFIG_NET_PKT_RX_COUNT=14
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_BUF_FIXED_DATA_SIZE=y
CONFIG_NET_BUF_DATA_SIZE=512
CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048


CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_DHM_C=y
CONFIG_MBEDTLS_TLS_LIBRARY=y
CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y
CONFIG_MBEDTLS_LOG_LEVEL_ERR=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_HOSTNAME_ENABLE=y
CONFIG_DNS_RESOLVER=y
CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000

CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_CONTEXT_SNDTIMEO=y

# TLS
# STEP 1.1 - Enable the TLS library and security relevant configurations
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NRF_SECURITY=y

# STEP 1.2 - Enable TLS credentials library and set backend
CONFIG_TLS_CREDENTIALS=y
CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=n

# Wi-Fi
CONFIG_WIFI=y
CONFIG_WIFI_LOG_LEVEL_ERR=y
CONFIG_WIFI_NM_LOG_LEVEL_ERR=y
CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y
CONFIG_WIFI_NRF70_BUSLIB_LOG_LEVEL_ERR=y

CONFIG_WIFI_NM_WPA_SUPPLICANT=y
CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_ERR=y
CONFIG_WIFI_NM_WPA_SUPPLICANT_NO_DEBUG=y

CONFIG_NRF70_RX_NUM_BUFS=16
CONFIG_NRF70_MAX_TX_AGGREGATION=4

# Networking Management API
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_INFO=y
CONFIG_NET_MGMT_EVENT_LOG_LEVEL_ERR=y


# CONFIG_NET_CONNECTION_MANAGER=n
# CONFIG_L2_WIFI_CONNECTIVITY=n
# CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n



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



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

CONFIG_MBEDTLS_SSL_SESSION_TICKETS=y
CONFIG_MBEDTLS_SSL_CACHE_C=y
# CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=4096

CONFIG_MQTT_HELPER_PAYLOAD_BUFFER_LEN=4096

CONFIG_NET_BUF_DATA_SIZE=512
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096



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