From fdcc36f1b9dbc0cb95cf4b968823c2be4d7227d0 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 26 Apr 2017 18:24:03 +0200 Subject: Finish to read stream and fill the destination object. Use AFB log system Change-Id: I5aa727ce7f9db5b6f18df5957f31f37d9af88d20 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'CAN-binder/low-can-binding') diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp index 3385f0cb..486c34f6 100644 --- a/CAN-binder/low-can-binding/utils/socketcan.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan.cpp @@ -145,7 +145,7 @@ namespace utils struct can_frame frames; } msg; - struct sockaddr_can addr = s.get_tx_address(); + const struct sockaddr_can& addr = s.get_tx_address(); socklen_t addrlen = sizeof(addr); struct ifreq ifr; @@ -153,11 +153,12 @@ namespace utils ifr.ifr_ifindex = addr.can_ifindex; ioctl(s.socket(), SIOCGIFNAME, &ifr); - printf("Data available: %i bytes read\n", (int)nbytes); - printf("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X\n", ifr.ifr_name, msg.msg_head.can_id, msg.frames.len, + DEBUG(binder_interface, "Data available: %i bytes read", (int)nbytes); + DEBUG(binder_interface, "read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, msg.msg_head.can_id, msg.frames.can_dlc, msg.frames.data[0], msg.frames.data[1], msg.frames.data[2], msg.frames.data[3], msg.frames.data[4], msg.frames.data[5], msg.frames.data[6], msg.frames.data[7]); - + cm = ::can_message_t::convert_from_frame(msg.frames , nbytes-sizeof(struct bcm_msg_head)); + return s; } -- cgit 1.2.3-korg