Modbus Vault v1.0
Loading...
Searching...
No Matches
system_config.h File Reference

Contains different system-wide configurations. More...

#include "blackbox_logger.h"
#include "esp_err.h"
#include "esp_partition.h"
#include "esp_wifi.h"
#include "modbus_analyzer.h"
#include "mqtt_bridge.h"
#include "mqtt_client.h"
#include "nvs_manager.h"
#include "rs485_driver.h"
#include "sdkconfig.h"
Include dependency graph for system_config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EVENT_BUS_QUEUE_SIZE   (50U)
 
#define RS485_DRIVER_RX_BUFFER_SIZE   (2048U)
 
#define RS485_DRIVER_RX_QUEUE_SIZE   (20U)
 
#define SYSTEM_CONFIG_WIFI_SSID   (CONFIG_WIFI_SSID)
 
#define SYSTEM_CONFIG_WIFI_PASSWORD   (CONFIG_WIFI_PASSWORD)
 
#define SYSTEM_CONFIG_MQTT_URI   (CONFIG_MQTT_URI)
 
#define SYSTEM_CONFIG_MQTT_USER   (CONFIG_MQTT_USER)
 
#define SYSTEM_CONFIG_MQTT_PASSWORD   (CONFIG_MQTT_PASSWORD)
 
#define SYSTEM_CONFIG_NVS_PARTITION_NAME   ("nvs")
 
#define SYSTEM_CONFIG_LOGGER_PARTITION_NAME   ("log_storage")
 
#define SYSTEM_CONFIG_LOGGER_PARTITION_SUBTYPE   (0x40)
 
#define SYSTEM_CONFIG_CERTS_PARTITION_LABEL   ("certs")
 
#define SYSTEM_CONFIG_CERTS_PARTITION_SUBTYPE   (0x41)
 
#define SYSTEM_CONFIG_MTLS_HEADER_MAGIC    (0x43455254UL)
 
#define BLACKBOX_LOGGER_DISK_FLUSH_TIMEOUT_US    (CONFIG_BLACKBOX_LOGGER_FLUSH_TIMEOUT)
 
#define BLACKBOX_LOGGER_SECTOR_SIZE   (CONFIG_BLACKBOX_LOGGER_SECTOR_SIZE)
 
#define BLACKBOX_LOGGER_BATCH_SIZE   (CONFIG_BLACKBOX_LOGGER_BATCH_SIZE)
 
#define BLACKBOX_LOGGER_ALIGN   (CONFIG_BLACKBOX_LOGGER_ALIGNMENT)
 
#define SYSTEM_CONFIG_SAVE_PERIOD_US    (CONFIG_SYSTEM_CONFIG_SAVE_PERIOD)
 

Functions

esp_err_t system_config_setup_defaults (void)
 Setup default configurations.
 
esp_err_t system_config_setup (void)
 Setup system configurations.
 
rs485_driver_config_tsystem_config_get_rs485_driver_config (void)
 Get rs485 driver configuration.
 
modbus_analyzer_config_tsystem_config_get_modbus_analyzer_config (void)
 Get Modbus analyzer configuration.
 
blackbox_logger_config_tsystem_config_get_blackbox_logger_config (void)
 Get Blackbox logger configuration.
 
mqtt_bridge_config_tsystem_config_get_mqtt_config (void)
 Get MQTT bridge configuration.
 
wifi_config_t * system_config_get_wifi_config (void)
 Get WiFi configuration.
 
nvs_manager_ops_tsystem_config_get_nvs_manager_ops (void)
 Get NVS operations.
 
void system_config_reset (void)
 Reset system config.
 

Detailed Description

Contains different system-wide configurations.

Author
Abanoub Salah

Macro Definition Documentation

◆ BLACKBOX_LOGGER_ALIGN

#define BLACKBOX_LOGGER_ALIGN   (CONFIG_BLACKBOX_LOGGER_ALIGNMENT)

Logger flash address alignment

◆ BLACKBOX_LOGGER_BATCH_SIZE

#define BLACKBOX_LOGGER_BATCH_SIZE   (CONFIG_BLACKBOX_LOGGER_BATCH_SIZE)

Logger batch buffer size

◆ BLACKBOX_LOGGER_DISK_FLUSH_TIMEOUT_US

#define BLACKBOX_LOGGER_DISK_FLUSH_TIMEOUT_US    (CONFIG_BLACKBOX_LOGGER_FLUSH_TIMEOUT)

Logger flush timeout in micro seconds

◆ BLACKBOX_LOGGER_SECTOR_SIZE

#define BLACKBOX_LOGGER_SECTOR_SIZE   (CONFIG_BLACKBOX_LOGGER_SECTOR_SIZE)

Logger flash sector size

◆ EVENT_BUS_QUEUE_SIZE

#define EVENT_BUS_QUEUE_SIZE   (50U)

Event queue size

◆ RS485_DRIVER_RX_BUFFER_SIZE

#define RS485_DRIVER_RX_BUFFER_SIZE   (2048U)

UART receive buffer size

◆ RS485_DRIVER_RX_QUEUE_SIZE

#define RS485_DRIVER_RX_QUEUE_SIZE   (20U)

UART receive queue size

◆ SYSTEM_CONFIG_CERTS_PARTITION_LABEL

#define SYSTEM_CONFIG_CERTS_PARTITION_LABEL   ("certs")

Certificates partitions name

◆ SYSTEM_CONFIG_CERTS_PARTITION_SUBTYPE

#define SYSTEM_CONFIG_CERTS_PARTITION_SUBTYPE   (0x41)

Certificates partitions subtype

◆ SYSTEM_CONFIG_LOGGER_PARTITION_NAME

#define SYSTEM_CONFIG_LOGGER_PARTITION_NAME   ("log_storage")

Logger partitions name

◆ SYSTEM_CONFIG_LOGGER_PARTITION_SUBTYPE

#define SYSTEM_CONFIG_LOGGER_PARTITION_SUBTYPE   (0x40)

Logger partitions subtype

◆ SYSTEM_CONFIG_MQTT_PASSWORD

#define SYSTEM_CONFIG_MQTT_PASSWORD   (CONFIG_MQTT_PASSWORD)

MQTT password

◆ SYSTEM_CONFIG_MQTT_URI

#define SYSTEM_CONFIG_MQTT_URI   (CONFIG_MQTT_URI)

MQTT URI

◆ SYSTEM_CONFIG_MQTT_USER

#define SYSTEM_CONFIG_MQTT_USER   (CONFIG_MQTT_USER)

MQTT user

◆ SYSTEM_CONFIG_MTLS_HEADER_MAGIC

#define SYSTEM_CONFIG_MTLS_HEADER_MAGIC    (0x43455254UL)

Magic header for certificates partition 'CERT' \

◆ SYSTEM_CONFIG_NVS_PARTITION_NAME

#define SYSTEM_CONFIG_NVS_PARTITION_NAME   ("nvs")

NVS partitions name

◆ SYSTEM_CONFIG_SAVE_PERIOD_US

#define SYSTEM_CONFIG_SAVE_PERIOD_US    (CONFIG_SYSTEM_CONFIG_SAVE_PERIOD)

System configuration saving period in micro seconds

◆ SYSTEM_CONFIG_WIFI_PASSWORD

#define SYSTEM_CONFIG_WIFI_PASSWORD   (CONFIG_WIFI_PASSWORD)

WiFi password

◆ SYSTEM_CONFIG_WIFI_SSID

#define SYSTEM_CONFIG_WIFI_SSID   (CONFIG_WIFI_SSID)

WiFi SSID

Function Documentation

◆ system_config_get_blackbox_logger_config()

blackbox_logger_config_t * system_config_get_blackbox_logger_config ( void  )

Get Blackbox logger configuration.

Returns
blackbox_logger_config_t*
Here is the caller graph for this function:

◆ system_config_get_modbus_analyzer_config()

modbus_analyzer_config_t * system_config_get_modbus_analyzer_config ( void  )

Get Modbus analyzer configuration.

Returns
modbus_analyzer_config_t*
Here is the caller graph for this function:

◆ system_config_get_mqtt_config()

mqtt_bridge_config_t * system_config_get_mqtt_config ( void  )

Get MQTT bridge configuration.

Returns
mqtt_bridge_config_t*
Here is the caller graph for this function:

◆ system_config_get_nvs_manager_ops()

nvs_manager_ops_t * system_config_get_nvs_manager_ops ( void  )

Get NVS operations.

Returns
nvs_manager_ops_t*
Here is the caller graph for this function:

◆ system_config_get_rs485_driver_config()

rs485_driver_config_t * system_config_get_rs485_driver_config ( void  )

Get rs485 driver configuration.

Returns
rs485_driver_config_t*

◆ system_config_get_wifi_config()

wifi_config_t * system_config_get_wifi_config ( void  )

Get WiFi configuration.

Returns
wifi_config_t*
Here is the caller graph for this function:

◆ system_config_setup()

esp_err_t system_config_setup ( void  )

Setup system configurations.

  • Configure components using preset values or loaded from NVS before system initialization
  • Setup a periodic timer to save updated parameters
Returns
esp_err_t Setup result
Return values
ESP_OKSetup success
ESP_ERR_INVALID_ARGProvided invalid argument(s)
ESP_ERR_INVALID_STATEConfiguration in invalid state
ESP_ERR_NO_MEMNo available memory for resource allocation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ system_config_setup_defaults()

esp_err_t system_config_setup_defaults ( void  )

Setup default configurations.

Returns
esp_err_t Set result
Return values
ESP_OKSet success
ESP_ERR_INVALID_ARGProvided invalid argument(s)

Must be called before NVS initialization

Here is the call graph for this function:
Here is the caller graph for this function: