X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Fcan%2Fcan-bus-dev.hpp;h=973c8cfa994f2375cfe3529024b5cc98b92e6bda;hb=3d3fbfd56b476a1f36bfc9cabf5a21f981d06844;hp=8cafaf83550c424e921782e70823c8c22add54a1;hpb=0a27582743cb7b4ad191adea4eefeda01d179896;p=apps%2Fagl-service-can-low-level.git diff --git a/CAN-binder/low-can-binding/can/can-bus-dev.hpp b/CAN-binder/low-can-binding/can/can-bus-dev.hpp index 8cafaf83..973c8cfa 100644 --- a/CAN-binder/low-can-binding/can/can-bus-dev.hpp +++ b/CAN-binder/low-can-binding/can/can-bus-dev.hpp @@ -19,14 +19,14 @@ #pragma once #include -#include #include #include -#include "../utils/socket.hpp" +#include "../utils/socketcan-raw.hpp" class can_bus_t; class can_message_t; +class can_signal_t; /// @brief Object representing a can device. Handle opening, closing and reading on the /// socket. This is the low level object to be initialized and use by can_bus_t. @@ -34,23 +34,23 @@ class can_bus_dev_t { private: std::string device_name_; ///< a string identifier identitfying the linux CAN device. - utils::socketcan_t can_socket_; + utils::socketcan_raw_t can_socket_; ///< can_socket_ - A Raw socket attached to a specified device - int32_t address_; ///< an identifier used through binding that refer to that device - - bool is_fdmode_on_; ///< boolean telling if whether or not the can socket use fdmode. + int index_; ///< index_ - An index number, it's the index number to access this object using the can_devices_ map from can_bus_t class std::thread th_reading_; ///< Thread handling read the socket can device filling can_message_q_ queue of can_bus_t bool is_running_ = false; ///< boolean telling whether or not reading is running or not void can_reader(can_bus_t& can_bus); public: - can_bus_dev_t(const std::string& dev_name, int32_t address); + can_bus_dev_t(const std::string& dev_name, int index); std::string get_device_name() const; - uint32_t get_address() const; + int get_index() const; + utils::socketcan_t& get_socket(); - int open(bool bcm=false); + int open(); + void configure(); int close(); void start_reading(can_bus_t& can_bus);