X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fcan%2Fcan-message.cpp;h=6b40d912435e764ff30130770c476a107f26bd80;hb=53cd923a034162273fea2f4fb045b28686f51df5;hp=604d67640578312b08b3efdedf9470a4476823a0;hpb=f1afeaf50836bf66153cb6cccbfbfdc1e2a5493b;p=apps%2Flow-level-can-service.git diff --git a/src/can/can-message.cpp b/src/can/can-message.cpp index 604d676..6b40d91 100644 --- a/src/can/can-message.cpp +++ b/src/can/can-message.cpp @@ -15,17 +15,12 @@ * limitations under the License. */ -#include "can/can-message.hpp" +#include "can-message.hpp" #include -#include "low-can-binding.hpp" +#include "../low-can-binding.hpp" -/******************************************************************************** -* -* CanMessage method implementation -* -*********************************************************************************/ /** * @brief Class constructor * @@ -35,8 +30,8 @@ can_message_t::can_message_t() : maxdlen_{0}, id_{0}, length_{0}, format_{can_message_format_t::ERROR}, rtr_flag_{false}, flags_{0} {} -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 data) - : maxdlen_{0}, id_{0}, length_{0}, format_{can_message_format_t::ERROR}, rtr_flag_{false}, flags_{0}, data_{data} +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 data) + : maxdlen_{maxdlen}, id_{id}, length_{length}, format_{format}, rtr_flag_{rtr_flag}, flags_{flags}, data_{data} {} /** @@ -141,7 +136,10 @@ void can_message_t::set_format(const can_message_format_t new_format) * * This is the preferred way to initialize class members. * -* @param[in] args - struct read from can bus device. +* @param[in] frame - canfd_frame to convert coming from a read of CAN socket +* @param[in] nbyte - bytes read from socket read operation. +* +* @return A can_message_t object fully initialized with canfd_frame values. */ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame& frame, size_t nbytes) { @@ -172,7 +170,7 @@ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame& format = can_message_format_t::EXTENDED; else format = can_message_format_t::STANDARD; - + switch(format) { case can_message_format_t::STANDARD: @@ -201,7 +199,7 @@ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame& else { length = (frame.len > maxdlen) ? maxdlen : frame.len; - } + } } } else @@ -252,18 +250,3 @@ canfd_frame can_message_t::convert_to_canfd_frame() return frame; } - -/******************************************************************************** -* -* can_message_definition_t method implementation -* -*********************************************************************************/ - -can_message_definition_t::can_message_definition_t(can_bus_dev_t& cbd) - : bus_{cbd}, last_value_(CAN_MESSAGE_SIZE) -{} - -uint32_t can_message_definition_t::get_id() const -{ - return id_; -}