summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-04-21 18:20:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-21 18:20:42 +0200
commit20c0dec8fd46f14c95618b7baed16c3c828ad530 (patch)
tree96d22269b6c7841a7ba7884c144f0f1810e6d2f9 /CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
parent4f3b7570bb8e4c6943116026cf42da04830f7243 (diff)
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp')
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp7
1 files changed, 4 insertions, 3 deletions
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<diagnostic_message_t*> 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.")));