summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils/socketcan.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-04-26 15:45:14 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-27 01:03:34 +0200
commitf741d262ecd237121cc8cceb0f0893daa70bdf32 (patch)
treea22d7a36ef1dd5ae3f8b63b8fd9192297f18e7f5 /CAN-binder/low-can-binding/utils/socketcan.hpp
parent72f7ebbc61f36d6140114b3b9e403635cbe8baba (diff)
Make template from similar writing stream operations.
Change-Id: I33b32418980059b701d2af5b165af536f42d0252 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils/socketcan.hpp')
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.hpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan.hpp b/CAN-binder/low-can-binding/utils/socketcan.hpp
index c7cd5c91..673303b4 100644
--- a/CAN-binder/low-can-binding/utils/socketcan.hpp
+++ b/CAN-binder/low-can-binding/utils/socketcan.hpp
@@ -21,18 +21,20 @@
#include <sys/socket.h>
#include <linux/can/bcm.h>
+#include <string.h>
#include "../can/can-message.hpp"
+#include "low-can-binding.hpp"
#define INVALID_SOCKET -1
-
+#define U64_DATA(p) (*(unsigned long long*)(p)->data)
namespace utils
{
template <typename T>
struct basic_bcm_msg
{
- bcm_msg_head msg_head;
+ struct bcm_msg_head msg_head;
std::vector<T> frames;
};
@@ -73,11 +75,8 @@ namespace utils
s << obj;
return s;
}
- socketcan_t& operator<<(socketcan_t& s, const canfd_frame& frame);
- socketcan_t& operator<<(socketcan_t& s, const can_frame& frame);
socketcan_t& operator<<(socketcan_t& s, const struct basic_bcm_msg<can_frame>& obj);
socketcan_t& operator<<(socketcan_t& s, const struct canfd_bcm_msg& obj);
- socketcan_t& operator<<(socketcan_t& s, const struct bcm_msg_head& obj);
socketcan_t& operator>>(socketcan_t& s, const can_message_t& cm);
}