Files
chargeflow/components/evse/include/evse_api.h
2025-06-25 06:34:03 +01:00

80 lines
1.6 KiB
C
Executable File

#ifndef EVSE_API_H
#define EVSE_API_H
#include <stdint.h>
#include <stdbool.h>
#include "evse_state.h" // Tipos e estados
#include "freertos/FreeRTOS.h"
#ifdef __cplusplus
extern "C" {
#endif
// ===============================
// Core EVSE State
// ===============================
/**
* @brief Get current EVSE state (e.g., A, B1, C2).
*/
evse_state_t evse_get_state(void);
/**
* @brief Set the EVSE state (e.g., called by FSM or hardware layer).
*/
void evse_set_state(evse_state_t state);
/**
* @brief Get timestamp when the current session started (for timing limits).
*/
TickType_t evse_get_session_start(void);
// ===============================
// Charging Session Info
// ===============================
/**
* @brief Returns true if the EV is charging (C1 or C2).
*/
bool evse_state_is_charging(evse_state_t state);
/**
* @brief Returns true if the EV is connected (plugged).
*/
bool evse_state_is_plugged(evse_state_t state);
/**
* @brief Returns true if a charging session is active (B2, C1, C2).
*/
bool evse_state_is_session(evse_state_t state);
// ===============================
// Authorization
// ===============================
/**
* @brief Set whether the vehicle is authorized to charge.
*/
void evse_state_set_authorized(bool authorized);
/**
* @brief Get current authorization status.
*/
bool evse_state_get_authorized(void);
// ===============================
// Limit Status
// ===============================
/**
* @brief Returns true if any runtime charging limit has been reached.
*/
bool evse_is_limit_reached(void);
#ifdef __cplusplus
}
#endif
#endif // EVSE_API_H