ParseConfigMetadata.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 
24 // -- END LICENSE BLOCK ------------------------------------------------
25 
26 //----------------------------------------------------------------------
33 //----------------------------------------------------------------------
34 
36 
38 
39 namespace sick {
40 namespace data_processing {
41 
43 
44 
46  const datastructure::PacketBuffer& buffer,
47  sick::datastructure::ConfigMetadata& config_metadata) const
48 {
49  // Keep our own copy of the shared_ptr to keep the iterators valid
50  const std::shared_ptr<std::vector<uint8_t> const> vec_ptr = buffer.getBuffer();
51  std::vector<uint8_t>::const_iterator data_ptr = vec_ptr->begin();
52  config_metadata.setVersionCVersion(readVersionIndicator(data_ptr));
53  config_metadata.setVersionMajorVersionNumber(readMajorNumber(data_ptr));
54  config_metadata.setVersionMinorVersionNumber(readMinorNumber(data_ptr));
55  config_metadata.setVersionReleaseNumber(readReleaseNumber(data_ptr));
56  config_metadata.setModificationTimeDate(readModificationTimeDate(data_ptr));
57  config_metadata.setModificationTimeTime(readModificationTimeTime(data_ptr));
58  config_metadata.setTransferTimeDate(readTransferTimeDate(data_ptr));
59  config_metadata.setTransferTimeTime(readTransferTimeTime(data_ptr));
60  config_metadata.setAppChecksum(readAppChecksum(data_ptr));
61  config_metadata.setOverallChecksum(readOverallChecksum(data_ptr));
62  config_metadata.setIntegrityHash(readIntegrityHash(data_ptr));
63  return true;
64 }
65 
66 std::string
67 ParseConfigMetadata::readVersionIndicator(std::vector<uint8_t>::const_iterator data_ptr) const
68 {
69  std::string result;
70  result.push_back(read_write_helper::readUint8(data_ptr + 0));
71  return result;
72 }
73 
74 uint8_t ParseConfigMetadata::readMajorNumber(std::vector<uint8_t>::const_iterator data_ptr) const
75 {
76  return read_write_helper::readUint8(data_ptr + 1);
77 }
78 
79 uint8_t ParseConfigMetadata::readMinorNumber(std::vector<uint8_t>::const_iterator data_ptr) const
80 {
81  return read_write_helper::readUint8(data_ptr + 2);
82 }
83 
84 uint8_t ParseConfigMetadata::readReleaseNumber(std::vector<uint8_t>::const_iterator data_ptr) const
85 {
86  return read_write_helper::readUint8(data_ptr + 3);
87 }
88 
89 uint16_t
90 ParseConfigMetadata::readModificationTimeDate(std::vector<uint8_t>::const_iterator data_ptr) const
91 {
92  return read_write_helper::readUint16LittleEndian(data_ptr + 4);
93 }
94 
95 uint32_t
96 ParseConfigMetadata::readModificationTimeTime(std::vector<uint8_t>::const_iterator data_ptr) const
97 {
98  return read_write_helper::readUint32LittleEndian(data_ptr + 8);
99 }
100 
101 uint16_t
102 ParseConfigMetadata::readTransferTimeDate(std::vector<uint8_t>::const_iterator data_ptr) const
103 {
104  return read_write_helper::readUint16LittleEndian(data_ptr + 12);
105 }
106 
107 uint32_t
108 ParseConfigMetadata::readTransferTimeTime(std::vector<uint8_t>::const_iterator data_ptr) const
109 {
110  return read_write_helper::readUint32LittleEndian(data_ptr + 16);
111 }
112 
113 uint32_t ParseConfigMetadata::readAppChecksum(std::vector<uint8_t>::const_iterator data_ptr) const
114 {
115  return read_write_helper::readUint32LittleEndian(data_ptr + 36);
116 }
117 
118 uint32_t
119 ParseConfigMetadata::readOverallChecksum(std::vector<uint8_t>::const_iterator data_ptr) const
120 {
121  return read_write_helper::readUint32LittleEndian(data_ptr + 52);
122 }
123 
124 std::vector<uint32_t>
125 ParseConfigMetadata::readIntegrityHash(std::vector<uint8_t>::const_iterator data_ptr) const
126 {
127  std::vector<uint32_t> result;
128  for (uint8_t i = 0; i < 4; i++)
129  {
130  result.push_back(read_write_helper::readUint32LittleEndian(data_ptr + 68 + (i * 4)));
131  }
132  return result;
133 }
134 
135 } // namespace data_processing
136 } // namespace sick
void setVersionCVersion(const std::string &version_c_version)
Sets the version indicator for the scanner.
Class containing the serial number of a laser scanner.
uint32_t readModificationTimeTime(std::vector< uint8_t >::const_iterator data_ptr) const
uint16_t readTransferTimeDate(std::vector< uint8_t >::const_iterator data_ptr) const
A packetbuffer for the raw data from the sensor.
Definition: PacketBuffer.h:61
std::shared_ptr< std::vector< uint8_t > const > getBuffer() const
Getter to return a copy of the data saved in the PacketBuffer.
void setModificationTimeTime(const uint32_t &modification_time_time)
Sets the modification time time for the scanner.
void setModificationTimeDate(const uint16_t &modification_time_date)
Sets the modification time date for the scanner.
uint32_t readTransferTimeTime(std::vector< uint8_t >::const_iterator data_ptr) const
void setIntegrityHash(const std::vector< uint32_t > &integrity_hash)
Sets the integrity hash for the scanner.
uint32_t readOverallChecksum(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readMinorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
std::vector< uint32_t > readIntegrityHash(std::vector< uint8_t >::const_iterator data_ptr) const
std::string readVersionIndicator(std::vector< uint8_t >::const_iterator data_ptr) const
void setVersionMajorVersionNumber(const uint8_t &version_major_version_number)
Sets the major version number for the scanner.
uint32_t readUint32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
void setTransferTimeTime(const uint32_t &transfer_time_time)
Sets the transfer time time for the scanner.
uint8_t readMajorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
ParseConfigMetadata()
Constructor of the parser.
void setTransferTimeDate(const uint16_t &transfer_time_date)
Sets the transfer time date for the scanner.
uint32_t readAppChecksum(std::vector< uint8_t >::const_iterator data_ptr) const
void setVersionReleaseNumber(const uint8_t &version_release_number)
Sets the version release number for the scanner.
uint8_t readReleaseNumber(std::vector< uint8_t >::const_iterator data_ptr) const
void setAppChecksum(const uint32_t &app_checksum)
Sets the application checksum for the scanner.
uint16_t readModificationTimeDate(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readUint8(std::vector< uint8_t >::const_iterator it)
Read an unsigned 8-bit integer at offset.
void setOverallChecksum(const uint32_t &overall_checksum)
Sets the overall checksum for the scanner.
void setVersionMinorVersionNumber(const uint8_t &version_minor_version_number)
Sets the minor version number for the scanner.
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::ConfigMetadata &config_metadata) const
Parses a tcp sequence to read the type code of the sensor.


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Fri Apr 2 2021 02:45:41