summaryrefslogtreecommitdiffstats
path: root/src/can-utils.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-20 20:19:59 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-21 10:59:27 +0000
commitcba9b59fab054d3a33a4d58ed227fc3d4b6f6d9d (patch)
treebc504f0955794d17453a4e4e4717c7b108b5cffe /src/can-utils.hpp
parent4bcb47864452b2d219572862aed3d173c3c0a945 (diff)
Clean up include statement...
Change-Id: Ie909836171ea5eb030246255bb08f1c5b8a65641 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-utils.hpp')
-rw-r--r--src/can-utils.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/can-utils.hpp b/src/can-utils.hpp
index 20267ae2..ee87790e 100644
--- a/src/can-utils.hpp
+++ b/src/can-utils.hpp
@@ -23,11 +23,23 @@
#include <cstdio>
#include <string>
#include <thread>
+#include <fcntl.h>
+#include <unistd.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
#include <linux/can.h>
+#include <sys/socket.h>
+#include <linux/can/raw.h>
#include "timer.hpp"
#include "openxc.pb.h"
+extern "C"
+{
+ #include <afb/afb-binding.h>
+ #include <afb/afb-service-itf.h>
+}
+
// TODO actual max is 32 but dropped to 24 for memory considerations
#define MAX_ACCEPTANCE_FILTERS 24
// TODO this takes up a ton of memory
@@ -38,6 +50,13 @@
#define CAN_ACTIVE_TIMEOUT_S 30
/**
+ * @brief Function representing thread activated by can bus objects
+ */
+void can_reader(can_bus_dev_t& can_bus);
+void can_decode_message(can_bus_t& can_bus);
+void can_event_push(can_bus_t& can_bus);
+
+/**
* @brief The type signature for a CAN signal decoder.
*
* @desc A SignalDecoder transforms a raw floating point CAN signal into a number,
@@ -146,11 +165,13 @@ class can_bus_dev_t {
public:
can_bus_dev_t(const std::string& dev_name);
- int open();
+ int open(const struct afb_binding_interface* interface);
int close();
bool is_running();
+ void start_reading();
+ canfd_frame read(const struct afb_binding_interface *interface);
- can_message_t* next_can_message();
+ can_message_t next_can_message();
void push_new_can_message(const can_message_t& can_msg);
bool has_can_message() const;
};