Restructure config module for easier addition of items

This commit is contained in:
2023-05-15 11:23:07 +01:00
parent 10c77203ab
commit d7f1c2ace0
2 changed files with 93 additions and 68 deletions

View File

@@ -8,12 +8,12 @@
#include <stddef.h>
#define MAX_HOSTNAME_SIZE 32
#define CONFIG_MAX_VALUE_SIZE 32U
/**
* Callback type for consumers of string settings.
* Callback type for config updates
*/
typedef void (*ConfigStringCallback)(const char *value);
typedef void (*ConfigCallback)(const char *value);
/**
* Initialize the configuration module.
@@ -21,7 +21,7 @@ typedef void (*ConfigStringCallback)(const char *value);
* If there is a saved configuration, it will be loaded. Otherwise,
* the default configuration will be loaded and saved.
*/
void config_init();
void config_init(void);
/**
* Set the device's hostname.
@@ -49,6 +49,6 @@ size_t config_get_hostname(char *buffer, size_t buffer_size);
* lifetime of the passed argument will be static, but the value may
* be modified once the callback returns.
*/
void config_add_hostname_callback(ConfigStringCallback callback);
void config_add_hostname_callback(ConfigCallback callback);
#endif