From 20c0dec8fd46f14c95618b7baed16c3c828ad530 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 21 Apr 2017 18:20:42 +0200 Subject: Move all signals search functions into new signals_manager_t object Create a class from signals lookup and find standalone function and gather all find function into it. There is now only 1 function to find either CAN signals or diagnostic messages, results are returned using an ad-hoc struct containing vector of one or the other type pointers. This object also hold subscribed_signals map with events, so this class is a singleton. Change-Id: I3584c6a91201e6904edc6aeac0abfa1785bdeccc Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp') diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp index e3a78d0f..7bbd780b 100644 --- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -21,6 +21,7 @@ #include "diagnostic-manager.hpp" #include "../utils/openxc-utils.hpp" +#include "../utils/signals.hpp" #include "../configuration.hpp" #define MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ 10 @@ -534,9 +535,9 @@ openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_dia // If not success but completed then the pid isn't supported if(!response.success) { - std::vector found_signals; - configuration_t::instance().find_diagnostic_messages( build_DynamicField(adr->get_name()), found_signals ); - found_signals.front()->set_supported(false); + struct utils::signals_found found_signals; + found_signals = utils::signals_manager_t::instance().find_signals(build_DynamicField(adr->get_name())); + found_signals.diagnostic_messages.front()->set_supported(false); cleanup_request(adr, true); NOTICE(binder_interface, "relay_diagnostic_response: PID not supported or ill formed. Please unsubscribe from it. Error code : %d", response.negative_response_code); message = build_VehicleMessage(build_SimpleMessage(adr->get_name(), build_DynamicField("This PID isn't supported by your vehicle."))); -- cgit 1.2.3-korg