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,6 @@
|
||||
project(everest-core_tests
|
||||
DESCRIPTION "Extending EVerest with testing modules/interfaces/types/errors.. etc"
|
||||
LANGUAGES CXX C)
|
||||
ev_add_project(SKIP_DOC_GENERATION)
|
||||
|
||||
add_subdirectory(config)
|
||||
@@ -0,0 +1,6 @@
|
||||
# install configs
|
||||
install(
|
||||
DIRECTORY "."
|
||||
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/everest"
|
||||
FILES_MATCHING PATTERN "*.yaml"
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
active_modules:
|
||||
test_error_handling:
|
||||
module: TestErrorHandling
|
||||
connections:
|
||||
error_raiser:
|
||||
- module_id: probe
|
||||
implementation_id: main
|
||||
test_error_handling_not_req:
|
||||
module: TestErrorHandling
|
||||
connections:
|
||||
error_raiser:
|
||||
- module_id: probe
|
||||
implementation_id: main
|
||||
@@ -0,0 +1,18 @@
|
||||
active_modules:
|
||||
error_history:
|
||||
module: ErrorHistory
|
||||
test_error_handling:
|
||||
module: TestErrorHandling
|
||||
connections:
|
||||
error_raiser:
|
||||
- module_id: probe
|
||||
implementation_id: main
|
||||
probe:
|
||||
module: ProbeModule
|
||||
connections:
|
||||
test_error_handling:
|
||||
- module_id: test_error_handling
|
||||
implementation_id: main
|
||||
error_history:
|
||||
- module_id: error_history
|
||||
implementation_id: error_history
|
||||
@@ -0,0 +1,11 @@
|
||||
description: >-
|
||||
Set of test error definitions
|
||||
errors:
|
||||
- name: TestErrorA
|
||||
description: Test error A
|
||||
- name: TestErrorB
|
||||
description: Test error B
|
||||
- name: TestErrorC
|
||||
description: Test error C
|
||||
- name: TestErrorD
|
||||
description: Test error D
|
||||
@@ -0,0 +1,84 @@
|
||||
description: >-
|
||||
This interface defines an testing interface that allows to control the
|
||||
usage of error handling features
|
||||
cmds:
|
||||
clear_error:
|
||||
description: This command clears all errors of a specific type
|
||||
arguments:
|
||||
type:
|
||||
description: This argument allows to specify the type
|
||||
cleared
|
||||
type: string
|
||||
enum:
|
||||
- test_errors/TestErrorA
|
||||
- test_errors/TestErrorB
|
||||
- test_errors/TestErrorC
|
||||
- test_errors/TestErrorD
|
||||
sub_type:
|
||||
description: This argument allows to specify the sub type
|
||||
type: string
|
||||
clear_all_errors:
|
||||
description: This command clears all errors that are raised by this implementation
|
||||
raise_error:
|
||||
description: This command raises an error
|
||||
arguments:
|
||||
type:
|
||||
description: This argument allows to specify the type
|
||||
raised
|
||||
type: string
|
||||
enum:
|
||||
- test_errors/TestErrorA
|
||||
- test_errors/TestErrorB
|
||||
- test_errors/TestErrorC
|
||||
- test_errors/TestErrorD
|
||||
sub_type:
|
||||
description: This argument allows to specify the sub type
|
||||
type: string
|
||||
message:
|
||||
description: This argument allows to specify the message
|
||||
type: string
|
||||
severity:
|
||||
description: This argument allows to specify the severity
|
||||
type: string
|
||||
enum:
|
||||
- Low
|
||||
- Medium
|
||||
- High
|
||||
vars:
|
||||
errors_subscribe_TestErrorA:
|
||||
description: >-
|
||||
This variable publishes the errors raised by error_raiser
|
||||
type: object
|
||||
errors_cleared_subscribe_TestErrorA:
|
||||
description: >-
|
||||
This variable publishes the errors that are cleared by error_raiser
|
||||
type: object
|
||||
errors_subscribe_TestErrorB:
|
||||
description: >-
|
||||
This variable publishes the errors raised by error_raiser
|
||||
type: object
|
||||
errors_cleared_subscribe_TestErrorB:
|
||||
description: >-
|
||||
This variable publishes the errors that are cleared by error_raiser
|
||||
type: object
|
||||
errors_subscribe_all:
|
||||
description: >-
|
||||
This variable publishes the errors raised by error_raiser
|
||||
type: object
|
||||
errors_cleared_subscribe_all:
|
||||
description: >-
|
||||
This variable publishes the errors that are cleared by error_raiser
|
||||
type: object
|
||||
errors_subscribe_global_all:
|
||||
description: >-
|
||||
This variable publishes the errors raised by any module/implementation
|
||||
type: object
|
||||
errors_cleared_subscribe_global_all:
|
||||
description: >-
|
||||
This variable publishes the errors that are cleared by any module/implementation
|
||||
type: object
|
||||
errors:
|
||||
- reference: /errors/test_errors#/TestErrorA
|
||||
- reference: /errors/test_errors#/TestErrorB
|
||||
- reference: /errors/test_errors#/TestErrorC
|
||||
- reference: /errors/test_errors#/TestErrorD
|
||||
@@ -0,0 +1,4 @@
|
||||
description: >-
|
||||
This interface defines a test interface that allows to raise errors
|
||||
errors:
|
||||
- reference: /errors/test_errors
|
||||
@@ -0,0 +1 @@
|
||||
ev_add_module(TestErrorHandling SKIP_DOC_GENERATION)
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/test_error_handlingImpl.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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "TestErrorHandling.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void TestErrorHandling::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void TestErrorHandling::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef TEST_ERROR_HANDLING_HPP
|
||||
#define TEST_ERROR_HANDLING_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/test_error_handling/Implementation.hpp>
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/test_error_raiser/Interface.hpp>
|
||||
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
// insert your custom include headers here
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
|
||||
namespace module {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class TestErrorHandling : public Everest::ModuleBase {
|
||||
public:
|
||||
TestErrorHandling() = delete;
|
||||
TestErrorHandling(const ModuleInfo& info, std::unique_ptr<test_error_handlingImplBase> p_main,
|
||||
std::unique_ptr<test_error_raiserIntf> r_error_raiser, Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), r_error_raiser(std::move(r_error_raiser)), config(config){};
|
||||
|
||||
const std::unique_ptr<test_error_handlingImplBase> p_main;
|
||||
const std::unique_ptr<test_error_raiserIntf> r_error_raiser;
|
||||
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
|
||||
// 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 // TEST_ERROR_HANDLING_HPP
|
||||
@@ -0,0 +1,73 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "test_error_handlingImpl.hpp"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <utils/error.hpp>
|
||||
#include <utils/error/error_json.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void test_error_handlingImpl::init() {
|
||||
this->mod->r_error_raiser->subscribe_error(
|
||||
"test_errors/TestErrorA",
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_subscribe_TestErrorA(json(error));
|
||||
},
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_cleared_subscribe_TestErrorA(json(error));
|
||||
});
|
||||
this->mod->r_error_raiser->subscribe_error(
|
||||
"test_errors/TestErrorB",
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_subscribe_TestErrorB(json(error));
|
||||
},
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_cleared_subscribe_TestErrorB(json(error));
|
||||
});
|
||||
this->mod->r_error_raiser->subscribe_all_errors(
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_subscribe_all(json(error));
|
||||
},
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_cleared_subscribe_all(json(error));
|
||||
});
|
||||
subscribe_global_all_errors(
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_subscribe_global_all(json(error));
|
||||
},
|
||||
[this](const Everest::error::Error& error) {
|
||||
EVLOG_debug << fmt::format("received error: {}", json(error).dump(2));
|
||||
this->publish_errors_cleared_subscribe_global_all(json(error));
|
||||
});
|
||||
}
|
||||
|
||||
void test_error_handlingImpl::ready() {
|
||||
}
|
||||
|
||||
void test_error_handlingImpl::handle_clear_error(std::string& type, std::string& sub_type) {
|
||||
this->clear_error(type, sub_type);
|
||||
}
|
||||
|
||||
void test_error_handlingImpl::handle_clear_all_errors() {
|
||||
this->clear_all_errors_of_impl();
|
||||
}
|
||||
|
||||
void test_error_handlingImpl::handle_raise_error(std::string& type, std::string& sub_type, std::string& message,
|
||||
std::string& severity) {
|
||||
Everest::error::Error error =
|
||||
this->error_factory->create_error(type, sub_type, message, Everest::error::string_to_severity(severity));
|
||||
this->raise_error(error);
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_TEST_ERROR_HANDLING_IMPL_HPP
|
||||
#define MAIN_TEST_ERROR_HANDLING_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/test_error_handling/Implementation.hpp>
|
||||
|
||||
#include "../TestErrorHandling.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 test_error_handlingImpl : public test_error_handlingImplBase {
|
||||
public:
|
||||
test_error_handlingImpl() = delete;
|
||||
test_error_handlingImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<TestErrorHandling>& mod,
|
||||
Conf& config) :
|
||||
test_error_handlingImplBase(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_clear_error(std::string& type, std::string& sub_type) override;
|
||||
virtual void handle_clear_all_errors() override;
|
||||
virtual void handle_raise_error(std::string& type, std::string& sub_type, std::string& message,
|
||||
std::string& severity) override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<TestErrorHandling>& 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_TEST_ERROR_HANDLING_IMPL_HPP
|
||||
@@ -0,0 +1,13 @@
|
||||
description: Defines a module that uses error handling features on command
|
||||
provides:
|
||||
main:
|
||||
description: This implements an interface that provides control over error handling features
|
||||
interface: test_error_handling
|
||||
requires:
|
||||
error_raiser:
|
||||
interface: test_error_raiser
|
||||
enable_global_errors: true
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Andreas Heinrich
|
||||
Reference in New Issue
Block a user