summaryrefslogtreecommitdiffstats
path: root/can_reader.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-10 17:17:24 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-13 23:31:55 +0000
commit49402dc57ea61f6885a4f6a6b10597da099ad31f (patch)
tree621cdd85abad830b1141ea78b5e20ac1044ad56a /can_reader.cpp
parent3b411eee65766d4b6b235f787b0f895ca568d8a7 (diff)
Improve reading and now process CanMessage class
instead of raw canfd_frame. Change-Id: I53f48f94e0e526b93908c21794110b2fd83190cb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'can_reader.cpp')
-rw-r--r--can_reader.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/can_reader.cpp b/can_reader.cpp
index f5e2833e..35ea79e6 100644
--- a/can_reader.cpp
+++ b/can_reader.cpp
@@ -21,10 +21,11 @@
#include <afb/afb-binding.h>
-void can_reader(afb_binding_interface *interface, int socket, std::queue <canfd_frame>& canfd_frame_queue)
+void can_reader(afb_binding_interface *interface, int socket, std::queue <CanMessage_t>& can_message_q)
{
ssize_t nbytes;
int maxdlen;
+ CanMessage_t can_message;
/* Test that socket is really opened */
if ( socket < 0)
@@ -39,7 +40,7 @@ void can_reader(afb_binding_interface *interface, int socket, std::queue <canfd_
switch(nbytes)
{
- case CANFD_MTU:s
+ case CANFD_MTU:
DEBUG(interface, "read_can: Got an CAN FD frame with length %d", canfd_frame.len);
maxdlen = CANFD_MAX_DLEN;
break;
@@ -64,6 +65,10 @@ void can_reader(afb_binding_interface *interface, int socket, std::queue <canfd_
return -4;
}
*/
- canfd_frame_queue.push(canfd_frame);
+
+ can_message.convert_canfd_frame_to_CanMessage(canfd_frame);
+
+
+ can_message_q.push(can_message);
}
}