summaryrefslogtreecommitdiffstats
path: root/src/can-bus.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-01 17:42:52 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-01 17:42:52 +0100
commit937fe8e40aba5eb37c69fd5ff6bf4d800541a009 (patch)
treecd7b1d7919aacba6861ab63e98ed924531b00002 /src/can-bus.cpp
parent4f06114c79f804ed404d40ffad771cbacab0fe8b (diff)
New way to return canfd_frame with now number of read bytes.
This way, we can detect correctly the max data length and set the data correctly. Change-Id: I346df154df76dbd4a463d1fabfd9edd56faca506 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-bus.cpp')
-rw-r--r--src/can-bus.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/can-bus.cpp b/src/can-bus.cpp
index 6279a2a7..631f6090 100644
--- a/src/can-bus.cpp
+++ b/src/can-bus.cpp
@@ -355,7 +355,7 @@ int can_bus_dev_t::close()
return can_socket_;
}
-canfd_frame can_bus_dev_t::read()
+std::pair<struct canfd_frame&, size_t> can_bus_dev_t::read()
{
ssize_t nbytes;
//int maxdlen;
@@ -379,7 +379,7 @@ canfd_frame can_bus_dev_t::read()
::memset(&cfd, 0, sizeof(cfd));
}
- return cfd;
+ return std::pair<struct canfd_frame&, size_t>(cfd, nbytes);
}
void can_bus_dev_t::start_reading(can_bus_t& can_bus)