ParseMeasurementPersistentConfigData.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, datastructure::ConfigData& config_data) 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  config_data.setVersionCVersion(readVersionIndicator(data_ptr));
52  config_data.setVersionMajorVersionNumber(readMajorNumber(data_ptr));
53  config_data.setVersionMinorVersionNumber(readMinorNumber(data_ptr));
54  config_data.setVersionReleaseNumber(readReleaseNumber(data_ptr));
55  config_data.setEnabled(readEnabled(data_ptr));
56  config_data.setEInterfaceType(readInterfaceType(data_ptr));
57  config_data.setHostIp(readHostIp(data_ptr));
58  config_data.setHostUdpPort(readHostPort(data_ptr));
59  config_data.setPublishingFrequency(readPublishingFreq(data_ptr));
60  config_data.setStartAngle(readStartAngle(data_ptr));
61  config_data.setEndAngle(readEndAngle(data_ptr));
62  config_data.setFeatures(readFeatures(data_ptr)); // TODO
63  return true;
64 }
65 
67  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 
75  std::vector<uint8_t>::const_iterator data_ptr) const
76 {
77  return read_write_helper::readUint8(data_ptr + 1);
78 }
79 
81  std::vector<uint8_t>::const_iterator data_ptr) const
82 {
83  return read_write_helper::readUint8(data_ptr + 2);
84 }
85 
87  std::vector<uint8_t>::const_iterator data_ptr) const
88 {
89  return read_write_helper::readUint8(data_ptr + 3);
90 }
91 
93  std::vector<uint8_t>::const_iterator data_ptr) const
94 {
95  return read_write_helper::readUint8(data_ptr + 4);
96 }
97 
99  std::vector<uint8_t>::const_iterator data_ptr) const
100 {
101  return read_write_helper::readUint8(data_ptr + 5);
102 }
103 
105  std::vector<uint8_t>::const_iterator data_ptr) const
106 {
107  uint32_t word = read_write_helper::readUint32LittleEndian(data_ptr + 8);
108  boost::asio::ip::address_v4 addr(word);
109  return addr;
110 }
111 
113  std::vector<uint8_t>::const_iterator data_ptr) const
114 {
115  return read_write_helper::readUint16LittleEndian(data_ptr + 12);
116 }
117 
119  std::vector<uint8_t>::const_iterator data_ptr) const
120 {
121  return read_write_helper::readUint16LittleEndian(data_ptr + 14);
122 }
123 
125  std::vector<uint8_t>::const_iterator data_ptr) const
126 {
127  return read_write_helper::readUint32LittleEndian(data_ptr + 16);
128 }
129 
131  std::vector<uint8_t>::const_iterator data_ptr) const
132 {
133  return read_write_helper::readUint32LittleEndian(data_ptr + 20);
134 }
135 
137  std::vector<uint8_t>::const_iterator data_ptr) const
138 {
139  // TODO parse Features
140  return read_write_helper::readUint16LittleEndian(data_ptr + 24);
141 }
142 
143 
144 } // namespace data_processing
145 } // namespace sick
uint8_t readReleaseNumber(std::vector< uint8_t >::const_iterator data_ptr) const
void setHostIp(const boost::asio::ip::address_v4 &host_ip)
Sets the IP-address of the host from an IP-address.
Definition: ConfigData.cpp:87
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::ConfigData &config_data) const
Parses a tcp sequence to read the persistent configuration of the sensor.
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.
uint16_t readPublishingFreq(std::vector< uint8_t >::const_iterator data_ptr) const
uint16_t readFeatures(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.
Definition: ConfigData.cpp:77
boost::asio::ip::address_v4 readHostIp(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readStartAngle(std::vector< uint8_t >::const_iterator data_ptr) const
void setHostUdpPort(const uint16_t &host_udp_port)
Sets the host udp port.
Definition: ConfigData.cpp:102
void setEInterfaceType(const uint8_t &e_interface_type)
Sets the eInterface type.
Definition: ConfigData.cpp:132
void setFeatures(const uint16_t &features)
Set the enabled features.
Definition: ConfigData.cpp:152
uint8_t readInterfaceType(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readUint32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
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.
Definition: ConfigData.cpp:57
void setPublishingFrequency(const uint16_t &publishing_frequency)
Sets the publishing frequency.
Definition: ConfigData.cpp:142
uint8_t readMinorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readMajorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
bool readEnabled(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readEndAngle(std::vector< uint8_t >::const_iterator data_ptr) const
void setVersionMinorVersionNumber(const uint8_t &version_minor_version_number)
Sets the minor version number for the scanner.
Definition: ConfigData.cpp:67
Config data for current and persistent sensor config.
Definition: ConfigData.h:50
void setStartAngle(const int32_t &start_angle)
Sets the start angle of the scan.
Definition: ConfigData.cpp:176
uint16_t readHostPort(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.
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.
void setVersionCVersion(const std::string &version_c_version)
Sets the version indicator for the scanner.
Definition: ConfigData.cpp:47
void setEndAngle(const int32_t &end_angle)
Sets the end angle of the scan.
Definition: ConfigData.cpp:191
void setEnabled(bool enabled)
Sets if the channel is enabled.
Definition: ConfigData.cpp:122


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