X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Fcan%2Fcan-signals.hpp;h=a56fc8cd03bdb1d6069f472d2f75924472b9874c;hb=5206b26e1a6811d142ffbaf12daaea0731345490;hp=50eb4ec506eacf8ad83d12d60b3a9632851b0cf7;hpb=d170c9faeae2cf29c19f3523714ecdf58be73bed;p=apps%2Fagl-service-can-low-level.git diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp index 50eb4ec5..a56fc8cd 100644 --- a/CAN-binder/low-can-binding/can/can-signals.hpp +++ b/CAN-binder/low-can-binding/can/can-signals.hpp @@ -19,26 +19,20 @@ #include #include -#include #include #include +#include #include "openxc.pb.h" +#include "can-message-definition.hpp" #include "../utils/timer.hpp" +#include "../utils/socketcan-bcm.hpp" #include "can-message.hpp" -#include "can-message-definition.hpp" #include "../diagnostic/diagnostic-message.hpp" -extern "C" -{ - #include - #include -} - #define MESSAGE_SET_ID 0 class can_signal_t; - /// /// @brief The type signature for a CAN signal decoder. /// @@ -56,7 +50,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. @@ -75,15 +69,14 @@ 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*/ 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,8 +104,6 @@ private: public: 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, @@ -129,10 +120,10 @@ public: SignalEncoder encoder, bool received); - const can_message_definition_t& get_message() const; - const std::string& get_generic_name() 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; + const std::string get_prefix() const; uint8_t get_bit_position() const; uint8_t get_bit_size() const; float get_factor() const; @@ -150,8 +141,11 @@ public: SignalEncoder& get_encoder(); bool get_received() const; float get_last_value() const; + std::pair get_last_value_with_timestamp() 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); -}; \ No newline at end of file + void set_timestamp(uint64_t timestamp); +};