aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can/can-message.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-19 12:15:07 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-19 16:19:08 +0200
commite4a50a3e96aa39346ad7212cae984524276973dd (patch)
tree8a8ba1e7c4db73c5c94d025e0364e1fef87c04c6 /CAN-binder/low-can-binding/can/can-message.hpp
parent7bde3f53dbbbf688506a32e89c27c8aa69a86a3f (diff)
Added timestamp to received CAN messages
and store into frequency_clock_t. Change-Id: If209070298bd9df49297fdcbed554770e1bc0e4a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-message.hpp')
-rw-r--r--CAN-binder/low-can-binding/can/can-message.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/CAN-binder/low-can-binding/can/can-message.hpp b/CAN-binder/low-can-binding/can/can-message.hpp
index 3fde5f1a..910b3e9f 100644
--- a/CAN-binder/low-can-binding/can/can-message.hpp
+++ b/CAN-binder/low-can-binding/can/can-message.hpp
@@ -51,10 +51,11 @@ private:
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.*/
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*/
public:
can_message_t();
- can_message_t(uint8_t maxdlen, uint32_t id, uint8_t length, can_message_format_t format, bool rtr_flag_, uint8_t flags, std::vector<uint8_t> data);
+ can_message_t(uint8_t maxdlen, uint32_t id, uint8_t length, can_message_format_t format, bool rtr_flag_, uint8_t flags, std::vector<uint8_t> data, uint64_t timestamp);
uint32_t get_id() const;
bool get_rtr_flag_() const;
@@ -63,13 +64,15 @@ public:
const uint8_t* get_data() const;
const std::vector<uint8_t> get_data_vector() const;
uint8_t get_length() const;
+ uint64_t get_timestamp() const;
+ void set_timestamp(uint64_t timestamp);
void set_format(const can_message_format_t new_format);
bool is_correct_to_send();
- static can_message_t convert_from_frame(const canfd_frame& frame, size_t nbytes);
- static can_message_t convert_from_frame(const can_frame& frame, size_t nbytes);
+ static can_message_t convert_from_frame(const canfd_frame& frame, size_t nbytes, uint64_t timestamp);
+ static can_message_t convert_from_frame(const can_frame& frame, size_t nbytes, uint64_t timestamp);
struct canfd_frame convert_to_canfd_frame();
struct can_frame convert_to_can_frame();