Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter

- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
This commit is contained in:
Eric F
2026-06-08 00:38:27 -04:00
parent 468cfeaa50
commit d398a6ced2
7326 changed files with 1177561 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
load("//modules:module.bzl", "cc_everest_module")
cc_everest_module(
name = "EvAPI",
)

View File

@@ -0,0 +1,16 @@
#
# AUTO GENERATED - MARKED REGIONS WILL BE KEPT
# template version 3
#
# module setup:
# - ${MODULE_NAME}: module name
ev_setup_cpp_module()
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
# insert your custom targets and additional config variables here
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,94 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#include "EvAPI.hpp"
#include <utils/date.hpp>
namespace module {
static const auto NOTIFICATION_PERIOD = std::chrono::seconds(1);
void EvSessionInfo::reset() {
std::lock_guard<std::mutex> lock(this->session_info_mutex);
this->event = std::nullopt;
}
void EvSessionInfo::update_event(const types::board_support_common::Event& event) {
std::lock_guard<std::mutex> lock(this->session_info_mutex);
this->event = event;
}
EvSessionInfo::operator std::string() {
std::lock_guard<std::mutex> lock(this->session_info_mutex);
const auto now = date::utc_clock::now();
std::string state = "Unknown";
if (this->event.has_value()) {
state = types::board_support_common::event_to_string(this->event.value());
}
json session_info = json::object({
{"state", state},
{"datetime", Everest::Date::to_rfc3339(now)},
});
return session_info.dump();
}
void EvAPI::init() {
std::vector<std::string> ev_connectors;
std::string var_ev_connectors = this->api_base + "ev_connectors";
for (auto& ev : this->r_ev_manager) {
auto& session_info = this->info.emplace_back(std::make_unique<EvSessionInfo>());
const std::string ev_base = this->api_base + ev->module_id;
ev_connectors.push_back(ev->module_id);
// API variables
const std::string var_base = ev_base + "/var/";
const std::string var_ev_info = var_base + "ev_info";
ev->subscribe_ev_info([this, &ev, var_ev_info](types::evse_manager::EVInfo ev_info) {
json ev_info_json = ev_info;
this->mqtt.publish(var_ev_info, ev_info_json.dump());
});
const std::string var_session_info = var_base + "session_info";
ev->subscribe_bsp_event([this, var_session_info, &session_info](const auto& bsp_event) {
session_info->update_event(bsp_event.event);
this->mqtt.publish(var_session_info, *session_info);
});
const std::string var_datetime = var_base + "datetime";
this->api_threads.push_back(std::thread([this, var_datetime, var_session_info, &session_info]() {
auto next_tick = std::chrono::steady_clock::now();
while (this->running) {
std::string datetime_str = Everest::Date::to_rfc3339(date::utc_clock::now());
this->mqtt.publish(var_datetime, datetime_str);
this->mqtt.publish(var_session_info, *session_info);
next_tick += NOTIFICATION_PERIOD;
std::this_thread::sleep_until(next_tick);
}
}));
// API commands
const std::string cmd_base = ev_base + "/cmd/";
}
this->api_threads.push_back(std::thread([this, var_ev_connectors, ev_connectors]() {
auto next_tick = std::chrono::steady_clock::now();
while (this->running) {
const json ev_connectors_array = ev_connectors;
this->mqtt.publish(var_ev_connectors, ev_connectors_array.dump());
next_tick += NOTIFICATION_PERIOD;
std::this_thread::sleep_until(next_tick);
}
}));
}
void EvAPI::ready() {
}
} // namespace module

View File

@@ -0,0 +1,96 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef EV_API_HPP
#define EV_API_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for required interface implementations
#include <generated/interfaces/ev_manager/Interface.hpp>
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
// insert your custom include headers here
#include <condition_variable>
#include <list>
#include <memory>
#include <mutex>
#include <sstream>
#include <date/date.h>
#include <date/tz.h>
#include <generated/types/board_support_common.hpp>
namespace module {
class LimitDecimalPlaces;
class EvSessionInfo {
public:
EvSessionInfo(){};
void reset();
void update_event(const types::board_support_common::Event& event);
/// \brief Converts this struct into a serialized json object
operator std::string();
private:
std::mutex session_info_mutex;
std::optional<types::board_support_common::Event> event;
};
} // namespace module
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
namespace module {
struct Conf {};
class EvAPI : public Everest::ModuleBase {
public:
EvAPI() = delete;
EvAPI(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider,
std::vector<std::unique_ptr<ev_managerIntf>> r_ev_manager, Conf& config) :
ModuleBase(info), mqtt(mqtt_provider), r_ev_manager(std::move(r_ev_manager)), config(config){};
Everest::MqttProvider& mqtt;
const std::vector<std::unique_ptr<ev_managerIntf>> r_ev_manager;
const Conf& config;
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
// insert your public definitions here
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
protected:
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
// insert your protected definitions here
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
private:
friend class LdEverest;
void init();
void ready();
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
// insert your private definitions here
std::vector<std::thread> api_threads;
bool running = true;
std::list<std::unique_ptr<EvSessionInfo>> info;
const std::string api_base = "everest_api/";
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
};
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
// insert other definitions here
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
} // namespace module
#endif // EV_API_HPP

View File

@@ -0,0 +1,2 @@
# EvAPI module documentation
This module is responsible for providing a simple MQTT based API to EVerest internals exposing EvManager related functionality

View File

@@ -0,0 +1,14 @@
description: >-
The EVerest EV API module, exposing some internal functionality on an external
MQTT connection.
config: {}
requires:
ev_manager:
interface: ev_manager
min_connections: 1
max_connections: 128
enable_external_mqtt: true
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Kai-Uwe Hermann