ParseDataHeader.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 
37 namespace sick {
38 namespace data_processing {
39 
41 
44  datastructure::Data& data) const
45 {
46  // Keep our own copy of the shared_ptr to keep the iterators valid
47  const std::shared_ptr<std::vector<uint8_t> const> vec_ptr = buffer.getBuffer();
48  std::vector<uint8_t>::const_iterator data_ptr = vec_ptr->begin();
49  datastructure::DataHeader data_header;
50  setDataInDataHeader(data_ptr, data_header);
51  return data_header;
52 }
53 
54 void ParseDataHeader::setDataInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
55  datastructure::DataHeader& data_header) const
56 {
57  setVersionInDataHeader(data_ptr, data_header);
58  setScanHeaderInDataHeader(data_ptr, data_header);
59  setDataBlocksInDataHeader(data_ptr, data_header);
60 }
61 
62 
63 void ParseDataHeader::setVersionInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
64  datastructure::DataHeader& data_header) const
65 {
66  setVersionIndicatorInDataHeader(data_ptr, data_header);
67  setMajorVersionInDataHeader(data_ptr, data_header);
68  setMinorVersionInDataHeader(data_ptr, data_header);
69  setVersionReleaseInDataHeader(data_ptr, data_header);
70  setSerialNumberOfDeviceInDataHeader(data_ptr, data_header);
71  setSerialNumberOfSystemPlugInDataHeader(data_ptr, data_header);
72 }
73 
74 void ParseDataHeader::setScanHeaderInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
75  datastructure::DataHeader& data_header) const
76 {
77  setChannelNumberInDataHeader(data_ptr, data_header);
78  setSequenceNumberInDataHeader(data_ptr, data_header);
79  setScanNumberInDataHeader(data_ptr, data_header);
80  setTimestampDateInDataHeader(data_ptr, data_header);
81  setTimestampTimeInDataHeader(data_ptr, data_header);
82 }
83 
84 void ParseDataHeader::setDataBlocksInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
85  datastructure::DataHeader& data_header) const
86 {
87  setGeneralSystemStateBlockOffsetInDataHeader(data_ptr, data_header);
88  setGeneralSystemStateBlockSizeInDataHeader(data_ptr, data_header);
89  setDerivedValuesBlockOffsetInDataHeader(data_ptr, data_header);
90  setDerivedValuesBlockSizeInDataHeader(data_ptr, data_header);
91  setMeasurementDataBlockOffsetInDataHeader(data_ptr, data_header);
92  setMeasurementDataBlockSizeInDataHeader(data_ptr, data_header);
93  setIntrusionDataBlockOffsetInDataHeader(data_ptr, data_header);
94  setIntrusionDataBlockSizeInDataHeader(data_ptr, data_header);
95  setApplicationDataBlockOffsetInDataHeader(data_ptr, data_header);
96  setApplicationDataBlockSizeInDataHeader(data_ptr, data_header);
97 }
98 
99 void ParseDataHeader::setVersionIndicatorInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
100  datastructure::DataHeader& data_header) const
101 {
103 }
104 
105 void ParseDataHeader::setMajorVersionInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
106  datastructure::DataHeader& data_header) const
107 {
109 }
110 
111 void ParseDataHeader::setMinorVersionInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
112  datastructure::DataHeader& data_header) const
113 {
115 }
116 
117 void ParseDataHeader::setVersionReleaseInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
118  datastructure::DataHeader& data_header) const
119 {
121 }
122 
124  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
125 {
127 }
128 
130  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
131 {
133 }
134 
135 void ParseDataHeader::setChannelNumberInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
136  datastructure::DataHeader& data_header) const
137 {
139 }
140 
141 void ParseDataHeader::setSequenceNumberInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
142  datastructure::DataHeader& data_header) const
143 {
145 }
146 
147 void ParseDataHeader::setScanNumberInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
148  datastructure::DataHeader& data_header) const
149 {
150  data_header.setScanNumber(read_write_helper::readUint32LittleEndian(data_ptr + 20));
151 }
152 
153 void ParseDataHeader::setTimestampDateInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
154  datastructure::DataHeader& data_header) const
155 {
157 }
158 
159 void ParseDataHeader::setTimestampTimeInDataHeader(std::vector<uint8_t>::const_iterator data_ptr,
160  datastructure::DataHeader& data_header) const
161 {
163 }
164 
166  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
167 {
170 }
171 
173  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
174 {
175  data_header.setGeneralSystemStateBlockSize(
177 }
178 
180  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
181 {
183 }
184 
186  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
187 {
189 }
190 
192  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
193 {
194  data_header.setMeasurementDataBlockOffset(
196 }
197 
199  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
200 {
202 }
203 
205  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
206 {
208 }
209 
211  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
212 {
214 }
215 
217  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
218 {
219  data_header.setApplicationDataBlockOffset(
221 }
222 
224  std::vector<uint8_t>::const_iterator data_ptr, datastructure::DataHeader& data_header) const
225 {
227 }
228 
229 } // namespace data_processing
230 } // namespace sick
ParseDataHeader()
Constructor of the parser.
void setMeasurementDataBlockSizeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setGeneralSystemStateBlockSizeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setTimestampTime(const uint32_t &timestamp_time)
Sets the timestamp time.
Definition: DataHeader.cpp:150
void setMeasurementDataBlockOffset(const uint16_t &measurement_data_block_offset)
Sets the measurement data block offset.
Definition: DataHeader.cpp:200
void setChannelNumber(const uint8_t &channel_number)
Sets the number of channel the measurement data belongs to.
Definition: DataHeader.cpp:110
void setDataInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) 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 setApplicationDataBlockSize(const uint16_t &application_data_block_size)
Sets the application io data block size.
Definition: DataHeader.cpp:250
void setSerialNumberOfDevice(const uint32_t &serial_number_of_device)
Sets the serial number of the device.
Definition: DataHeader.cpp:90
void setDerivedValuesBlockSizeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setSequenceNumberInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setApplicationDataBlockSizeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
datastructure::DataHeader parseUDPSequence(const datastructure::PacketBuffer &buffer, datastructure::Data &data) const
Parses the data header from a udp sequence.
void setChannelNumberInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setMeasurementDataBlockOffsetInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setGeneralSystemStateBlockOffset(const uint16_t &general_system_state_block_offset)
Sets the general system state block offset.
Definition: DataHeader.cpp:160
uint8_t readUint8LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 8-bit integer at offset in big little encoding.
void setIntrusionDataBlockSize(const uint16_t &intrusion_data_block_size)
Sets the intrusion data block size.
Definition: DataHeader.cpp:230
The data class containing all data blocks of a measurement.
Definition: Data.h:55
void setIntrusionDataBlockOffsetInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setSequenceNumber(const uint32_t &sequence_number)
Sets the sequence number of the measurement data.
Definition: DataHeader.cpp:120
uint32_t readUint32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
void setMajorVersionInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setVersionInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setTimestampDateInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setSerialNumberOfDeviceInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setScanNumberInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setDerivedValuesBlockOffset(const uint16_t &derived_values_block_offset)
Sets the derived values block offset.
Definition: DataHeader.cpp:180
void setApplicationDataBlockOffsetInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setVersionRelease(const uint8_t &version_release)
Sets the release of the version.
Definition: DataHeader.cpp:80
void setDerivedValuesBlockOffsetInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setVersionMajorVersion(const uint8_t &version_major_version)
Sets the major version number.
Definition: DataHeader.cpp:60
void setVersionIndicatorInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setDerivedValuesBlockSize(const uint16_t &derived_values_block_size)
Sets the derived values block size.
Definition: DataHeader.cpp:190
void setScanNumber(const uint32_t &scan_number)
Sets the scan number of the measurement data.
Definition: DataHeader.cpp:130
void setIntrusionDataBlockSizeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setSerialNumberOfSystemPlugInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setDataBlocksInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setSerialNumberOfSystemPlug(const uint32_t &serial_number_of_system_plug)
Sets the serial number of the system plug.
Definition: DataHeader.cpp:100
void setScanHeaderInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setTimestampDate(const uint16_t &timestamp_date)
Sets the timestamp date.
Definition: DataHeader.cpp:140
void setIntrusionDataBlockOffset(const uint16_t &intrusion_data_block_offset)
Sets the intrusion data block offset.
Definition: DataHeader.cpp:220
void setGeneralSystemStateBlockSize(const uint16_t &general_system_state_block_size)
Sets the general system state block size.
Definition: DataHeader.cpp:170
void setTimestampTimeInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setVersionIndicator(const uint8_t &version_indicator)
Sets the version indicator.
Definition: DataHeader.cpp:50
Contains the content of the data header of a udp data packet.
Definition: DataHeader.h:46
void setVersionReleaseInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setVersionMinorVersion(const uint8_t &version_minor_version)
Sets the minor version number.
Definition: DataHeader.cpp:70
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.
void setMeasurementDataBlockSize(const uint16_t &measurement_data_block_size)
Sets the measurement data block size.
Definition: DataHeader.cpp:210
void setApplicationDataBlockOffset(const uint16_t &application_data_block_offset)
Sets the application io data block offset.
Definition: DataHeader.cpp:240
void setGeneralSystemStateBlockOffsetInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const
void setMinorVersionInDataHeader(std::vector< uint8_t >::const_iterator data_ptr, datastructure::DataHeader &data_header) const


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