46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
#ifndef MAZE32_WIFI_CONFIG_H
|
|
#define MAZE32_WIFI_CONFIG_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define MAZE32_WIFI_CONFIG_SCHEMA_VERSION 1U
|
|
#define MAZE32_WIFI_SSID_MAX_BYTES 32U
|
|
#define MAZE32_WIFI_PASSWORD_MAX_BYTES 63U
|
|
|
|
typedef struct {
|
|
char ssid[MAZE32_WIFI_SSID_MAX_BYTES + 1U];
|
|
char password[MAZE32_WIFI_PASSWORD_MAX_BYTES + 1U];
|
|
} maze32_wifi_credentials_t;
|
|
|
|
typedef enum {
|
|
MAZE32_WIFI_CONFIG_VALID = 0,
|
|
MAZE32_WIFI_CONFIG_INVALID_SSID,
|
|
MAZE32_WIFI_CONFIG_INVALID_PASSWORD,
|
|
} maze32_wifi_config_validation_t;
|
|
|
|
typedef int (*maze32_reconfiguration_guard_fn)(void *context);
|
|
typedef int (*maze32_credentials_save_fn)(const maze32_wifi_credentials_t *credentials,
|
|
void *context);
|
|
typedef int (*maze32_credentials_clear_fn)(void *context);
|
|
|
|
maze32_wifi_config_validation_t maze32_wifi_credentials_validate(
|
|
const maze32_wifi_credentials_t *credentials);
|
|
int maze32_wifi_config_apply(const maze32_wifi_credentials_t *credentials,
|
|
maze32_reconfiguration_guard_fn guard,
|
|
maze32_credentials_save_fn save,
|
|
void *context);
|
|
int maze32_wifi_config_reset(maze32_reconfiguration_guard_fn guard,
|
|
maze32_credentials_clear_fn clear,
|
|
void *context);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|