standalone
src
data_conversion_layer
stop_request_serialization.cpp
Go to the documentation of this file.
1
// Copyright (c) 2020-2021 Pilz GmbH & Co. KG
2
//
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU Lesser General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU Lesser General Public License for more details.
12
//
13
// You should have received a copy of the GNU Lesser General Public License
14
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16
#include "
psen_scan_v2_standalone/data_conversion_layer/stop_request_serialization.h
"
17
18
#include <iostream>
19
20
#include <boost/crc.hpp>
21
22
#include "
psen_scan_v2_standalone/data_conversion_layer/raw_processing.h
"
23
24
namespace
psen_scan_v2_standalone
25
{
26
namespace
data_conversion_layer
27
{
28
RawData
data_conversion_layer::stop_request::serialize
()
29
{
30
std::ostringstream os;
31
32
boost::crc_32_type crc;
33
crc.process_bytes(&
stop_request::RESERVED
,
sizeof
(
data_conversion_layer::stop_request::RESERVED
));
34
crc.process_bytes(&
stop_request::OPCODE
,
sizeof
(
data_conversion_layer::stop_request::OPCODE
));
35
36
raw_processing::write
(os,
static_cast<
uint32_t
>
(crc.checksum()));
37
raw_processing::write
(os,
data_conversion_layer::stop_request::RESERVED
);
38
raw_processing::write
(os,
data_conversion_layer::stop_request::OPCODE
);
39
40
return
raw_processing::toArray<RawData>(os);
41
}
42
}
// namespace data_conversion_layer
43
}
// namespace psen_scan_v2_standalone
psen_scan_v2_standalone::data_conversion_layer::stop_request::serialize
RawData serialize()
Definition:
stop_request_serialization.cpp:28
psen_scan_v2_standalone::data_conversion_layer::raw_processing::write
void write(std::ostringstream &os, const T &data)
Definition:
raw_processing.h:47
psen_scan_v2_standalone::data_conversion_layer::stop_request::OPCODE
static const uint32_t OPCODE
Definition:
stop_request_serialization.h:34
raw_processing.h
psen_scan_v2_standalone::data_conversion_layer::stop_request::RESERVED
static constexpr std::array< uint8_t, NUM_RESERVED_FIELDS > RESERVED
Definition:
stop_request_serialization.h:33
stop_request_serialization.h
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition:
udp_client.h:41
psen_scan_v2_standalone::data_conversion_layer::RawData
std::vector< char > RawData
Definition:
raw_scanner_data.h:25
psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:12