From cc76d9863d8f528d6299b8ecdbfc2f7f437ac5de Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 1 Jun 2017 13:48:19 +0200 Subject: Use UDS PID has key to record subscriptions can_signal_t use socket number but has for OBD2 diagnostic request there is only 1 socket to listen all response then we use PID has key to find the subscription later on the processing. Change-Id: I5f0554e1a4ac43e1046d9b7b7f9bb00d3a753562 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan-bcm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'CAN-binder/low-can-binding/utils') diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp index 1009a421..cd84a851 100644 --- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp @@ -21,6 +21,8 @@ #include #include +#include "../binding/application.hpp" + namespace utils { /// @brief Connect the socket. @@ -90,7 +92,10 @@ namespace utils cm = ::can_message_t::convert_from_frame(msg.frames , nbytes-sizeof(struct bcm_msg_head), timestamp); - cm.set_sub_id((int)s.socket()); + if(application_t::instance().get_diagnostic_manager().is_diagnostic_response(cm)) + {cm.set_sub_id(msg.frames.data[2]);} + else + {cm.set_sub_id((int)s.socket());} return s; } -- cgit 1.2.3-korg