X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fdiagnostic%2Fdiagnostic-manager.cpp;h=9357883b9f9e192589a127c11cc1ed2e7826dfd0;hb=52daf5215513cb7378adebe4fa05bb3c50016793;hp=91dba470c153afe16fafcd7fdd33a94d0a277a94;hpb=64691cf96f9c4d7ff59dbd49e1fe01d26c1a00f6;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index 91dba470..9357883b 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -56,16 +56,24 @@ diagnostic_manager_t::~diagnostic_manager_t() /// /// this will initialize DiagnosticShims and cancel all active requests /// if there are any. -bool diagnostic_manager_t::initialize() +bool diagnostic_manager_t::initialize(std::string diagnostic_bus) { - // Mandatory to set the bus before intialize shims. - bus_ = application_t::instance().get_diagnostic_bus(); + if (! diagnostic_bus.empty()) + { + bus_ = diagnostic_bus; + init_diagnostic_shims(); + reset(); - init_diagnostic_shims(); - reset(); + AFB_DEBUG("Diagnostic Manager initialized"); + initialized_ = true; + return initialized_; + } + AFB_ERROR("Diagnostic Manager missing its bus name in the config"); + return initialized_; +} - initialized_ = true; - AFB_DEBUG("Diagnostic Manager initialized"); +bool diagnostic_manager_t::is_initialized() const +{ return initialized_; } @@ -113,6 +121,8 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8 bcm_msg.msg_head.can_id = arbitration_id; bcm_msg.msg_head.flags = SETTIMER|STARTTIMER|TX_CP_CAN_ID; bcm_msg.msg_head.count = 0; + bcm_msg.msg_head.ival1.tv_sec = 0; + bcm_msg.msg_head.ival1.tv_usec = 0; bcm_msg.msg_head.ival2.tv_sec = freq.tv_sec; bcm_msg.msg_head.ival2.tv_usec = freq.tv_usec; bcm_msg.msg_head.nframes = 1;