This commit moves attributes flags and maxdlen from
class can_message_t to class message_t.
Bug-AGL : SPEC-2779
Change-Id: I56f9cd54d8b9822636311c603501326b36692cf4
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
can_message_t::can_message_t()
: message_t(),
id_{0},
can_message_t::can_message_t()
: message_t(),
id_{0},
- rtr_flag_{false},
- flags_{0}
{}
can_message_t::can_message_t(uint32_t maxdlen,
{}
can_message_t::can_message_t(uint32_t maxdlen,
uint32_t flags,
std::vector<uint8_t>& data,
uint64_t timestamp)
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),
- rtr_flag_{rtr_flag},
- flags_{flags}
-
-uint32_t can_message_t::get_flags()
-{
- return flags_;
-}
\ No newline at end of file
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*/
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:
struct bcm_msg bcm_msg_;
public:
void set_bcm_msg(struct bcm_msg bcm_msg);
std::string get_debug_message();
void set_bcm_msg(struct bcm_msg bcm_msg);
std::string get_debug_message();
/**
* @brief Construct a new j1939 message t::j1939 message t object
*
/**
* @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
* @param length The length of the message
* @param format The format of the message
* @param data The vector data of the message
* @param pgn The PGN of the message
* @param addr The address of the message
*/
* @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_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}
name_{name},
pgn_{pgn},
addr_{addr}
length_{0},
format_{message_format_t::INVALID},
timestamp_{0},
length_{0},
format_{message_format_t::INVALID},
timestamp_{0},
+ sub_id_{-1},
+ flags_{0}
uint32_t length,
message_format_t format,
std::vector<uint8_t>& data,
uint32_t length,
message_format_t format,
std::vector<uint8_t>& data,
+ uint64_t timestamp,
+ uint32_t flags)
: maxdlen_{maxdlen},
length_{length},
format_{format},
data_{data},
timestamp_{timestamp},
: maxdlen_{maxdlen},
length_{length},
format_{format},
data_{data},
timestamp_{timestamp},
+ sub_id_{-1},
+ flags_{flags}
+
+
+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
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. */
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.*/
- 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;
virtual ~message_t() = default;
int get_sub_id() const;
virtual bool is_set() = 0;
virtual std::string get_debug_message() = 0;
virtual uint32_t get_id() const = 0;
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);
+