-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Heinrich <[email protected]> add global_error_state_monitor Signed-off-by: Andreas Heinrich <[email protected]> use build kit branch Signed-off-by: Andreas Heinrich <[email protected]> add example module ExampleErrorGlobalSubscriber Signed-off-by: Andreas Heinrich <[email protected]> run clang-format Signed-off-by: Andreas Heinrich <[email protected]>
- Loading branch information
Showing
12 changed files
with
262 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
modules/examples/error-framework/ExampleErrorGlobalSubscriber/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
15 changes: 15 additions & 0 deletions
15
...es/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
60 changes: 60 additions & 0 deletions
60
...es/examples/error-framework/ExampleErrorGlobalSubscriber/ExampleErrorGlobalSubscriber.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <generated/interfaces/example_error_framework/Implementation.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 ExampleErrorGlobalSubscriber : public Everest::ModuleBase { | ||
public: | ||
ExampleErrorGlobalSubscriber() = delete; | ||
ExampleErrorGlobalSubscriber(const ModuleInfo& info, | ||
std::unique_ptr<example_error_frameworkImplBase> p_example_global_subscriber, | ||
Conf& config) : | ||
ModuleBase(info), p_example_global_subscriber(std::move(p_example_global_subscriber)), config(config){}; | ||
|
||
const std::unique_ptr<example_error_frameworkImplBase> 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 |
22 changes: 22 additions & 0 deletions
22
modules/examples/error-framework/ExampleErrorGlobalSubscriber/doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <everest_modules_ExampleErrorGlobalSubscriber>` to the module's reference. | ||
Simple example module written in C++ to demonstrate error framework on global subscriber side |
30 changes: 30 additions & 0 deletions
30
...rk/ExampleErrorGlobalSubscriber/example_global_subscriber/example_error_frameworkImpl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.