From f9b67aecdc07d31def64175e0f58e9c0a113f94c Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 25 Jun 2019 16:23:02 +0200 Subject: Minor improvements - Remove now unused forward declaration of active_diagnostic_request_t - Factorize calling the signals_manager at binding initialization. - retab... Bug-AGL: SPEC-2386 Change-Id: I418fddd80ef8b856c198dc697760a6edf0918012 Signed-off-by: Stephane Desneux Signed-off-by: Romain Forlot --- low-can-binding/binding/low-can-cb.cpp | 4 ++-- low-can-binding/binding/low-can-subscription.cpp | 10 +++++----- low-can-binding/can/message/j1939-message.cpp | 3 +-- low-can-binding/can/message/j1939-message.hpp | 7 +++---- low-can-binding/can/signals.cpp | 1 - low-can-binding/can/signals.hpp | 2 -- low-can-binding/diagnostic/active-diagnostic-request.cpp | 3 ++- low-can-binding/diagnostic/diagnostic-manager.cpp | 2 +- low-can-binding/diagnostic/diagnostic-manager.hpp | 2 -- 9 files changed, 14 insertions(+), 20 deletions(-) (limited to 'low-can-binding') diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp index b6a18ebb..dbeaa555 100644 --- a/low-can-binding/binding/low-can-cb.cpp +++ b/low-can-binding/binding/low-can-cb.cpp @@ -700,6 +700,7 @@ int init_binding(afb_api_t api) can_bus_manager.set_can_devices(); can_bus_manager.start_threads(); + utils::signals_manager_t& sm = utils::signals_manager_t::instance(); /// Initialize Diagnostic manager that will handle obd2 requests. /// We pass by default the first CAN bus device to its Initialization. @@ -709,7 +710,7 @@ int init_binding(afb_api_t api) // Add a recurring dignostic message request to get engine speed at all times. openxc_DynamicField search_key = build_DynamicField("diagnostic_messages.engine.speed"); - struct utils::signals_found sf = utils::signals_manager_t::instance().find_signals(search_key); + struct utils::signals_found sf = sm.find_signals(search_key); if(sf.signals.empty() && sf.diagnostic_messages.size() == 1) { @@ -718,7 +719,6 @@ int init_binding(afb_api_t api) struct event_filter_t event_filter; event_filter.frequency = sf.diagnostic_messages.front()->get_frequency(); - utils::signals_manager_t& sm = utils::signals_manager_t::instance(); std::map >& s = sm.get_subscribed_signals(); subscribe_unsubscribe_diagnostic_messages(request, true, sf.diagnostic_messages, event_filter, s, true); diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp index 54cd314c..c2f31a03 100644 --- a/low-can-binding/binding/low-can-subscription.cpp +++ b/low-can-binding/binding/low-can-subscription.cpp @@ -248,14 +248,14 @@ int low_can_subscription_t::open_socket(low_can_subscription_t &subscription, co std::shared_ptr socket = std::make_shared(); ret = socket->open(subscription.signal_->get_message()->get_bus_device_name(), name, pgn, addr); subscription.socket_ = socket; - } - else if ( !bus_name.empty()) - { + } + else if ( !bus_name.empty()) + { std::shared_ptr socket = std::make_shared(); ret = socket->open(bus_name, name, pgn, addr); subscription.socket_ = socket; - } - subscription.index_ = (int)subscription.socket_->socket(); + } + subscription.index_ = (int)subscription.socket_->socket(); } else { diff --git a/low-can-binding/can/message/j1939-message.cpp b/low-can-binding/can/message/j1939-message.cpp index 147ab735..dad8e7f1 100644 --- a/low-can-binding/can/message/j1939-message.cpp +++ b/low-can-binding/can/message/j1939-message.cpp @@ -15,10 +15,9 @@ * limitations under the License. */ -#include "./j1939-message.hpp" #include #include "../../binding/low-can-hat.hpp" - +#include "j1939-message.hpp" /// /// @brief Class constructor diff --git a/low-can-binding/can/message/j1939-message.hpp b/low-can-binding/can/message/j1939-message.hpp index b0f0b090..482f167d 100644 --- a/low-can-binding/can/message/j1939-message.hpp +++ b/low-can-binding/can/message/j1939-message.hpp @@ -16,9 +16,10 @@ */ #pragma once -#include + #include -#include "./message.hpp" +#include "message.hpp" +#include "../../utils/socketcan-j1939.hpp" #define J1939_MAX_MULTIPACKETS 255 #define J1939_MAX_DLEN J1939_MAX_MULTIPACKETS * CAN_MAX_DLEN @@ -69,5 +70,3 @@ class j1939_message_t : public message_t struct bcm_msg get_bcm_msg(); void set_bcm_msg(struct bcm_msg bcm_msg); }; - - diff --git a/low-can-binding/can/signals.cpp b/low-can-binding/can/signals.cpp index e843bedb..b47001bd 100644 --- a/low-can-binding/can/signals.cpp +++ b/low-can-binding/can/signals.cpp @@ -22,7 +22,6 @@ #include "../binding/application.hpp" #include "../utils/signals.hpp" #include "can-decoder.hpp" -#include "message/can-message.hpp" #include "can-bus.hpp" #include "../diagnostic/diagnostic-message.hpp" #include "canutil/write.h" diff --git a/low-can-binding/can/signals.hpp b/low-can-binding/can/signals.hpp index 2507fd2a..cefd8b81 100644 --- a/low-can-binding/can/signals.hpp +++ b/low-can-binding/can/signals.hpp @@ -26,8 +26,6 @@ #include "openxc.pb.h" #include "message-definition.hpp" #include "../utils/timer.hpp" -#include "../utils/socketcan-bcm.hpp" -#include "message/can-message.hpp" #include "../diagnostic/diagnostic-message.hpp" #define MESSAGE_SET_ID 0 diff --git a/low-can-binding/diagnostic/active-diagnostic-request.cpp b/low-can-binding/diagnostic/active-diagnostic-request.cpp index c5af449b..80d2e696 100644 --- a/low-can-binding/diagnostic/active-diagnostic-request.cpp +++ b/low-can-binding/diagnostic/active-diagnostic-request.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include + #include +#include #include "active-diagnostic-request.hpp" diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index fa1d87af..d78c7755 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -124,7 +124,7 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8 bcm_msg.frames[0] = cf; - std::shared_ptr msg = std::make_shared(); + std::shared_ptr msg = std::make_shared(); msg->set_bcm_msg(bcm_msg); diff --git a/low-can-binding/diagnostic/diagnostic-manager.hpp b/low-can-binding/diagnostic/diagnostic-manager.hpp index 64a19d7c..784bcd70 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.hpp +++ b/low-can-binding/diagnostic/diagnostic-manager.hpp @@ -32,8 +32,6 @@ /// #define DIAGNOSTIC_RESPONSE_ARBITRATION_ID_OFFSET 0x8 -class active_diagnostic_request_t; - /// /// @brief The core structure for running the diagnostics module of the binding. /// -- cgit 1.2.3-korg