diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-01 15:58:42 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-01 15:58:42 +0100 |
commit | 834d1a950d38a821284955f2732cdbb5b05ebd2a (patch) | |
tree | 8ec03f8510c004e6bcc34a83f9f7bfaba96d5054 /src/can-message.hpp | |
parent | 9aa1904f4b0cac0f3cb6ade68cd76954607aa5fe (diff) |
Change data_ member of can_message_t object
to a vector of uint8_t instead of an array
This is more flexible to allocate dynamically
the vector depending if we process classic CAN
frame or CAN FD frame which are 64bytes long.
Change-Id: I698002139d612e3aaaa33f0f5a895e16ff655f5d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-message.hpp')
-rw-r--r-- | src/can-message.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/can-message.hpp b/src/can-message.hpp index f24c1700..82e2e019 100644 --- a/src/can-message.hpp +++ b/src/can-message.hpp @@ -17,6 +17,7 @@ #pragma once +#include <vector> #include <string> #include <cstdint> #include <linux/can.h> @@ -61,7 +62,7 @@ class can_message_t { uint8_t length_; /*!< uint8_t length - the length of the data array (max 8). */ uint8_t flags_; /*!< unint8_t flags of a CAN FD frame. Needed if we catch FD frames.*/ CanMessageFormat format_; /*!< CanMessageFormat format - the format of the message's ID.*/ - uint8_t data_[CAN_MESSAGE_SIZE]; /*!< uint8_t data - The message's data field with a size of 8 which is the standard about CAN bus messages.*/ + std::vector<uint8_t> data_; /*!< uint8_t data - The message's data field with a size of 8 which is the standard about CAN bus messages.*/ uint8_t maxdlen_; @@ -104,7 +105,8 @@ class can_message_t { /** * @brief Retrieve data_ member value. * - * @return uint8_t data_ pointer class member + * @return uint8_t data_ pointer to the first element + * of class member data_ */ const uint8_t* get_data() const; |