From 07d35aca6e43b684b718140b1a3baa35f90620d5 Mon Sep 17 00:00:00 2001 From: Andreas Heinrich Date: Thu, 13 Jun 2024 01:04:11 +0200 Subject: [PATCH] add error attribute vendor_id Signed-off-by: Andreas Heinrich add global_error_state_monitor Signed-off-by: Andreas Heinrich use build kit branch Signed-off-by: Andreas Heinrich add example module ExampleErrorGlobalSubscriber Signed-off-by: Andreas Heinrich run clang-format Signed-off-by: Andreas Heinrich --- modules/ErrorHistory/ErrorDatabaseSqlite.cpp | 18 ++++-- .../tests/error_database_sqlite_tests.cpp | 6 +- modules/ErrorHistory/tests/helpers.cpp | 24 ++++---- .../EvseManager/tests/ModuleAdapterStub.hpp | 22 ++++--- .../examples/error-framework/CMakeLists.txt | 1 + .../CMakeLists.txt | 21 +++++++ .../ExampleErrorGlobalSubscriber.cpp | 15 +++++ .../ExampleErrorGlobalSubscriber.hpp | 60 ++++++++++++++++++ .../ExampleErrorGlobalSubscriber/doc.rst | 22 +++++++ .../example_error_frameworkImpl.cpp | 30 +++++++++ .../example_error_frameworkImpl.hpp | 61 +++++++++++++++++++ .../manifest.yaml | 10 +++ 12 files changed, 262 insertions(+), 28 deletions(-) create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/CMakeLists.txt create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.cpp create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.hpp create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/doc.rst create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.cpp create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.hpp create mode 100644 modules/examples/error-framework/ExampleErrorGlobalSubscriber/manifest.yaml diff --git a/modules/ErrorHistory/ErrorDatabaseSqlite.cpp b/modules/ErrorHistory/ErrorDatabaseSqlite.cpp index 3944b2b5e3..5352cbb6d0 100644 --- a/modules/ErrorHistory/ErrorDatabaseSqlite.cpp +++ b/modules/ErrorHistory/ErrorDatabaseSqlite.cpp @@ -84,7 +84,8 @@ void ErrorDatabaseSqlite::reset_database() { "timestamp TEXT NOT NULL," "severity TEXT NOT NULL," "state TEXT NOT NULL," - "sub_type TEXT NOT NULL);"; + "sub_type TEXT NOT NULL," + "vendor_id TEXT NOT NULL);"; db.exec(sql); } catch (std::exception& e) { EVLOG_error << "Error creating database: " << e.what(); @@ -102,8 +103,8 @@ void ErrorDatabaseSqlite::add_error_without_mutex(Everest::error::ErrorPtr error try { SQLite::Database db(this->db_path.string(), SQLite::OPEN_READWRITE); std::string sql = "INSERT INTO errors(uuid, type, description, message, origin_module, origin_implementation, " - "timestamp, severity, state, sub_type) VALUES("; - sql += "?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10);"; + "timestamp, severity, state, sub_type, vendor_id) VALUES("; + sql += "?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11);"; SQLite::Statement stmt(db, sql); stmt.bind(1, error->uuid.to_string()); stmt.bind(2, error->type); @@ -115,6 +116,7 @@ void ErrorDatabaseSqlite::add_error_without_mutex(Everest::error::ErrorPtr error stmt.bind(8, Everest::error::severity_to_string(error->severity)); stmt.bind(9, Everest::error::state_to_string(error->state)); stmt.bind(10, error->sub_type); + stmt.bind(11, error->vendor_id); stmt.exec(); } catch (std::exception& e) { EVLOG_error << "Error adding error to database: " << e.what(); @@ -161,6 +163,9 @@ std::string ErrorDatabaseSqlite::filter_to_sql_condition(const Everest::error::E case Everest::error::FilterType::SubType: { condition = "(sub_type = '" + filter.get_sub_type_filter().value + "')"; } break; + case Everest::error::FilterType::VendorId: { + condition = "(vendor_id = '" + filter.get_vendor_id_filter().value + "')"; + } break; } return condition; } @@ -211,9 +216,10 @@ std::list ErrorDatabaseSqlite::get_errors(const std::o const Everest::error::State err_state = Everest::error::string_to_state(stmt.getColumn("state").getText()); const Everest::error::ErrorHandle err_handle(Everest::error::ErrorHandle(stmt.getColumn("uuid").getText())); const Everest::error::ErrorSubType err_sub_type(stmt.getColumn("sub_type").getText()); - Everest::error::ErrorPtr error = - std::make_shared(err_type, err_sub_type, err_msg, err_description, err_origin, - err_severity, err_timestamp, err_handle, err_state); + const std::string err_vendor_id = stmt.getColumn("vendor_id").getText(); + Everest::error::ErrorPtr error = std::make_shared( + err_type, err_sub_type, err_msg, err_description, err_origin, err_vendor_id, err_severity, + err_timestamp, err_handle, err_state); result.push_back(error); } } catch (std::exception& e) { diff --git a/modules/ErrorHistory/tests/error_database_sqlite_tests.cpp b/modules/ErrorHistory/tests/error_database_sqlite_tests.cpp index 9fad5bc91f..3d1af97710 100644 --- a/modules/ErrorHistory/tests/error_database_sqlite_tests.cpp +++ b/modules/ErrorHistory/tests/error_database_sqlite_tests.cpp @@ -20,7 +20,7 @@ SCENARIO("Check ErrorDatabaseSqlite class", "[!throws]") { WHEN("Adding an error") { std::vector test_errors = {std::make_shared( "test_type", "test_sub_type", "test_message", "test_description", - ImplementationIdentifier("test_origin_module", "test_origin_implementation"), + ImplementationIdentifier("test_origin_module", "test_origin_implementation"), "everest-test", Everest::error::Severity::Low, date::utc_clock::now(), Everest::error::UUID(), Everest::error::State::Active)}; db.add_error(test_errors.at(0)); @@ -32,12 +32,12 @@ SCENARIO("Check ErrorDatabaseSqlite class", "[!throws]") { std::vector test_errors = { std::make_shared( "test_type_a", "test_sub_type_a", "test_message_a", "test_description_a", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::High, date::utc_clock::now(), Everest::error::UUID(), Everest::error::State::ClearedByModule), std::make_shared( "test_type_b", "test_sub_type_b", "test_message_b", "test_description_b", - ImplementationIdentifier("test_origin_module_b", "test_origin_implementation_b"), + ImplementationIdentifier("test_origin_module_b", "test_origin_implementation_b"), "everest-test", Everest::error::Severity::Medium, date::utc_clock::now(), Everest::error::UUID(), Everest::error::State::ClearedByReboot)}; for (Everest::error::ErrorPtr error : test_errors) { diff --git a/modules/ErrorHistory/tests/helpers.cpp b/modules/ErrorHistory/tests/helpers.cpp index 1551570112..4a9109d6a8 100644 --- a/modules/ErrorHistory/tests/helpers.cpp +++ b/modules/ErrorHistory/tests/helpers.cpp @@ -18,73 +18,73 @@ std::vector get_test_errors() { return {// index 0 std::make_shared( "test_type_a", "test_sub_type_a", "test_message_a", "test_description_a", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::Low, date::utc_clock::now(), Everest::error::UUID(), Everest::error::State::ClearedByModule), // index 1 std::make_shared( "test_type_b", "test_sub_type_b", "test_message_b", "test_description_b", - ImplementationIdentifier("test_origin_module_b", "test_origin_implementation_b"), + ImplementationIdentifier("test_origin_module_b", "test_origin_implementation_b"), "everest-test", Everest::error::Severity::Low, date::utc_clock::now() + std::chrono::hours(1), Everest::error::UUID(), Everest::error::State::ClearedByModule), // index 2 std::make_shared( "test_type_c", "test_sub_type_c", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::Low, date::utc_clock::now() + std::chrono::hours(2), Everest::error::UUID(), Everest::error::State::ClearedByModule), // index 3 std::make_shared( "test_type_c", "test_sub_type_c", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), + ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), "everest-test", Everest::error::Severity::Low, date::utc_clock::now() + std::chrono::hours(3), Everest::error::UUID(), Everest::error::State::Active), // index 4 std::make_shared( "test_type_c", "test_sub_type_a", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::Medium, date::utc_clock::now() + std::chrono::hours(4), Everest::error::UUID(), Everest::error::State::Active), // index 5 std::make_shared( "test_type_c", "test_sub_type_a", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), + ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), "everest-test", Everest::error::Severity::Medium, date::utc_clock::now() + std::chrono::hours(5), Everest::error::UUID(), Everest::error::State::Active), // index 6 std::make_shared( "test_type_a", "test_sub_type_a", "test_message_a", "test_description_a", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::Medium, date::utc_clock::now() + std::chrono::hours(6), Everest::error::UUID(), Everest::error::State::ClearedByReboot), // index 7 std::make_shared( "test_type_a", "test_sub_type_a", "test_message_a", "test_description_a", - ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), + ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), "everest-test", Everest::error::Severity::Medium, date::utc_clock::now() + std::chrono::hours(7), Everest::error::UUID(), Everest::error::State::ClearedByReboot), // index 8 std::make_shared( "test_type_a", "test_sub_type_a", "test_message_a", "test_description_a", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::High, date::utc_clock::now() + std::chrono::hours(8), Everest::error::UUID(), Everest::error::State::ClearedByReboot), // index 9 std::make_shared( "test_type_c", "test_sub_type_c", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), + ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), "everest-test", Everest::error::Severity::High, date::utc_clock::now() + std::chrono::hours(9), Everest::error::UUID(), Everest::error::State::ClearedByReboot), // index 10 std::make_shared( "test_type_c", "test_sub_type_c", "test_message_c", "test_description_c", - ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), + ImplementationIdentifier("test_origin_module_a", "test_origin_implementation_a"), "everest-test", Everest::error::Severity::High, date::utc_clock::now() + std::chrono::hours(10), Everest::error::UUID(), Everest::error::State::ClearedByReboot), // index 11 std::make_shared( "test_type_b", "test_sub_type_b", "test_message_b", "test_description_b", - ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), + ImplementationIdentifier("test_origin_module_c", "test_origin_implementation_c"), "everest-test", Everest::error::Severity::High, date::utc_clock::now() + std::chrono::hours(11), Everest::error::UUID(), Everest::error::State::ClearedByReboot)}; } diff --git a/modules/EvseManager/tests/ModuleAdapterStub.hpp b/modules/EvseManager/tests/ModuleAdapterStub.hpp index 5b3d71e1ed..a8c38f9ddb 100644 --- a/modules/EvseManager/tests/ModuleAdapterStub.hpp +++ b/modules/EvseManager/tests/ModuleAdapterStub.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -35,10 +36,8 @@ struct ModuleAdapterStub : public Everest::ModuleAdapter { get_error_state_monitor_req = [this](const Requirement& req) { return this->get_error_state_monitor_req_fn(req); }; - subscribe_global_all_errors = [this](const Everest::error::ErrorCallback& cb1, - const Everest::error::ErrorCallback& cb2) { - this->subscribe_global_all_errors_fn(cb1, cb2); - }; + get_global_error_manager = [this]() { return this->get_global_error_manager_fn(); }; + get_global_error_state_monitor = [this]() { return this->get_global_error_state_monitor_fn(); }; ext_mqtt_publish = [this](const std::string& s1, const std::string& s2) { this->ext_mqtt_publish_fn(s1, s2); }; ext_mqtt_subscribe = [this](const std::string& str, StringHandler sh) { @@ -88,9 +87,18 @@ struct ModuleAdapterStub : public Everest::ModuleAdapter { return std::make_shared( Everest::error::ErrorStateMonitor(std::make_shared())); } - virtual void subscribe_global_all_errors_fn(const Everest::error::ErrorCallback&, - const Everest::error::ErrorCallback&) { - std::printf("subscribe_global_all_errors_fn\n"); + virtual std::shared_ptr get_global_error_manager_fn() { + std::printf("get_global_error_manager_fn\n"); + return std::make_shared( + std::make_shared(), std::make_shared(), + [](const Everest::error::ErrorCallback&, const Everest::error::ErrorCallback&) { + std::printf("global_subscribe_all_errors\n"); + }); + } + virtual std::shared_ptr get_global_error_state_monitor_fn() { + std::printf("get_global_error_state_monitor\n"); + return std::make_shared( + std::make_shared()); } virtual void ext_mqtt_publish_fn(const std::string&, const std::string&) { std::printf("ext_mqtt_publish_fn\n"); diff --git a/modules/examples/error-framework/CMakeLists.txt b/modules/examples/error-framework/CMakeLists.txt index 46bd1ad292..9ce28d1bf4 100644 --- a/modules/examples/error-framework/CMakeLists.txt +++ b/modules/examples/error-framework/CMakeLists.txt @@ -1,5 +1,6 @@ ev_add_module(ExampleErrorRaiser) ev_add_module(ExampleErrorSubscriber) +ev_add_module(ExampleErrorGlobalSubscriber) ev_add_module(PyExampleErrorRaiser) ev_add_module(PyExampleErrorSubscriber) ev_add_module(JsExampleErrorRaiser) diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/CMakeLists.txt b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/CMakeLists.txt new file mode 100644 index 0000000000..bf8f7f4dc1 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/CMakeLists.txt @@ -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 + "example_global_subscriber/example_error_frameworkImpl.cpp" +) + +# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 +# insert other things like install cmds etc here +# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.cpp b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.cpp new file mode 100644 index 0000000000..38801ad261 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.cpp @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Pionix GmbH and Contributors to EVerest +#include "ExampleErrorGlobalSubscriber.hpp" + +namespace module { + +void ExampleErrorGlobalSubscriber::init() { + invoke_init(*p_example_global_subscriber); +} + +void ExampleErrorGlobalSubscriber::ready() { + invoke_ready(*p_example_global_subscriber); +} + +} // namespace module diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.hpp b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.hpp new file mode 100644 index 0000000000..a99bcadee2 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.hpp @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Pionix GmbH and Contributors to EVerest +#ifndef EXAMPLE_ERROR_GLOBAL_SUBSCRIBER_HPP +#define EXAMPLE_ERROR_GLOBAL_SUBSCRIBER_HPP + +// +// AUTO GENERATED - MARKED REGIONS WILL BE KEPT +// template version 2 +// + +#include "ld-ev.hpp" + +// headers for provided interface implementations +#include + +// 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 ExampleErrorGlobalSubscriber : public Everest::ModuleBase { +public: + ExampleErrorGlobalSubscriber() = delete; + ExampleErrorGlobalSubscriber(const ModuleInfo& info, + std::unique_ptr p_example_global_subscriber, + Conf& config) : + ModuleBase(info), p_example_global_subscriber(std::move(p_example_global_subscriber)), config(config){}; + + const std::unique_ptr p_example_global_subscriber; + 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 // EXAMPLE_ERROR_GLOBAL_SUBSCRIBER_HPP diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/doc.rst b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/doc.rst new file mode 100644 index 0000000000..b8c43c45e8 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/doc.rst @@ -0,0 +1,22 @@ +.. _everest_modules_handwritten_ExampleErrorGlobalSubscriber: + +.. This file is a placeholder for an optional single file + handwritten documentation for the ExampleErrorGlobalSubscriber module. + Please decide whether you want to use this single file, + or a set of files in the doc/ directory. + In the latter case, you can delete this file. + In the former case, you can delete the doc/ directory. + +.. This handwritten documentation is optional. In case + you do not want to write it, you can delete this file + and the doc/ directory. + +.. The documentation can be written in reStructuredText, + and will be converted to HTML and PDF by Sphinx. + +******************************************* +ExampleErrorGlobalSubscriber +******************************************* + +:ref:`Link ` to the module's reference. +Simple example module written in C++ to demonstrate error framework on global subscriber side diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.cpp b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.cpp new file mode 100644 index 0000000000..ecb998f3e3 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.cpp @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Pionix GmbH and Contributors to EVerest + +#include "example_error_frameworkImpl.hpp" + +namespace module { +namespace example_global_subscriber { + +void example_error_frameworkImpl::init() { + Everest::error::ErrorCallback error_callback = [this](const Everest::error::Error& error) { + EVLOG_info << "received error: " << error.type; + this->test_state_monitor(); + }; + Everest::error::ErrorCallback error_cleared_callback = [this](const Everest::error::Error& error) { + EVLOG_info << "received error cleared: " << error.type; + this->test_state_monitor(); + }; + subscribe_global_all_errors(error_callback, error_cleared_callback); +} + +void example_error_frameworkImpl::test_state_monitor() { + EVLOG_info << "Currently there are " << get_global_error_state_monitor()->get_ative_error_count() + << " errors active."; +} + +void example_error_frameworkImpl::ready() { +} + +} // namespace example_global_subscriber +} // namespace module diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.hpp b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.hpp new file mode 100644 index 0000000000..40ff5ed751 --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.hpp @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Pionix GmbH and Contributors to EVerest +#ifndef EXAMPLE_GLOBAL_SUBSCRIBER_EXAMPLE_ERROR_FRAMEWORK_IMPL_HPP +#define EXAMPLE_GLOBAL_SUBSCRIBER_EXAMPLE_ERROR_FRAMEWORK_IMPL_HPP + +// +// AUTO GENERATED - MARKED REGIONS WILL BE KEPT +// template version 3 +// + +#include + +#include "../ExampleErrorGlobalSubscriber.hpp" + +// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 +// insert your custom include headers here +// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 + +namespace module { +namespace example_global_subscriber { + +struct Conf {}; + +class example_error_frameworkImpl : public example_error_frameworkImplBase { +public: + example_error_frameworkImpl() = delete; + example_error_frameworkImpl(Everest::ModuleAdapter* ev, + const Everest::PtrContainer& mod, Conf& config) : + example_error_frameworkImplBase(ev, "example_global_subscriber"), mod(mod), config(config){}; + + // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 + // insert your public definitions here + // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 + +protected: + // no commands defined for this interface + + // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 + // insert your protected definitions here + // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 + +private: + const Everest::PtrContainer& mod; + const Conf& config; + + virtual void init() override; + virtual void ready() override; + + // ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1 + void test_state_monitor(); + // 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 example_global_subscriber +} // namespace module + +#endif // EXAMPLE_GLOBAL_SUBSCRIBER_EXAMPLE_ERROR_FRAMEWORK_IMPL_HPP diff --git a/modules/examples/error-framework/ExampleErrorGlobalSubscriber/manifest.yaml b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/manifest.yaml new file mode 100644 index 0000000000..e1cb61a0db --- /dev/null +++ b/modules/examples/error-framework/ExampleErrorGlobalSubscriber/manifest.yaml @@ -0,0 +1,10 @@ +description: Simple example module written in C++ to demonstrate error framework on global subscriber side +provides: + example_global_subscriber: + interface: example_error_framework + description: This implements the example interface +enable_global_errors: true +metadata: + license: https://opensource.org/licenses/Apache-2.0 + authors: + - Andreas Heinrich