#ifndef NETWORK_CONFIGURATION_H #define NETWORK_CONFIGURATION_H #include #include #include "network_state.h" enum { kNetworkValidationWindowMs = 30000U, kNetworkSuccessNoticeMs = 15000U }; typedef enum { NETWORK_CONFIGURATION_IDLE, NETWORK_CONFIGURATION_VALIDATING, NETWORK_CONFIGURATION_SUCCESS, NETWORK_CONFIGURATION_FAILED } network_configuration_state_t; typedef struct { network_configuration_state_t state; network_profile_t previous_profile; bool had_previous_profile; uint32_t validation_deadline_ms; uint32_t success_deadline_ms; } network_configuration_t; void network_configuration_init(network_configuration_t *configuration); bool network_configuration_begin(network_configuration_t *configuration, network_manager_t *manager, const network_profile_t *candidate, uint32_t now_ms); bool network_configuration_validation_timed_out(const network_configuration_t *configuration, uint32_t now_ms); network_action_t network_configuration_finish(network_configuration_t *configuration, network_manager_t *manager, bool success, uint32_t now_ms); bool network_configuration_success_notice_expired(const network_configuration_t *configuration, uint32_t now_ms); bool network_configuration_busy(const network_configuration_t *configuration); #endif