summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-04-26 18:24:03 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-27 01:03:34 +0200
commitfdcc36f1b9dbc0cb95cf4b968823c2be4d7227d0 (patch)
treebf71f432c2cd0dc62e539d32e53932316bc4156c
parent94022218f9212c7c59284a8bff4b9c47f5f9b351 (diff)
Finish to read stream and fill the destination object.
Use AFB log system Change-Id: I5aa727ce7f9db5b6f18df5957f31f37d9af88d20 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.cpp9
1 files changed, 5 insertions, 4 deletions
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;
}