Fix: decoded name will be prefixed as at subscription.
[apps/agl-service-can-low-level.git] / src / can / can-message.cpp
index b9a2d1a..5d8c9cb 100644 (file)
  * limitations under the License.
  */
 
-#include "can/can-message.hpp"
+#include "can-message.hpp"
 
 #include <cstring>
 
-#include "low-can-binding.hpp"
+#include "../low-can-binding.hpp"
 
-/********************************************************************************
-*
-*              CanMessage method implementation
-*
-*********************************************************************************/
 /**
 * @brief Class constructor
 *
@@ -35,8 +30,20 @@ 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<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}
 {}
 
 /**
@@ -141,7 +148,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 +182,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:
@@ -252,18 +262,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_;
-}