From d9237e07858fb243eb35f78ded3664aec69f524d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 17 Feb 2017 17:03:53 +0000 Subject: Separated can_bus and can_bus_dev object. Now there are as many thread reading as can bus device Change-Id: I65928b39714f3a0e76e588de3db10d091ad5093d Signed-off-by: Romain Forlot --- src/can-utils.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/can-utils.hpp') diff --git a/src/can-utils.hpp b/src/can-utils.hpp index da5f81ca..8b64cb3b 100644 --- a/src/can-utils.hpp +++ b/src/can-utils.hpp @@ -18,7 +18,7 @@ #pragma once #include -#include "timer.h" +#include "timer.hpp" #include "openxc.pb.h" // TODO actual max is 32 but dropped to 24 for memory considerations @@ -73,8 +73,6 @@ typedef uint64_t (*SignalEncoder)(struct CanSignal* signal, class can_bus_dev_t { private: std::string device_name_; - int can_socket_; - int can_socket_; bool is_fdmode_on_; struct sockaddr_can txAddress_; @@ -92,6 +90,7 @@ 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; } @@ -105,9 +104,7 @@ class can_bus_dev_t { class can_bus_t { private: afb_binding_interface *interface_; - - std::vector devices; - + std::thread th_decoding_; std::thread th_pushing_; @@ -116,11 +113,15 @@ class can_bus_t { public: void start_threads(); + + void init_can_dev(std::ifstream& conf_file); + std::vector read_conf() int send_can_message(can_message_t can_msg); openxc_VehicleMessage& next_vehicle_message(); void push_new_vehicle_message(const openxc_VehicleMessage& v_msg); + bool has_vehicle_message() const; }; /* A compact representation of a single CAN message, meant to be used in in/out -- cgit 1.2.3-korg