summaryrefslogtreecommitdiffstats
path: root/src/can-utils.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-23 17:52:35 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-23 17:52:35 +0000
commit035493b81d5bb6d909de05e9a06a0f61588a35aa (patch)
treed459e901c4b74561eb2740a74e0f1b99d6fe5ddd /src/can-utils.hpp
parentd59970dce571c1753174124326406ec1ff8e2ce8 (diff)
First draft about lock/wait thread management.
Reordering include files Change-Id: Ia6d9ee30eb4e1df0c380c26355679fe00b373aa8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-utils.hpp')
-rw-r--r--src/can-utils.hpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/can-utils.hpp b/src/can-utils.hpp
index 218452d..e4a3d34 100644
--- a/src/can-utils.hpp
+++ b/src/can-utils.hpp
@@ -17,30 +17,14 @@
#pragma once
-#include <map>
#include <queue>
-#include <vector>
-#include <cstdio>
-#include <string>
-#include <fcntl.h>
-#include <unistd.h>
-#include <net/if.h>
#include <thread>
-#include <sys/ioctl.h>
#include <linux/can.h>
-#include <sys/socket.h>
-#include <json-c/json.h>
-#include <linux/can/raw.h>
#include "timer.hpp"
#include "openxc.pb.h"
#include "low-can-binding.hpp"
-extern "C"
-{
- #include <afb/afb-binding.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
@@ -342,12 +326,33 @@ class can_bus_dev_t {
can_bus_dev_t(const std::string& dev_name);
/**
+ * @brief Connect to the application framework event loop and adding
+ * a watch on the socket that will wakeup reading thread that will
+ * read the socket and fill can_bus_t object queue.
+ *
+ * @return 0 if success, anything else if not.
+ */
+ int event_loop_connection();
+
+ /**
* @brief Open the can socket and returning it
*
* @return
*/
int open();
+
+ /**
+ * @brief Open the can socket and returning it
+ *
+ * @return
+ */
int close();
+
+ /**
+ * @brief Telling if the reading thread is running
+ *
+ * @return true if read is running, false if not.
+ */
bool is_running();
/**