X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Fcan%2Fcan-signals.hpp;h=1277bf3623f30261c42ad7e2a8bd0dbd832684e8;hb=fd3978709abbb3ed46caaf48c1d2f45b2c74fa89;hp=34ebeebdee730795d0918bd5b95570665bce82fd;hpb=49fe0eec8f17698fc5f86d0abe01777af1fb2b23;p=apps%2Flow-level-can-service.git diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp index 34ebeeb..1277bf3 100644 --- a/CAN-binder/low-can-binding/can/can-signals.hpp +++ b/CAN-binder/low-can-binding/can/can-signals.hpp @@ -19,15 +19,14 @@ #include #include -#include #include #include +#include #include "openxc.pb.h" #include "../utils/timer.hpp" -#include "can-bus.hpp" +#include "../utils/socketcan-bcm.hpp" #include "can-message.hpp" -#include "can-message-definition.hpp" #include "../diagnostic/diagnostic-message.hpp" extern "C" @@ -39,7 +38,7 @@ extern "C" #define MESSAGE_SET_ID 0 class can_signal_t; - +class can_message_definition_t; /// /// @brief The type signature for a CAN signal decoder. /// @@ -57,7 +56,7 @@ class can_signal_t; /// @return a decoded value in an openxc_DynamicField struct. /// typedef openxc_DynamicField (*SignalDecoder)(can_signal_t& signal, - const std::vector& signals, float value, bool* send); + const std::vector > signals, float value, bool* send); /// /// @brief: The type signature for a CAN signal encoder. @@ -76,15 +75,15 @@ typedef uint64_t (*SignalEncoder)(can_signal_t* signal, class can_signal_t { private: - std::uint8_t message_set_id_; - std::uint8_t message_id_; + can_message_definition_t* parent_; /*!< parent_ - pointer to the parent message definition holding this signal*/ + utils::socketcan_bcm_t socket_; /*!< socket_ - Specific BCM socket that filter the signal read from CAN device */ std::string generic_name_; /*!< generic_name_ - The name of the signal to be output.*/ static std::string prefix_; /*!< prefix_ - generic_name_ will be prefixed with it. It has to reflect the used protocol. * which make easier to sort message when the come in.*/ uint8_t bit_position_; /*!< bitPosition_ - The starting bit of the signal in its CAN message (assuming * non-inverted bit numbering, i.e. the most significant bit of * each byte is 0) */ - uint8_t bit_size_; /*!< bitSize_ - The width of the bit field in the CAN message. */ + uint8_t bit_size_; /*!< bit_size_ - The width of the bit field in the CAN message. */ float factor_; /*!< factor_ - The final value will be multiplied by this factor. Use 1 if you * don't need a factor. */ float offset_; /*!< offset_ - The final value will be added to this offset. Use 0 if you @@ -111,9 +110,8 @@ private: * this value is undefined. */ public: + //can_signal_t(const can_signal_t& b); can_signal_t( - std::uint8_t message_set_id, - std::uint8_t message_id, std::string generic_name, uint8_t bit_position, uint8_t bit_size, @@ -130,7 +128,8 @@ public: SignalEncoder encoder, bool received); - const can_message_definition_t& get_message() const; + utils::socketcan_bcm_t get_socket() const; + can_message_definition_t* get_message() const; const std::string& get_generic_name() const; const std::string get_name() const; const std::string& get_prefix() const; @@ -152,7 +151,10 @@ public: bool get_received() const; float get_last_value() const; + void set_parent(can_message_definition_t* parent); void set_prefix(std::string val); void set_received(bool r); void set_last_value(float val); + + int create_rx_filter(); }; \ No newline at end of file