diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2019-12-12 10:35:38 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 16:25:36 +0100 |
commit | cc48ab799cf5357f4d573d80c07f6843e50bc8e8 (patch) | |
tree | 9fc4f7fe83d8fd97ddf2ad480513029ee13a9451 | |
parent | 528d41049be287fdd273185ab74a8bb2c8d63f5f (diff) |
diag_mngr: No diagnostic msg if no diagnostic_bus
Change-Id: I840fc6cc7e9cfd171b03cac508fedb8ece4b976d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | low-can-binding/binding/application.cpp | 9 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-cb.cpp | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp index 0b8963cb..c5dfa1b6 100644 --- a/low-can-binding/binding/application.cpp +++ b/low-can-binding/binding/application.cpp @@ -71,10 +71,13 @@ int application_t::add_message_set(std::shared_ptr<message_set_t> new_message_se return -1; } - for(auto new_diag_msg : new_message_set->get_diagnostic_messages()) + if(diagnostic_manager_.is_initialized()) { - if(old_msg_set->add_diagnostic_message(new_diag_msg) < 0) - return -1; + for(auto new_diag_msg : new_message_set->get_diagnostic_messages()) + { + if(old_msg_set->add_diagnostic_message(new_diag_msg) < 0) + return -1; + } } return 0; } diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp index 0bee7ef4..5e03c754 100644 --- a/low-can-binding/binding/low-can-cb.cpp +++ b/low-can-binding/binding/low-can-cb.cpp @@ -79,7 +79,7 @@ int config_low_can(afb_api_t apiHandle, CtlSectionT *section, json_object *json_ /// Initialize Diagnostic manager that will handle obd2 requests. /// We pass by default the first CAN bus device to its Initialization. if(! diagnotic_bus || application_t::instance().get_diagnostic_manager().initialize(diagnotic_bus)) - AFB_WARNING("Diagnostic Manager: not initialized"); + AFB_WARNING("Diagnostic Manager: not initialized. No diagnostic messages will be processed."); return 0; } |