X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fcan%2Fmessage%2Fcan-message.hpp;h=8bc9aabef25213f66851a0e22b639798f186e13c;hb=5912e67b3fe1366089102d1860c9f8ae01f8aec4;hp=df0d2a19a2056f7ca305b64c0dc6bea8b174a107;hpb=2f60d294b3fa4e243fa67a738f9b82a0b428a7fc;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/can/message/can-message.hpp b/low-can-binding/can/message/can-message.hpp index df0d2a19..8bc9aabe 100644 --- a/low-can-binding/can/message/can-message.hpp +++ b/low-can-binding/can/message/can-message.hpp @@ -18,7 +18,14 @@ #pragma once #include "./message.hpp" - +struct bcm_msg +{ + struct bcm_msg_head msg_head; + union { + struct canfd_frame fd_frames[MAX_BCM_CAN_FRAMES]; + struct can_frame frames[MAX_BCM_CAN_FRAMES]; + }; +}; /// @class can_message_t /// @@ -26,24 +33,28 @@ /// buffers. It is a wrapper of a can_frame struct with some sugar around it for binding purposes. class can_message_t : public message_t { private: - uint8_t maxdlen_; ///< maxdlen_ - Max data length deduce from number of bytes read from the socket.*/ 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*/ - uint8_t flags_; ///< flags_ - flags of a CAN FD frame. Needed if we catch FD frames.*/ struct bcm_msg bcm_msg_; public: can_message_t(); - can_message_t(uint8_t maxdlen, uint32_t id, uint8_t length, message_format_t format, bool rtr_flag_, uint8_t flags, std::vector& data, uint64_t timestamp); + can_message_t( uint32_t maxdlen, + uint32_t id, + uint32_t length, + bool rtr_flag_, + uint32_t flags, + std::vector& data, + uint64_t timestamp); uint32_t get_id() const; + void set_id(const canid_t id); static std::shared_ptr convert_from_frame(const canfd_frame& frame, size_t nbytes, uint64_t timestamp); - bool is_correct_to_send(); - bool is_set(); - struct bcm_msg get_bcm_msg(); + struct canfd_frame convert_to_canfd_frame(); + struct std::vector convert_to_canfd_frame_vector(); + struct bcm_msg& get_bcm_msg(); void set_bcm_msg(struct bcm_msg bcm_msg); std::string get_debug_message(); - };