24 #include <boost/crc.hpp> 36 namespace data_conversion_layer
38 namespace start_request
42 static const uint32_t
OPCODE{ 0x35 };
47 boost::crc_32_type crc;
48 crc.process_bytes(&data.at(0), data.size());
49 return static_cast<uint32_t
>(crc.checksum());
53 const uint32_t& seq_number)
55 std::ostringstream os;
63 const uint32_t host_ip_big_endian = htobe32(msg.
host_ip_);
67 const uint32_t host_ip_big_endian = _byteswap_ulong(msg.
host_ip_);
81 const uint8_t device_enabled{ 0b00001000 };
82 const uint8_t intensity_enabled{
static_cast<uint8_t
>(
84 const uint8_t point_in_safety_enabled{ 0 };
85 const uint8_t active_zone_set_enabled{ 0b00001000 };
86 const uint8_t io_pin_data_enabled{ 0b00001000 };
87 const uint8_t scan_counter_enabled{ 0b00001000 };
88 const uint8_t speed_encoder_enabled{ 0 };
89 const uint8_t diagnostics_enabled{
static_cast<uint8_t
>(
107 if ((end -
start) % resolution == 0)
116 "Serializing start request with angle_start={} angle_end={} resolution={} tenths of degree.",
121 for (
const auto& subscriber :
129 const std::string raw_data_as_str{ os.str() };
132 std::ostringstream os_crc;
135 std::string raw_data_with_crc_str(os_crc.str() + os.str());
138 assert(raw_data_with_crc.size() == 58 &&
"Message data of start request has not the size expceted by protocol");
140 return raw_data_with_crc;
static constexpr uint64_t RESERVED
const uint16_t host_udp_port_data_
constexpr bool diagnosticsEnabled() const
constexpr int16_t value() const
static const uint32_t OPCODE
const LaserScanSettings master_
const uint32_t host_ip_
network byte order = big endian
const util::TenthOfDegree & end() const
void write(std::ostringstream &os, const T &data)
RawData serialize(const Message &reply)
#define PSENSCAN_DEBUG(name,...)
std::vector< char > RawData
constexpr bool intensitiesEnabled() const
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
const DeviceSettings master_device_settings_
uint32_t calculateCRC(const data_conversion_layer::RawData &data)
const util::TenthOfDegree & start() const
constexpr const ScanRange & scanRange() const
Higher level data type representing a scanner start request.
const std::array< LaserScanSettings, NUM_SUBSCRIBERS > subscribers_
constexpr util::TenthOfDegree resolution() const