Skip to content

Commit

Permalink
Add ErrorStateMonitor for global errors (#149)
Browse files Browse the repository at this point in the history
* add global_error_state_monitor

Signed-off-by: Andreas Heinrich <[email protected]>

* bump version

Signed-off-by: Andreas Heinrich <[email protected]>

---------

Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm authored Jun 14, 2024
1 parent d144f55 commit 2ab347a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ev-dev-tools/src/ev_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""EVerest command line utility."""
__version__ = '0.1.0'
__version__ = '0.1.1'
25 changes: 17 additions & 8 deletions ev-dev-tools/src/ev_cli/templates/ld-ev.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include <framework/runtime.hpp>
#include <utils/types.hpp>

{% if info.enable_global_errors %}
#include <utils/error/error_manager_req_global.hpp>

{% endif %}
namespace module {

// FIXME (aw): could this way of keeping static variables be changed somehow?
Expand All @@ -26,6 +30,19 @@ static {{ impl.id }}::Conf {{ impl.id }}_config;
static Conf module_conf;
static ModuleInfo module_info;

{% if info.enable_global_errors %}
void subscribe_global_all_errors(
const Everest::error::ErrorCallback& callback,
const Everest::error::ErrorCallback& clear_callback
) {
adapter.get_global_error_manager()->subscribe_global_all_errors(callback, clear_callback);
}

std::shared_ptr<Everest::error::ErrorStateMonitor> get_global_error_state_monitor() {
return adapter.get_global_error_state_monitor();
}

{% endif %}
void LdEverest::init(ModuleConfigs module_configs, const ModuleInfo& mod_info) {
EVLOG_debug << "init() called on module {{ info.name }}";

Expand Down Expand Up @@ -115,14 +132,6 @@ std::vector<Everest::cmd> everest_register(const json& connections) {
return adapter.registered_commands;
}

{% if info.enable_global_errors %}
void subscribe_global_all_errors(
const Everest::error::ErrorCallback& callback,
const Everest::error::ErrorCallback& clear_callback
) {
adapter.subscribe_global_all_errors(callback, clear_callback);
}
{% endif %}
} // namespace module

int main(int argc, char* argv[]) {
Expand Down
1 change: 1 addition & 0 deletions ev-dev-tools/src/ev_cli/templates/ld-ev.hpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void subscribe_global_all_errors(
const Everest::error::ErrorCallback& callback,
const Everest::error::ErrorCallback& clear_callback
);
std::shared_ptr<Everest::error::ErrorStateMonitor> get_global_error_state_monitor();
{% endif %}

} // namespace module
Expand Down

0 comments on commit 2ab347a

Please sign in to comment.