diff options
Diffstat (limited to 'low-can-binding/can/message')
-rw-r--r-- | low-can-binding/can/message/can-message.cpp | 13 | ||||
-rw-r--r-- | low-can-binding/can/message/can-message.hpp | 3 | ||||
-rw-r--r-- | low-can-binding/can/message/j1939-message.cpp | 6 | ||||
-rw-r--r-- | low-can-binding/can/message/message.cpp | 31 | ||||
-rw-r--r-- | low-can-binding/can/message/message.hpp | 10 |
5 files changed, 41 insertions, 22 deletions
diff --git a/low-can-binding/can/message/can-message.cpp b/low-can-binding/can/message/can-message.cpp index deca5c72..9bc8787f 100644 --- a/low-can-binding/can/message/can-message.cpp +++ b/low-can-binding/can/message/can-message.cpp @@ -29,8 +29,7 @@ can_message_t::can_message_t() : message_t(), id_{0}, - rtr_flag_{false}, - flags_{0} + rtr_flag_{false} {} can_message_t::can_message_t(uint32_t maxdlen, @@ -41,10 +40,9 @@ can_message_t::can_message_t(uint32_t maxdlen, uint32_t flags, std::vector<uint8_t>& data, uint64_t timestamp) - : message_t(maxdlen, length, format, data, timestamp), + : message_t(maxdlen, length, format, data, timestamp, flags), id_{id}, - rtr_flag_{rtr_flag}, - flags_{flags} + rtr_flag_{rtr_flag} {} /// @@ -293,8 +291,3 @@ void can_message_t::set_bcm_msg(struct bcm_msg bcm_msg) { bcm_msg_ = bcm_msg; } - -uint32_t can_message_t::get_flags() -{ - return flags_; -}
\ No newline at end of file diff --git a/low-can-binding/can/message/can-message.hpp b/low-can-binding/can/message/can-message.hpp index 9e75887f..76515d80 100644 --- a/low-can-binding/can/message/can-message.hpp +++ b/low-can-binding/can/message/can-message.hpp @@ -35,7 +35,6 @@ class can_message_t : public message_t { private: uint32_t id_; ///< id_ - The ID of the message. */ bool rtr_flag_; ///< rtr_flag_ - Telling if the frame has RTR flag positionned. Then frame hasn't data field*/ - uint32_t flags_; ///< flags_ - flags of a CAN FD frame. Needed if we catch FD frames.*/ struct bcm_msg bcm_msg_; public: @@ -55,5 +54,5 @@ class can_message_t : public message_t { void set_bcm_msg(struct bcm_msg bcm_msg); std::string get_debug_message(); - uint32_t get_flags(); + }; diff --git a/low-can-binding/can/message/j1939-message.cpp b/low-can-binding/can/message/j1939-message.cpp index 7dc388b3..2d600a1e 100644 --- a/low-can-binding/can/message/j1939-message.cpp +++ b/low-can-binding/can/message/j1939-message.cpp @@ -36,7 +36,6 @@ j1939_message_t::j1939_message_t(): /** * @brief Construct a new j1939 message t::j1939 message t object * - * @param maxdlen The max length of the message * @param length The length of the message * @param format The format of the message * @param data The vector data of the message @@ -45,15 +44,14 @@ j1939_message_t::j1939_message_t(): * @param pgn The PGN of the message * @param addr The address of the message */ -j1939_message_t::j1939_message_t(uint32_t maxdlen, - uint32_t length, +j1939_message_t::j1939_message_t(uint32_t length, message_format_t format, std::vector<uint8_t>& data, uint64_t timestamp, name_t name, pgn_t pgn, uint8_t addr): - message_t(maxdlen,length, format, data, timestamp), + message_t(J1939_MAX_DLEN,length, format, data, timestamp, 0), name_{name}, pgn_{pgn}, addr_{addr} diff --git a/low-can-binding/can/message/message.cpp b/low-can-binding/can/message/message.cpp index b0a33f78..497304de 100644 --- a/low-can-binding/can/message/message.cpp +++ b/low-can-binding/can/message/message.cpp @@ -30,7 +30,8 @@ message_t::message_t() length_{0}, format_{message_format_t::INVALID}, timestamp_{0}, - sub_id_{-1} + sub_id_{-1}, + flags_{0} {} /** @@ -46,13 +47,15 @@ message_t::message_t(uint32_t maxdlen, uint32_t length, message_format_t format, std::vector<uint8_t>& data, - uint64_t timestamp) + uint64_t timestamp, + uint32_t flags) : maxdlen_{maxdlen}, length_{length}, format_{format}, data_{data}, timestamp_{timestamp}, - sub_id_{-1} + sub_id_{-1}, + flags_{flags} {} /** @@ -169,3 +172,25 @@ message_format_t message_t::get_msg_format() { return format_; } + + +uint32_t message_t::get_flags() +{ + return flags_; +} + +void message_t::set_flags(uint32_t flags) +{ + flags_ = flags_ | flags; +} + +uint32_t message_t::get_maxdlen() +{ + return maxdlen_; +} + + +void message_t::set_maxdlen(uint32_t maxdlen) +{ + maxdlen_ = maxdlen; +}
\ No newline at end of file diff --git a/low-can-binding/can/message/message.hpp b/low-can-binding/can/message/message.hpp index f0e1bf0b..2182fe5b 100644 --- a/low-can-binding/can/message/message.hpp +++ b/low-can-binding/can/message/message.hpp @@ -55,12 +55,11 @@ protected: std::vector<uint8_t> data_; ///< data_ - The message's data field with a size of 8 which is the standard about CAN bus messages.*/ uint64_t timestamp_; ///< timestamp_ - timestamp of the received message*/ int sub_id_; ///< sub_id_ - Subscription index. */ - - + uint32_t flags_; ///< flags_ - flags of a CAN FD frame. Needed if we catch FD frames.*/ public: message_t(); - message_t(uint32_t maxdlen, uint32_t length, message_format_t format, std::vector<uint8_t>& data, uint64_t timestamp); + message_t(uint32_t maxdlen, uint32_t length, message_format_t format, std::vector<uint8_t>& data, uint64_t timestamp, uint32_t flags); virtual ~message_t() = default; int get_sub_id() const; @@ -77,5 +76,10 @@ public: virtual bool is_set() = 0; virtual std::string get_debug_message() = 0; virtual uint32_t get_id() const = 0; + uint32_t get_flags(); + void set_flags(uint32_t flags); + uint32_t get_maxdlen(); + void set_maxdlen(uint32_t maxdlen); + }; |