summaryrefslogtreecommitdiffstats
path: root/src/can-utils.hpp
diff options
context:
space:
mode:
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 20267ae..ee87790 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;
};