From 3c7fa35fe09693f367ee9b159723435007ebfa07 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 6 Dec 2019 11:34:05 +0100 Subject: diag-mngr: Fix sending and change init This commit fix the wrong bcm ival1 value set because the struct hasn't been initialized so it use a wrong value that can not be handled by the socket. Initialize diagnotstic manager depending on JSON configuration file This avoid to request engine_speed signal when there isn't any diagnostic_bus configured in the JSON file. Change-Id: I98145a6e20c29a644c856d818f104c6bd8069f9f Signed-off-by: Romain Forlot --- low-can-binding/diagnostic/diagnostic-manager.cpp | 7 +++++++ low-can-binding/diagnostic/diagnostic-manager.hpp | 1 + 2 files changed, 8 insertions(+) (limited to 'low-can-binding/diagnostic') diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index f3c513c5..9357883b 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -72,6 +72,11 @@ bool diagnostic_manager_t::initialize(std::string diagnostic_bus) return initialized_; } +bool diagnostic_manager_t::is_initialized() const +{ + return initialized_; +} + /// @brief initialize shims used by UDS lib and set initialized_ to true. /// It is needed before used the diagnostic manager fully because shims are /// required by most member functions. @@ -116,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; diff --git a/low-can-binding/diagnostic/diagnostic-manager.hpp b/low-can-binding/diagnostic/diagnostic-manager.hpp index c0a8255e..3f74ab79 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.hpp +++ b/low-can-binding/diagnostic/diagnostic-manager.hpp @@ -60,6 +60,7 @@ public: ~diagnostic_manager_t(); bool initialize(std::string diagnostic_bus); + bool is_initialized() const; const std::string get_bus_name() const; const std::string get_bus_device_name() const; -- cgit 1.2.3-korg