X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fbinding%2Fapplication.cpp;h=4c9641c47217d6d428a6eb381ef806c20d5c6cd0;hb=9e23caa4c56259044604c38f107f7c637001b846;hp=063a11da05f42da7ac5167c24f7e6fe71bee62bb;hpb=9b17d0359dedbf92de95c1150f7e576d58e0331c;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp index 063a11da..4c9641c4 100644 --- a/low-can-binding/binding/application.cpp +++ b/low-can-binding/binding/application.cpp @@ -25,6 +25,11 @@ #define MICROSECONDS_IN_SECOND 1000000 #define ENGINE_VALUE_TIMEOUT 5 +application_t::application_t() + : can_bus_manager_{} + , message_set_{} +{} + /// @brief Return singleton instance of configuration object. application_t& application_t::instance() { @@ -66,10 +71,13 @@ int application_t::add_message_set(std::shared_ptr 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; } @@ -146,13 +154,9 @@ bool application_t::is_engine_on() if(sf.signals.front()->get_last_value_with_timestamp().first > 0 && std::difftime(std::time(nullptr), last_timestamp_in_s) < ENGINE_VALUE_TIMEOUT) - { engine_on = true; - } else - { AFB_NOTICE("is_engine_on: engine.speed CAN signal found, but engine seems off"); - } } else { @@ -166,13 +170,9 @@ bool application_t::is_engine_on() if(sf.diagnostic_messages.front()->get_last_value_with_timestamp().first > 0 && std::difftime(std::time(nullptr), last_timestamp_in_s) < ENGINE_VALUE_TIMEOUT) - { engine_on = true; - } else - { AFB_NOTICE("is_engine_on: engine.speed diagnostic message found, but engine seems off"); - } } else {