From 4ab2164774bdb9a29b2f180a9013c26c0155628d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 2 Jun 2017 19:45:01 +0200 Subject: Get diag manager's socket into subscription obj Subscription index map is the socket ID which implies the following: - All diagnostic messages subscriptions are stored into a vector holding diagnostic_message and there is 1 socket for all like the diag manager did. - Reworked workflow to open a BCM socket and adding an RX filter more flexible. - Separated methods to handle on_no_clients event. - Cleaning diagnostic manager code to remove all unneeded stuff now. - Embed diagnostic response in VehicleMessage decoded message to be able transmits the PID in event push thread. This is needed by to correctly handle case when there is no clients subscribed to an AFB event. Else we can't find the diagnostic message to remove from low_can_subscription vector. Change-Id: Iab13fd556cda3c69827bcd67f3a23a03cb6a2cf2 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan-bcm.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (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 cd84a851..2b00adbd 100644 --- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp @@ -69,11 +69,9 @@ namespace utils socketcan_bcm_t& operator>>(socketcan_bcm_t& s, can_message_t& cm) { - struct { - struct bcm_msg_head msg_head; - struct can_frame frames; - } msg; + struct utils::simple_bcm_msg msg; + ::memset(&msg, 0, sizeof(msg)); const struct sockaddr_can& addr = s.get_tx_address(); socklen_t addrlen = sizeof(addr); struct ifreq ifr; @@ -92,10 +90,7 @@ namespace utils cm = ::can_message_t::convert_from_frame(msg.frames , nbytes-sizeof(struct bcm_msg_head), timestamp); - 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());} + cm.set_sub_id((int)s.socket()); return s; } -- cgit 1.2.3-korg