ParseDeviceName.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  m_reader_ptr = std::make_shared<sick::data_processing::ReadWriteHelper>();
45 }
46 
47 
49  std::string& device_name) const
50 {
51  const uint8_t* data_ptr(buffer.getBuffer().data());
52  device_name = readDeviceName(data_ptr);
53  return true;
54 }
55 
56 
57 std::string ParseDeviceName::readDeviceName(const uint8_t*& data_ptr) const
58 {
59  uint16_t string_length = m_reader_ptr->readuint16_tLittleEndian(data_ptr, 0);
60 
61  std::string name;
62  for (uint16_t i = 0; i < string_length; i++)
63  {
64  name.push_back(m_reader_ptr->readuint16_tLittleEndian(data_ptr, 2 + i));
65  }
66  return name;
67 }
68 
69 
70 } // namespace data_processing
71 } // namespace sick
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, std::string &device_name) const
Parses a tcp sequence to read the device name of the sensor.
std::string readDeviceName(const uint8_t *&data_ptr) const
A packetbuffer for the raw data from the sensor.
Definition: PacketBuffer.h:61
std::shared_ptr< sick::data_processing::ReadWriteHelper > m_reader_ptr
const VectorBuffer & getBuffer() const
Getter to return the VectorBuffer saved in the PacketBuffer.
ParseDeviceName()
Constructor of the parser.


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Thu May 9 2019 02:41:08