X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Fcan%2Fcan-message.cpp;h=772734d71953ae134de7ce97c901b4f10290dfe8;hb=e4a50a3e96aa39346ad7212cae984524276973dd;hp=3575348f9d2fbe5b46739655e127088ad93b015e;hpb=d170c9faeae2cf29c19f3523714ecdf58be73bed;p=apps%2Fagl-service-can-low-level.git diff --git a/CAN-binder/low-can-binding/can/can-message.cpp b/CAN-binder/low-can-binding/can/can-message.cpp index 3575348f..772734d7 100644 --- a/CAN-binder/low-can-binding/can/can-message.cpp +++ b/CAN-binder/low-can-binding/can/can-message.cpp @@ -19,7 +19,7 @@ #include -#include "../low-can-binding.hpp" +#include "../binding/low-can-hat.hpp" /// /// @brief Class constructor @@ -27,7 +27,7 @@ /// Constructor about can_message_t class. /// can_message_t::can_message_t() - : maxdlen_{0}, id_{0}, length_{0}, format_{can_message_format_t::ERROR}, rtr_flag_{false}, flags_{0} + : maxdlen_{0}, id_{0}, length_{0}, format_{can_message_format_t::INVALID}, rtr_flag_{false}, flags_{0}, timestamp_{0} {} can_message_t::can_message_t(uint8_t maxdlen, @@ -36,14 +36,16 @@ can_message_t::can_message_t(uint8_t maxdlen, can_message_format_t format, bool rtr_flag, uint8_t flags, - std::vector data) + std::vector data, + uint64_t timestamp) : maxdlen_{maxdlen}, id_{id}, length_{length}, format_{format}, rtr_flag_{rtr_flag}, flags_{flags}, - data_{data} + data_{data}, + timestamp_{timestamp} {} /// @@ -74,7 +76,7 @@ bool can_message_t::get_rtr_flag_() const can_message_format_t can_message_t::get_format() const { if (format_ != can_message_format_t::STANDARD || format_ != can_message_format_t::EXTENDED) - return can_message_format_t::ERROR; + return can_message_format_t::INVALID; return format_; } @@ -99,6 +101,16 @@ const uint8_t* can_message_t::get_data() const return data_.data(); } +/// +/// @brief Retrieve data_ member whole vector +/// +/// @return the vector as is +/// +const std::vector can_message_t::get_data_vector() const +{ + return data_; +} + /// /// @brief Retrieve length_ member value. /// @@ -109,6 +121,16 @@ uint8_t can_message_t::get_length() const return length_; } +uint64_t can_message_t::get_timestamp() const +{ + return timestamp_; +} + +void can_message_t::set_timestamp(uint64_t timestamp) +{ + timestamp_ = timestamp; +} + /// /// @brief Control whether the object is correctly initialized /// to be sent over the CAN bus @@ -117,7 +139,7 @@ uint8_t can_message_t::get_length() const /// bool can_message_t::is_correct_to_send() { - if (id_ != 0 && length_ != 0 && format_ != can_message_format_t::ERROR) + if (id_ != 0 && length_ != 0 && format_ != can_message_format_t::INVALID) { int i; for(i=0;i