diff options
Diffstat (limited to 'CAN-binder')
-rw-r--r-- | CAN-binder/low-can-binding/binding/low-can-cb.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/socketcan-bcm.cpp | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp index 6504acf7..245a9ce5 100644 --- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp +++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp @@ -61,7 +61,9 @@ low_can_subscription_t::low_can_subscription_t(struct event_filter_t event_filte low_can_subscription_t::low_can_subscription_t(struct event_filter_t event_filter, std::shared_ptr<diagnostic_message_t> diagnostic_message) : diagnostic_message_{diagnostic_message}, event_filter_{event_filter} -{} +{ + index_ = diagnostic_message->get_pid(); +} low_can_subscription_t::low_can_subscription_t( low_can_subscription_t&& s) : index_{s.index_}, 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 <sys/ioctl.h> #include <fcntl.h> +#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; } |