#include "../low-can-binding.hpp"
-/********************************************************************************
-*
-* CanMessage method implementation
-*
-*********************************************************************************/
/**
* @brief Class constructor
*
: 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<uint8_t> 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<uint8_t> data)
+ : maxdlen_{maxdlen},
+ id_{id},
+ length_{length},
+ format_{format},
+ rtr_flag_{rtr_flag},
+ flags_{flags},
+ data_{data}
{}
/**
*
* 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)
{
format = can_message_format_t::EXTENDED;
else
format = can_message_format_t::STANDARD;
-
+
switch(format)
{
case can_message_format_t::STANDARD:
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_;
-}