diff options
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus-dev.hpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-signals.cpp | 11 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-signals.hpp | 2 |
3 files changed, 15 insertions, 2 deletions
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 2ddc1ff0..973c8cfa 100644 --- a/CAN-binder/low-can-binding/can/can-bus-dev.hpp +++ b/CAN-binder/low-can-binding/can/can-bus-dev.hpp @@ -34,9 +34,9 @@ class can_bus_dev_t { private: std::string device_name_; ///< a string identifier identitfying the linux CAN device. - utils::socketcan_raw_t can_socket_; + utils::socketcan_raw_t can_socket_; ///< can_socket_ - A Raw socket attached to a specified device - int index_; + 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 diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp index 48c919da..c8098a51 100644 --- a/CAN-binder/low-can-binding/can/can-signals.cpp +++ b/CAN-binder/low-can-binding/can/can-signals.cpp @@ -235,3 +235,14 @@ int can_signal_t::create_rx_filter() return -1; } +can_message_format_t can_signal_t::read_socket() +{ + can_message_t msg; + can_bus_t& cbm = configuration_t::instance().get_can_bus_manager(); + socket_ >> msg; + std::lock_guard<std::mutex> can_message_lock(cbm.get_can_message_mutex()); + { cbm.push_new_can_message(msg); } + cbm.get_new_can_message_cv().notify_one(); + + return msg.get_format(); +}
\ No newline at end of file diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp index f21cab49..8196c7eb 100644 --- a/CAN-binder/low-can-binding/can/can-signals.hpp +++ b/CAN-binder/low-can-binding/can/can-signals.hpp @@ -157,5 +157,7 @@ public: void set_prefix(std::string val); void set_received(bool r); void set_last_value(float val); + int create_rx_filter(); + can_message_format_t read_socket(); };
\ No newline at end of file |