refact auth 2
This commit is contained in:
@@ -9,28 +9,61 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Tamanho máximo da tag RFID (incluindo '\0')
|
||||
#define AUTH_TAG_MAX_LEN 20
|
||||
|
||||
// Evento enviado ao EVSE Manager após leitura de tag
|
||||
typedef struct {
|
||||
char tag[AUTH_TAG_MAX_LEN];
|
||||
bool authorized;
|
||||
char tag[AUTH_TAG_MAX_LEN]; // Tag lida
|
||||
bool authorized; // true se tag for válida
|
||||
} auth_event_t;
|
||||
|
||||
// Inicializa autenticação (ex: tabela de tags)
|
||||
/**
|
||||
* @brief Inicializa o sistema de autenticação.
|
||||
* Carrega configuração e inicia o leitor Wiegand (wg26).
|
||||
*/
|
||||
void auth_init(void);
|
||||
|
||||
// Ativa ou desativa o sistema de autenticação
|
||||
/**
|
||||
* @brief Define a fila de eventos que receberá auth_event_t.
|
||||
*/
|
||||
void auth_set_event_queue(QueueHandle_t queue);
|
||||
|
||||
/**
|
||||
* @brief Ativa ou desativa o módulo de autenticação (RFID).
|
||||
* Essa configuração é salva em NVS.
|
||||
*/
|
||||
void auth_set_enabled(bool value);
|
||||
|
||||
/**
|
||||
* @brief Verifica se a autenticação está habilitada.
|
||||
*/
|
||||
bool auth_is_enabled(void);
|
||||
|
||||
// Gerenciamento de tags
|
||||
/**
|
||||
* @brief Adiciona uma nova tag válida.
|
||||
*/
|
||||
bool auth_add_tag(const char *tag);
|
||||
|
||||
/**
|
||||
* @brief Remove uma tag previamente cadastrada.
|
||||
*/
|
||||
bool auth_remove_tag(const char *tag);
|
||||
|
||||
/**
|
||||
* @brief Verifica se uma tag está cadastrada.
|
||||
*/
|
||||
bool auth_tag_exists(const char *tag);
|
||||
|
||||
/**
|
||||
* @brief Lista as tags registradas (via ESP_LOG).
|
||||
*/
|
||||
void auth_list_tags(void);
|
||||
|
||||
// Integração com fila de eventos
|
||||
void auth_set_event_queue(QueueHandle_t queue);
|
||||
/**
|
||||
* @brief Processa uma tag lida (usado pelo leitor Wiegand).
|
||||
*/
|
||||
void auth_process_tag(const char *tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user