89 lines
1.8 KiB
C
Executable File
89 lines
1.8 KiB
C
Executable File
#ifndef EVSE_API_H
|
|
#define EVSE_API_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "evse_state.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "evse_session.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);
|
|
|
|
// ===============================
|
|
// Charging Session Info
|
|
// ===============================
|
|
|
|
/**
|
|
* @brief Retrieve statistics of either the current ongoing session (if any)
|
|
* or the last completed session.
|
|
* @param out pointer to evse_session_t to be filled
|
|
* @return true if there is a current or last session available
|
|
*/
|
|
bool evse_get_session(evse_session_t *out);
|
|
|
|
// ===============================
|
|
// 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
|