ParseDataHeader.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 
00024 // -- END LICENSE BLOCK ------------------------------------------------
00025 
00026 //----------------------------------------------------------------------
00033 //----------------------------------------------------------------------
00034 
00035 #include <sick_safetyscanners/data_processing/ParseDataHeader.h>
00036 
00037 namespace sick {
00038 namespace data_processing {
00039 
00040 ParseDataHeader::ParseDataHeader()
00041 {
00042   m_reader_ptr = std::make_shared<sick::data_processing::ReadWriteHelper>();
00043 }
00044 
00045 datastructure::DataHeader
00046 ParseDataHeader::parseUDPSequence(const datastructure::PacketBuffer& buffer,
00047                                   datastructure::Data& data) const
00048 {
00049   const uint8_t* data_ptr(buffer.getBuffer().data());
00050   datastructure::DataHeader data_header;
00051   setDataInDataHeader(data_ptr, data_header);
00052   return data_header;
00053 }
00054 
00055 void ParseDataHeader::setDataInDataHeader(const uint8_t*& data_ptr,
00056                                           datastructure::DataHeader& data_header) const
00057 {
00058   setVersionInDataHeader(data_ptr, data_header);
00059   setScanHeaderInDataHeader(data_ptr, data_header);
00060   setDataBlocksInDataHeader(data_ptr, data_header);
00061 }
00062 
00063 
00064 void ParseDataHeader::setVersionInDataHeader(const uint8_t*& data_ptr,
00065                                              datastructure::DataHeader& data_header) const
00066 {
00067   setVersionIndicatorInDataHeader(data_ptr, data_header);
00068   setMajorVersionInDataHeader(data_ptr, data_header);
00069   setMinorVersionInDataHeader(data_ptr, data_header);
00070   setVersionReleaseInDataHeader(data_ptr, data_header);
00071   setSerialNumberOfDeviceInDataHeader(data_ptr, data_header);
00072   setSerialNumberOfSystemPlugInDataHeader(data_ptr, data_header);
00073 }
00074 
00075 void ParseDataHeader::setScanHeaderInDataHeader(const uint8_t*& data_ptr,
00076                                                 datastructure::DataHeader& data_header) const
00077 {
00078   setChannelNumberInDataHeader(data_ptr, data_header);
00079   setSequenceNumberInDataHeader(data_ptr, data_header);
00080   setScanNumberInDataHeader(data_ptr, data_header);
00081   setTimestampDateInDataHeader(data_ptr, data_header);
00082   setTimestampTimeInDataHeader(data_ptr, data_header);
00083 }
00084 
00085 void ParseDataHeader::setDataBlocksInDataHeader(const uint8_t*& data_ptr,
00086                                                 datastructure::DataHeader& data_header) const
00087 {
00088   setGeneralSystemStateBlockOffsetInDataHeader(data_ptr, data_header);
00089   setGeneralSystemStateBlockSizeInDataHeader(data_ptr, data_header);
00090   setDerivedValuesBlockOffsetInDataHeader(data_ptr, data_header);
00091   setDerivedValuesBlockSizeInDataHeader(data_ptr, data_header);
00092   setMeasurementDataBlockOffsetInDataHeader(data_ptr, data_header);
00093   setMeasurementDataBlockSizeInDataHeader(data_ptr, data_header);
00094   setIntrusionDataBlockOffsetInDataHeader(data_ptr, data_header);
00095   setIntrusionDataBlockSizeInDataHeader(data_ptr, data_header);
00096   setApplicationDataBlockOffsetInDataHeader(data_ptr, data_header);
00097   setApplicationDataBlockSizeInDataHeader(data_ptr, data_header);
00098 }
00099 
00100 void ParseDataHeader::setVersionIndicatorInDataHeader(const uint8_t*& data_ptr,
00101                                                       datastructure::DataHeader& data_header) const
00102 {
00103   data_header.setVersionIndicator(m_reader_ptr->readuint8_tLittleEndian(data_ptr, 0));
00104 }
00105 
00106 void ParseDataHeader::setMajorVersionInDataHeader(const uint8_t*& data_ptr,
00107                                                   datastructure::DataHeader& data_header) const
00108 {
00109   data_header.setVersionMajorVersion(m_reader_ptr->readuint8_tLittleEndian(data_ptr, 1));
00110 }
00111 
00112 void ParseDataHeader::setMinorVersionInDataHeader(const uint8_t*& data_ptr,
00113                                                   datastructure::DataHeader& data_header) const
00114 {
00115   data_header.setVersionMinorVersion(m_reader_ptr->readuint8_tLittleEndian(data_ptr, 2));
00116 }
00117 
00118 void ParseDataHeader::setVersionReleaseInDataHeader(const uint8_t*& data_ptr,
00119                                                     datastructure::DataHeader& data_header) const
00120 {
00121   data_header.setVersionRelease(m_reader_ptr->readuint8_tLittleEndian(data_ptr, 3));
00122 }
00123 
00124 void ParseDataHeader::setSerialNumberOfDeviceInDataHeader(
00125   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00126 {
00127   data_header.setSerialNumberOfDevice(m_reader_ptr->readuint32_tLittleEndian(data_ptr, 4));
00128 }
00129 
00130 void ParseDataHeader::setSerialNumberOfSystemPlugInDataHeader(
00131   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00132 {
00133   data_header.setSerialNumberOfSystemPlug(m_reader_ptr->readuint32_tLittleEndian(data_ptr, 8));
00134 }
00135 
00136 void ParseDataHeader::setChannelNumberInDataHeader(const uint8_t*& data_ptr,
00137                                                    datastructure::DataHeader& data_header) const
00138 {
00139   data_header.setChannelNumber(m_reader_ptr->readuint8_tLittleEndian(data_ptr, 12));
00140 }
00141 
00142 void ParseDataHeader::setSequenceNumberInDataHeader(const uint8_t*& data_ptr,
00143                                                     datastructure::DataHeader& data_header) const
00144 {
00145   data_header.setSequenceNumber(m_reader_ptr->readuint32_tLittleEndian(data_ptr, 16));
00146 }
00147 
00148 void ParseDataHeader::setScanNumberInDataHeader(const uint8_t*& data_ptr,
00149                                                 datastructure::DataHeader& data_header) const
00150 {
00151   data_header.setScanNumber(m_reader_ptr->readuint32_tLittleEndian(data_ptr, 20));
00152 }
00153 
00154 void ParseDataHeader::setTimestampDateInDataHeader(const uint8_t*& data_ptr,
00155                                                    datastructure::DataHeader& data_header) const
00156 {
00157   data_header.setTimestampDate(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 24));
00158 }
00159 
00160 void ParseDataHeader::setTimestampTimeInDataHeader(const uint8_t*& data_ptr,
00161                                                    datastructure::DataHeader& data_header) const
00162 {
00163   data_header.setTimestampTime(m_reader_ptr->readuint32_tLittleEndian(data_ptr, 28));
00164 }
00165 
00166 void ParseDataHeader::setGeneralSystemStateBlockOffsetInDataHeader(
00167   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00168 {
00169   data_header.setGeneralSystemStateBlockOffset(
00170     m_reader_ptr->readuint16_tLittleEndian(data_ptr, 32));
00171 }
00172 
00173 void ParseDataHeader::setGeneralSystemStateBlockSizeInDataHeader(
00174   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00175 {
00176   data_header.setGeneralSystemStateBlockSize(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 34));
00177 }
00178 
00179 void ParseDataHeader::setDerivedValuesBlockOffsetInDataHeader(
00180   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00181 {
00182   data_header.setDerivedValuesBlockOffset(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 36));
00183 }
00184 
00185 void ParseDataHeader::setDerivedValuesBlockSizeInDataHeader(
00186   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00187 {
00188   data_header.setDerivedValuesBlockSize(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 38));
00189 }
00190 
00191 void ParseDataHeader::setMeasurementDataBlockOffsetInDataHeader(
00192   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00193 {
00194   data_header.setMeasurementDataBlockOffset(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 40));
00195 }
00196 
00197 void ParseDataHeader::setMeasurementDataBlockSizeInDataHeader(
00198   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00199 {
00200   data_header.setMeasurementDataBlockSize(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 42));
00201 }
00202 
00203 void ParseDataHeader::setIntrusionDataBlockOffsetInDataHeader(
00204   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00205 {
00206   data_header.setIntrusionDataBlockOffset(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 44));
00207 }
00208 
00209 void ParseDataHeader::setIntrusionDataBlockSizeInDataHeader(
00210   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00211 {
00212   data_header.setIntrusionDataBlockSize(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 46));
00213 }
00214 
00215 void ParseDataHeader::setApplicationDataBlockOffsetInDataHeader(
00216   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00217 {
00218   data_header.setApplicationDataBlockOffset(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 48));
00219 }
00220 
00221 void ParseDataHeader::setApplicationDataBlockSizeInDataHeader(
00222   const uint8_t*& data_ptr, datastructure::DataHeader& data_header) const
00223 {
00224   data_header.setApplicationDataBlockSize(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 50));
00225 }
00226 
00227 } // namespace data_processing
00228 } // namespace sick


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Tue May 7 2019 03:27:36