summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder/low-can-binding/utils')
-rw-r--r--CAN-binder/low-can-binding/utils/signals.hpp6
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp3
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.hpp1
-rw-r--r--CAN-binder/low-can-binding/utils/timer.cpp2
4 files changed, 11 insertions, 1 deletions
diff --git a/CAN-binder/low-can-binding/utils/signals.hpp b/CAN-binder/low-can-binding/utils/signals.hpp
index ff91462..555c5dd 100644
--- a/CAN-binder/low-can-binding/utils/signals.hpp
+++ b/CAN-binder/low-can-binding/utils/signals.hpp
@@ -37,11 +37,15 @@ namespace utils
std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages;
};
+ /// @brief Signal manager singleton hold subscription object with attached afb_event and its mutex
+ /// to read and write it safely.
+ /// It can be used to browse CAN signals and Diagnostic messages vectors and find a particular signal to
+ /// subscribe to.
class signals_manager_t
{
private:
std::mutex subscribed_signals_mutex_;
- std::map<int, std::shared_ptr<low_can_subscription_t> > subscribed_signals_;
+ std::map<int, std::shared_ptr<low_can_subscription_t> > subscribed_signals_; ///< Map containing all subscribed signals, key is the socket int value.
signals_manager_t(); ///< Private constructor to make singleton class.
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index 76bc6ac..5ee4b1a 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
@@ -67,6 +67,9 @@ namespace utils
return socket_;
}
+ /// Read the socket to retrieve the associated CAN message. All the hard work is do into
+ /// convert_from_frame method and if there isn't CAN message retrieve, only BCM head struct,
+ /// then CAN message will be zeroed and must be handled later.
socketcan_bcm_t& operator>>(socketcan_bcm_t& s, can_message_t& cm)
{
struct utils::simple_bcm_msg msg;
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
index 2e4547b..97f093d 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
@@ -35,6 +35,7 @@ namespace utils
canfd_bcm_msg() { msg_head.flags |= CAN_FD_FRAME; }
};
+ /// @brief derivated socketcan class specialized for BCM CAN socket.
class socketcan_bcm_t : public socketcan_t
{
public:
diff --git a/CAN-binder/low-can-binding/utils/timer.cpp b/CAN-binder/low-can-binding/utils/timer.cpp
index 70f0856..f3cdd5e 100644
--- a/CAN-binder/low-can-binding/utils/timer.cpp
+++ b/CAN-binder/low-can-binding/utils/timer.cpp
@@ -76,6 +76,8 @@ float frequency_clock_t::frequency_to_period() const
return frequency_ == 0 ? 0 : 1 / frequency_;
}
+/// @brief Return a timeval struct based on the frequency_ member. used to
+/// specified CAN BCM timers.
const struct timeval frequency_clock_t::get_timeval_from_period() const
{
struct timeval freq = {0, 0};