aboutsummaryrefslogtreecommitdiffstats
path: root/src/can-utils.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-21 08:15:58 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-21 11:00:03 +0000
commit913ac4ead2a8140db8607cef8b216ca997b8401e (patch)
tree64e85836f79acac6679e223c4a97cb0eb1a83c85 /src/can-utils.hpp
parentef610b379f59f89350f6f9dd8ff11a00066e2c05 (diff)
Fixed can bus class (almost)
Change-Id: Icb76d26749e0e7b5f122676861ed09ac0c03be30 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-utils.hpp')
-rw-r--r--src/can-utils.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/can-utils.hpp b/src/can-utils.hpp
index d1310a6d..ea116b78 100644
--- a/src/can-utils.hpp
+++ b/src/can-utils.hpp
@@ -29,6 +29,7 @@
#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"
@@ -115,13 +116,15 @@ typedef struct CanMessage CanMessage;
*/
class can_message_t {
private:
- const struct afb_binding_interface *interface_;
+ const struct afb_binding_interface* interface_;
uint32_t id_;
CanMessageFormat format_;
uint8_t data_[CAN_MESSAGE_SIZE];
uint8_t length_;
public:
+ can_message_t(const struct afb_binding_interface* interface);
+
uint32_t get_id() const;
int get_format() const;
uint8_t get_data() const;
@@ -167,6 +170,8 @@ class can_bus_dev_t {
can_message_t next_can_message();
void push_new_can_message(const can_message_t& can_msg);
bool has_can_message() const;
+
+ int send_can_message(can_message_t& can_msg, const struct afb_binding_interface* interface);
};
/**
@@ -193,9 +198,7 @@ class can_bus_t {
void start_threads();
- int send_can_message(can_message_t can_msg);
-
- openxc_VehicleMessage& next_vehicle_message();
+ openxc_VehicleMessage next_vehicle_message();
void push_new_vehicle_message(const openxc_VehicleMessage& v_msg);
bool has_vehicle_message() const;
};