summaryrefslogtreecommitdiffstats
path: root/src/can-utils.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-14 18:20:22 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-14 18:22:04 +0100
commitb162907a78a1846d99f0951a052d6d721eb96f08 (patch)
tree2980ae6ad7ccf126e034c28a4635167f647f857c /src/can-utils.cpp
parentb59d45196f14f2401e148bbe37c04b514850d859 (diff)
Implement CanMessage_c method to navigate through
can_message queue (get/set) Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-utils.cpp')
-rw-r--r--src/can-utils.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/can-utils.cpp b/src/can-utils.cpp
index 67214105..09f49476 100644
--- a/src/can-utils.cpp
+++ b/src/can-utils.cpp
@@ -128,6 +128,29 @@ int CanBus_c::send_can_message(CanMessage_c can_msg)
return 0;
}
+/*
+ * Get a CanMessage from can_message_q and return it
+ * then point to the next CanMessage in queue.
+ *
+ * Return the next queue element or NULL if queue is empty.
+ */
+CanMessage_c* CanBus_c::next_can_message()
+{
+ if(! can_message_q.empty())
+ {
+ CanMessage_c can_msg = can_message_q.front();
+ can_message_q.pop()
+ return &can_msg;
+ }
+
+ return NULL;
+}
+
+void CanBus_c::insert_new_can_message(CanMessage_c *can_msg)
+{
+ can_message_q.push(can_msg);
+}
+
/********************************************************************************
*
* CanMessage method implementation