ParseOrderNumber.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  datastructure::OrderNumber& order_number) const
47 {
48  // Keep our own copy of the shared_ptr to keep the iterators valid
49  const std::shared_ptr<std::vector<uint8_t> const> vec_ptr = buffer.getBuffer();
50  std::vector<uint8_t>::const_iterator data_ptr = vec_ptr->begin();
51  order_number.setOrderNumber(readOrderNumber(data_ptr));
52  return true;
53 }
54 
55 
56 std::string ParseOrderNumber::readOrderNumber(std::vector<uint8_t>::const_iterator data_ptr) const
57 {
58  uint16_t string_length = read_write_helper::readUint16LittleEndian(data_ptr + 0);
59 
60  std::string number;
61  for (uint16_t i = 0; i < string_length; i++)
62  {
63  number.push_back(read_write_helper::readUint16LittleEndian(data_ptr + 2 + i));
64  }
65  return number;
66 }
67 
68 
69 } // namespace data_processing
70 } // namespace sick
void setOrderNumber(const std::string &order_number)
Sets the order number for the scanner.
Definition: OrderNumber.cpp:47
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::OrderNumber &order_number) const
Parses a tcp sequence to read the order number of the sensor.
A packetbuffer for the raw data from the sensor.
Definition: PacketBuffer.h:61
std::string readOrderNumber(std::vector< uint8_t >::const_iterator data_ptr) const
std::shared_ptr< std::vector< uint8_t > const > getBuffer() const
Getter to return a copy of the data saved in the PacketBuffer.
ParseOrderNumber()
Constructor of the parser.
Class containing the order number of a laser scanner.
Definition: OrderNumber.h:47
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.


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