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:
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
target_compile_options(${MODULE_NAME}
|
||||
PUBLIC -Wall -Wextra -pedantic -Werror=switch)
|
||||
|
||||
target_link_libraries(${MODULE_NAME}
|
||||
PRIVATE
|
||||
atomic
|
||||
everest::everest_api_types
|
||||
everest::everest_api_module_helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/isolation_monitorImpl.cpp"
|
||||
)
|
||||
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
# insert other things like install cmds etc here
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
@@ -0,0 +1,11 @@
|
||||
.. _everest_modules_handwritten_isolation_monitor_API:
|
||||
|
||||
.. *******************************************
|
||||
.. isolation_monitor_API
|
||||
.. *******************************************
|
||||
|
||||
The complete API specification can be found in the
|
||||
|
||||
``docs/source/reference/EVerest_API/isolation_monitor_API.yaml``
|
||||
|
||||
file in the source repository, or in the `AsyncAPI HTML documentation <../../../../api/isolation_monitor_API/index.html>`_ automatically generated from it.
|
||||
@@ -0,0 +1,102 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "isolation_monitor_API.hpp"
|
||||
|
||||
#include <everest_api_types/generic/codec.hpp>
|
||||
#include <everest_api_types/generic/string.hpp>
|
||||
#include <everest_api_types/isolation_monitor/API.hpp>
|
||||
#include <everest_api_types/isolation_monitor/codec.hpp>
|
||||
#include <everest_api_types/isolation_monitor/wrapper.hpp>
|
||||
#include <everest_api_types/utilities/codec.hpp>
|
||||
|
||||
namespace module {
|
||||
|
||||
namespace API_generic = API_types::generic;
|
||||
using ev_API::deserialize;
|
||||
|
||||
void isolation_monitor_API::init() {
|
||||
invoke_init(*p_main);
|
||||
|
||||
API_types_entry::CommunicationParameters comm_params{};
|
||||
comm_params.heartbeat_period_ms = config.cfg_heartbeat_interval_ms;
|
||||
comm_params.communication_check_period_s = config.cfg_communication_check_to_s;
|
||||
helper.init(comm_params);
|
||||
}
|
||||
|
||||
void isolation_monitor_API::ready() {
|
||||
invoke_ready(*p_main);
|
||||
|
||||
generate_api_var_isolation_measurement();
|
||||
generate_api_var_self_test_result();
|
||||
|
||||
generate_api_var_raise_error();
|
||||
generate_api_var_clear_error();
|
||||
|
||||
helper.generate_api_var_communication_check(&comm_check);
|
||||
comm_check.start(config.cfg_communication_check_to_s);
|
||||
helper.setup_heartbeat_generator(&comm_check, config.cfg_heartbeat_interval_ms);
|
||||
helper.publish_ready_beacon();
|
||||
}
|
||||
|
||||
void isolation_monitor_API::generate_api_var_isolation_measurement() {
|
||||
helper.subscribe_api_topic("isolation_measurement", [=](std::string const& data) {
|
||||
API_types_ext::IsolationMeasurement payload;
|
||||
if (deserialize(data, payload)) {
|
||||
p_main->publish_isolation_measurement(to_internal_api(payload));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void isolation_monitor_API::generate_api_var_self_test_result() {
|
||||
helper.subscribe_api_topic("self_test_result", [=](std::string const& data) {
|
||||
bool val = false;
|
||||
if (deserialize(data, val)) {
|
||||
p_main->publish_self_test_result(val);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void isolation_monitor_API::generate_api_var_raise_error() {
|
||||
helper.subscribe_api_topic("raise_error", [=](std::string const& data) {
|
||||
API_types_ext::Error error;
|
||||
if (deserialize(data, error)) {
|
||||
auto sub_type_str = error.sub_type ? error.sub_type.value() : "";
|
||||
auto message_str = error.message ? error.message.value() : "";
|
||||
auto error_str = make_error_string(error);
|
||||
auto ev_error = p_main->error_factory->create_error(error_str, sub_type_str, message_str,
|
||||
Everest::error::Severity::High);
|
||||
p_main->raise_error(ev_error);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void isolation_monitor_API::generate_api_var_clear_error() {
|
||||
helper.subscribe_api_topic("clear_error", [=](std::string const& data) {
|
||||
API_types_ext::Error error;
|
||||
if (deserialize(data, error)) {
|
||||
std::string error_str = make_error_string(error);
|
||||
if (error.sub_type) {
|
||||
p_main->clear_error(error_str, error.sub_type.value());
|
||||
} else {
|
||||
p_main->clear_error(error_str);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
std::string isolation_monitor_API::make_error_string(API_types_ext::Error const& error) {
|
||||
auto error_str = API_generic::trimmed(serialize(error.type));
|
||||
auto result = "isolation_monitor/" + error_str;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,82 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
#ifndef ISOLATION_MONITOR_API_HPP
|
||||
#define ISOLATION_MONITOR_API_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/isolation_monitor/Implementation.hpp>
|
||||
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
// insert your custom include headers here
|
||||
#include <everest_api_module_helpers/ApiHelper.hpp>
|
||||
#include <everest_api_types/entrypoint/API.hpp>
|
||||
#include <everest_api_types/isolation_monitor/API.hpp>
|
||||
|
||||
namespace ev_API = everest::lib::API;
|
||||
namespace API_types = ev_API::V1_0::types;
|
||||
namespace API_types_entry = API_types::entrypoint;
|
||||
namespace API_types_ext = API_types::isolation_monitor;
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
|
||||
namespace module {
|
||||
|
||||
struct Conf {
|
||||
int cfg_communication_check_to_s;
|
||||
int cfg_heartbeat_interval_ms;
|
||||
};
|
||||
|
||||
class isolation_monitor_API : public Everest::ModuleBase {
|
||||
public:
|
||||
isolation_monitor_API() = delete;
|
||||
isolation_monitor_API(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider,
|
||||
std::unique_ptr<isolation_monitorImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
Everest::MqttProvider& mqtt;
|
||||
const std::unique_ptr<isolation_monitorImplBase> p_main;
|
||||
const Conf& config;
|
||||
|
||||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
|
||||
// insert your public definitions here
|
||||
ev_API::Mqtt::ValidatingMqttProxy mqtt_v{mqtt};
|
||||
ev_API::ApiHelper helper{info, mqtt_v, {{"isolation_monitor", 1}}, get_config_service_client()};
|
||||
// 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
|
||||
void generate_api_var_isolation_measurement();
|
||||
void generate_api_var_self_test_result();
|
||||
void generate_api_var_raise_error();
|
||||
void generate_api_var_clear_error();
|
||||
|
||||
std::string make_error_string(API_types_ext::Error const& error);
|
||||
|
||||
ev_API::CommCheckHandler<isolation_monitorImplBase> comm_check{"isolation_monitor/CommunicationFault",
|
||||
ev_API::bridge_connection_lost_message, p_main};
|
||||
// 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 // ISOLATION_MONITOR_API_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "isolation_monitorImpl.hpp"
|
||||
|
||||
#include <everest_api_types/generic/codec.hpp>
|
||||
#include <everest_api_types/utilities/Topics.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace API_generic = API_types::generic;
|
||||
|
||||
namespace main {
|
||||
|
||||
void isolation_monitorImpl::init() {
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::ready() {
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::handle_start() {
|
||||
mod->mqtt_v.publish(mod->helper.get_topics().everest_to_extern("start"), "{}");
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::handle_stop() {
|
||||
mod->mqtt_v.publish(mod->helper.get_topics().everest_to_extern("stop"), "{}");
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::handle_start_self_test(double& test_voltage_V) {
|
||||
auto value = API_generic::serialize(test_voltage_V);
|
||||
mod->mqtt_v.publish(mod->helper.get_topics().everest_to_extern("start_self_test"), value);
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,64 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
#define MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/isolation_monitor/Implementation.hpp>
|
||||
|
||||
#include "../isolation_monitor_API.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class isolation_monitorImpl : public isolation_monitorImplBase {
|
||||
public:
|
||||
isolation_monitorImpl() = delete;
|
||||
isolation_monitorImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<isolation_monitor_API>& mod,
|
||||
Conf& config) :
|
||||
isolation_monitorImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// command handler functions (virtual)
|
||||
virtual void handle_start() override;
|
||||
virtual void handle_stop() override;
|
||||
virtual void handle_start_self_test(double& test_voltage_V) override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<isolation_monitor_API>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
@@ -0,0 +1,24 @@
|
||||
description: API for isolation monitors
|
||||
config:
|
||||
cfg_communication_check_to_s:
|
||||
description: "Maximum time between two communication check events. Values <= 0 disables communication checks."
|
||||
type: integer
|
||||
default: 5
|
||||
cfg_heartbeat_interval_ms:
|
||||
description: "Interval between two heartbeat messages send by the API. Values <= 0 disable heartbeat."
|
||||
type: integer
|
||||
default: 1000
|
||||
|
||||
provides:
|
||||
main:
|
||||
interface: isolation_monitor
|
||||
description: "Allows EVerest to control an isolation monitor device via API clients."
|
||||
|
||||
enable_external_mqtt: true
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Cornelius Claussen
|
||||
- Jan Christoph Habig
|
||||
- Florin Mihut
|
||||
- Miriam Thome
|
||||
Reference in New Issue
Block a user