Files
chargeflow/components/evse/include/evse_state.h
2025-06-08 10:06:28 +01:00

45 lines
983 B
C
Executable File

#ifndef EVSE_STATE_H
#define EVSE_STATE_H
#include <stdbool.h>
// Estado do EVSE (pilot signal)
typedef enum {
EVSE_STATE_A,
EVSE_STATE_B1,
EVSE_STATE_B2,
EVSE_STATE_C1,
EVSE_STATE_C2,
EVSE_STATE_D1,
EVSE_STATE_D2,
EVSE_STATE_E,
EVSE_STATE_F
} evse_state_t;
// Funções públicas necessárias
void evse_state_init(void);
void evse_state_tick(void);
void evse_state_set_authorized(bool authorized);
bool evse_state_get_authorized(void);
evse_state_t evse_get_state(void);
void evse_set_state(evse_state_t state);
// Converte o estado para string
const char* evse_state_to_str(evse_state_t state);
// Retorna true se o estado representa sessão ativa
bool evse_state_is_session(evse_state_t state);
// Retorna true se o estado representa carregamento ativo
bool evse_state_is_charging(evse_state_t state);
// Retorna true se o estado representa veículo conectado
bool evse_state_is_plugged(evse_state_t state);
#endif // EVSE_STATE_H