23 #include <boost/crc.hpp>
35 namespace data_conversion_layer
37 namespace start_request
41 static const uint32_t
OPCODE{ 0x35 };
46 boost::crc_32_type crc;
47 crc.process_bytes(&data.at(0), data.size());
48 return static_cast<uint32_t
>(crc.checksum());
53 uint8_t base{ 0b00001000 };
54 for (
int i = 0; i < nr_ubscribers; i++)
56 base = base | (base >> 1);
62 const uint32_t& seq_number)
64 std::ostringstream os;
72 const uint32_t host_ip_big_endian = htobe32(msg.
host_ip_);
76 const uint32_t host_ip_big_endian = _byteswap_ulong(msg.
host_ip_);
93 const uint8_t intensity_enabled{
static_cast<uint8_t
>(
95 const uint8_t point_in_safety_enabled{ 0 };
96 const uint8_t active_zone_set_enabled{
getEnableByte(nr_ubscribers) };
97 const uint8_t io_pin_data_enabled{ 0b00001000 };
98 const uint8_t scan_counter_enabled{
getEnableByte(nr_ubscribers) };
99 const uint8_t speed_encoder_enabled{ 0 };
100 const uint8_t diagnostics_enabled{
static_cast<uint8_t
>(
118 if ((end -
start) % resolution == 0)
127 "Serializing start request with angle_start={} angle_end={} resolution={} tenths of degree.",
132 for (
int i = 0; i < nr_ubscribers; i++)
139 const std::string raw_data_as_str{ os.str() };
142 std::ostringstream os_crc;
145 std::string raw_data_with_crc_str(os_crc.str() + os.str());
148 assert(raw_data_with_crc.size() == 58 &&
"Message data of start request has not the size expceted by protocol");
150 return raw_data_with_crc;