+ for(size_t i = new_start_byte; i <= new_end_byte ; i++)
+ data[i] = data[i] | data_signal[i-new_start_byte];
+}
+
+/**
+ * @brief Allows to build a multi frame message with correct data to be send
+ *
+ * @param signal The CAN signal to write, including the bit position and bit size.
+ * @param value The encoded integer value to write in the CAN signal.
+ * @param message A multi frame message to complete
+ * @param factor If true that will use the factor of the signal else 1
+ * @param offset If true that will use the offset of the signal else 0
+ * @return message_t* The message that is generated
+ */
+message_t* encoder_t::build_frame(const std::shared_ptr<signal_t>& signal, uint64_t value, message_t *message, bool factor, bool offset)
+{
+ signal->set_last_value(static_cast<float>(value));
+ std::vector<uint8_t> data(message->get_length(), 0);
+
+ for(const auto& sig: signal->get_message()->get_signals())
+ encode_data(sig, data, false, factor, offset);
+
+ message->set_data(data);
+ return message;
+}
+
+/**
+ * @brief Allows to build a message_t with correct data to be send
+ *
+ * @param signal The CAN signal to write, including the bit position and bit size.
+ * @param value The encoded integer value to write in the CAN signal.
+ * @param factor If true that will use the factor of the signal else 1
+ * @param offset If true that will use the offset of the signal else 0
+ * @return message_t* The message that is generated
+ */
+message_t* encoder_t::build_message(const std::shared_ptr<signal_t>& signal, uint64_t value, bool factor, bool offset)
+{
+ message_t *message;
+ std::vector<uint8_t> data;
+ switch(signal->get_message()->get_flags())
+ {
+ case CAN_PROTOCOL_WITH_FD_FRAME:
+ message = new can_message_t(CANFD_MAX_DLEN,
+ signal->get_message()->get_id(),
+ CANFD_MAX_DLEN,
+ false,
+ signal->get_message()->get_flags(),
+ data,
+ 0);
+ return build_frame(signal, value, message, factor, offset);
+#ifdef USE_FEATURE_J1939
+ case J1939_PROTOCOL:
+ message = new j1939_message_t(signal->get_message()->get_length(),
+ data,
+ 0,
+ J1939_NO_NAME,
+ signal->get_message()->get_id(),
+ J1939_NO_ADDR);
+ return build_frame(signal, value, message, factor, offset);
+#endif
+ case CAN_PROTOCOL:
+ message = new can_message_t(CAN_MAX_DLEN,
+ signal->get_message()->get_id(),
+ CAN_MAX_DLEN,
+ false,
+ signal->get_message()->get_flags(),
+ data,
+ 0);
+ return build_frame(signal, value, message, factor, offset);
+ default:
+ message = new can_message_t(CAN_MAX_DLEN,
+ signal->get_message()->get_id(),
+ CAN_MAX_DLEN,
+ false,
+ signal->get_message()->get_flags(),
+ data,
+ 0);
+ return build_frame(signal, value, message, factor, offset);
+ }
+
+}
+
+
+/**
+ * @brief Allows to build a single frame message with correct data to be send
+ *
+ * @param signal The CAN signal to write, including the bit position and bit size.
+ * @param value The encoded integer value to write in the CAN signal.
+ * @param message A single frame message to complete
+ * @return message_t* The message that is generated
+ */
+message_t* encoder_t::build_one_frame_message(const std::shared_ptr<signal_t>& signal, uint64_t value, message_t *message)
+{