diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2019-11-26 16:18:36 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2019-11-28 16:11:46 +0100 |
commit | 68d8bc019fab3e73654a330baf6b8dd7c11859ca (patch) | |
tree | e2a01ddfb0d640e1237ccae06e7be5e922cb237b /low-can-binding/can/message/can-message.hpp | |
parent | 006598ee46a227f52bcac7be172cd45a8a364aff (diff) |
Add feature to build messages and fix some functions
Allows to build a message (J1939,BCM) with a signal and a value.
Bug-AGL: SPEC-2386
Bug-AGL: SPEC-2976
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
Change-Id: Iadca13a927ff83f713f39da441c88356695a1285
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can/message/can-message.hpp')
-rw-r--r-- | low-can-binding/can/message/can-message.hpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/low-can-binding/can/message/can-message.hpp b/low-can-binding/can/message/can-message.hpp index df0d2a19..7625cc17 100644 --- a/low-can-binding/can/message/can-message.hpp +++ b/low-can-binding/can/message/can-message.hpp @@ -26,24 +26,26 @@ /// 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.*/ + uint32_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<uint8_t>& data, uint64_t timestamp); + can_message_t(uint32_t maxdlen, uint32_t id, uint32_t length, message_format_t format, bool rtr_flag_, uint32_t flags, std::vector<uint8_t>& data, uint64_t timestamp); uint32_t get_id() const; static std::shared_ptr<can_message_t> convert_from_frame(const canfd_frame& frame, size_t nbytes, uint64_t timestamp); + struct canfd_frame convert_to_canfd_frame(); + struct can_frame convert_to_can_frame(); + bool is_correct_to_send(); bool is_set(); struct bcm_msg get_bcm_msg(); void set_bcm_msg(struct bcm_msg bcm_msg); std::string get_debug_message(); - + uint32_t get_flags(); }; |