new module
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
#define EVSE_EVENTS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_event.h"
|
||||
|
||||
ESP_EVENT_DECLARE_BASE(EVSE_EVENTS);
|
||||
@@ -12,8 +15,12 @@ typedef enum {
|
||||
EVSE_EVENT_CONFIG_UPDATED,
|
||||
EVSE_EVENT_ENABLE_UPDATED,
|
||||
EVSE_EVENT_AVAILABLE_UPDATED,
|
||||
EVSE_EVENT_SESSION,
|
||||
} evse_event_id_t;
|
||||
|
||||
// -----------------
|
||||
// Eventos de STATE
|
||||
// -----------------
|
||||
typedef enum {
|
||||
EVSE_STATE_EVENT_IDLE,
|
||||
EVSE_STATE_EVENT_WAITING,
|
||||
@@ -25,11 +32,35 @@ typedef struct {
|
||||
evse_state_event_t state;
|
||||
} evse_state_event_data_t;
|
||||
|
||||
// -----------------
|
||||
// Eventos de SESSÃO
|
||||
// -----------------
|
||||
typedef enum {
|
||||
EVSE_SESSION_EVENT_STARTED = 0,
|
||||
EVSE_SESSION_EVENT_FINISHED,
|
||||
} evse_session_event_type_t;
|
||||
|
||||
typedef struct {
|
||||
bool charging; // Estado de carregamento
|
||||
float hw_max_current; // Corrente máxima suportada pelo hardware
|
||||
float runtime_current; // Corrente de carregamento em uso
|
||||
int64_t timestamp_us; // Momento da atualização
|
||||
evse_session_event_type_t type; ///< STARTED / FINISHED
|
||||
|
||||
// campos básicos da sessão, em tipos simples:
|
||||
uint32_t session_id; ///< opcional, se tiveres um ID
|
||||
uint32_t duration_s; ///< duração em segundos (0 no STARTED)
|
||||
uint32_t energy_wh; ///< energia em Wh (0 no STARTED)
|
||||
uint32_t avg_power_w; ///< potência média em W (0 no STARTED)
|
||||
|
||||
bool is_current; ///< true se ainda estiver em curso
|
||||
} evse_session_event_data_t;
|
||||
|
||||
|
||||
// -----------------
|
||||
// Eventos de CONFIG
|
||||
// -----------------
|
||||
typedef struct {
|
||||
bool charging; // Estado de carregamento
|
||||
float hw_max_current; // Corrente máxima suportada pelo hardware
|
||||
float runtime_current; // Corrente de carregamento em uso
|
||||
int64_t timestamp_us; // Momento da atualização
|
||||
} evse_config_event_data_t;
|
||||
|
||||
// Eventos simples e específicos
|
||||
|
||||
Reference in New Issue
Block a user