ParseMeasurementCurrentConfigData.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
64  config_data.setDerivedNumberOfBeams(readDerivedNumBeams(data_ptr));
65  config_data.setDerivedScanTime(readDerivedScanTime(data_ptr));
66  config_data.setDerivedStartAngle(readDerivedStartAngle(data_ptr));
69  return true;
70 }
71 
73  std::vector<uint8_t>::const_iterator data_ptr) const
74 {
75  std::string result;
76  result.push_back(read_write_helper::readUint8(data_ptr + 0));
77  return result;
78 }
79 
81  std::vector<uint8_t>::const_iterator data_ptr) const
82 {
83  return read_write_helper::readUint8(data_ptr + 1);
84 }
85 
87  std::vector<uint8_t>::const_iterator data_ptr) const
88 {
89  return read_write_helper::readUint8(data_ptr + 2);
90 }
91 
93  std::vector<uint8_t>::const_iterator data_ptr) const
94 {
95  return read_write_helper::readUint8(data_ptr + 3);
96 }
97 
99  std::vector<uint8_t>::const_iterator data_ptr) const
100 {
101  return read_write_helper::readUint8(data_ptr + 4);
102 }
103 
105  std::vector<uint8_t>::const_iterator data_ptr) const
106 {
107  return read_write_helper::readUint8(data_ptr + 5);
108 }
109 
110 boost::asio::ip::address_v4
111 ParseMeasurementCurrentConfigData::readHostIp(std::vector<uint8_t>::const_iterator data_ptr) const
112 {
113  uint32_t word = read_write_helper::readUint32LittleEndian(data_ptr + 8);
114  boost::asio::ip::address_v4 addr(word);
115  return addr;
116 }
117 
118 uint16_t
119 ParseMeasurementCurrentConfigData::readHostPort(std::vector<uint8_t>::const_iterator data_ptr) const
120 {
121  return read_write_helper::readUint16LittleEndian(data_ptr + 12);
122 }
123 
125  std::vector<uint8_t>::const_iterator data_ptr) const
126 {
127  return read_write_helper::readUint16LittleEndian(data_ptr + 14);
128 }
129 
131  std::vector<uint8_t>::const_iterator data_ptr) const
132 {
133  return read_write_helper::readInt32LittleEndian(data_ptr + 16);
134 }
135 
136 int32_t
137 ParseMeasurementCurrentConfigData::readEndAngle(std::vector<uint8_t>::const_iterator data_ptr) const
138 {
139  return read_write_helper::readInt32LittleEndian(data_ptr + 20);
140 }
141 
142 uint16_t
143 ParseMeasurementCurrentConfigData::readFeatures(std::vector<uint8_t>::const_iterator data_ptr) const
144 {
145  // TODO parse Features
146  return read_write_helper::readUint16LittleEndian(data_ptr + 24);
147 }
148 
150  std::vector<uint8_t>::const_iterator data_ptr) const
151 {
152  return read_write_helper::readUint16LittleEndian(data_ptr + 28);
153 }
154 
156  std::vector<uint8_t>::const_iterator data_ptr) const
157 {
158  return read_write_helper::readUint16LittleEndian(data_ptr + 30);
159 }
160 
162  std::vector<uint8_t>::const_iterator data_ptr) const
163 {
164  return read_write_helper::readUint16LittleEndian(data_ptr + 32);
165 }
166 
168  std::vector<uint8_t>::const_iterator data_ptr) const
169 {
170  return read_write_helper::readInt32LittleEndian(data_ptr + 36);
171 }
172 
174  std::vector<uint8_t>::const_iterator data_ptr) const
175 {
176  return read_write_helper::readInt32LittleEndian(data_ptr + 40);
177 }
178 
180  std::vector<uint8_t>::const_iterator data_ptr) const
181 {
182  return read_write_helper::readUint32LittleEndian(data_ptr + 44);
183 }
184 
185 
186 } // namespace data_processing
187 } // namespace sick
boost::asio::ip::address_v4 readHostIp(std::vector< uint8_t >::const_iterator data_ptr) const
void setDerivedNumberOfBeams(const uint16_t &number_of_beams)
Sets the number of beams for the current scan.
Definition: ConfigData.cpp:232
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
void setDerivedMultiplicationFactor(const uint16_t &multiplication_factor)
Sets the multiplication factor.
Definition: ConfigData.cpp:222
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::ConfigData &config_data) const
Parses a tcp sequence to read the current 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
void setVersionReleaseNumber(const uint8_t &version_release_number)
Sets the version release number for the scanner.
Definition: ConfigData.cpp:77
bool readEnabled(std::vector< uint8_t >::const_iterator data_ptr) const
std::string readVersionIndicator(std::vector< uint8_t >::const_iterator data_ptr) const
int32_t readDerivedStartAngle(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
uint16_t readDerivedNumBeams(std::vector< uint8_t >::const_iterator data_ptr) const
void setFeatures(const uint16_t &features)
Set the enabled features.
Definition: ConfigData.cpp:152
void setDerivedInterbeamPeriod(const uint32_t &interbeam_period)
Set the time between two consecutive beams.
Definition: ConfigData.cpp:278
uint32_t readUint32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
int32_t readInt32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
uint8_t readMinorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
int32_t readStartAngle(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
uint8_t readReleaseNumber(std::vector< uint8_t >::const_iterator data_ptr) const
void setPublishingFrequency(const uint16_t &publishing_frequency)
Sets the publishing frequency.
Definition: ConfigData.cpp:142
int32_t readEndAngle(std::vector< uint8_t >::const_iterator data_ptr) const
int32_t readDerivedAngularBeamResolution(std::vector< uint8_t >::const_iterator data_ptr) const
uint16_t readFeatures(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readDerivedInterbeamPeriod(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
uint16_t readDerivedMultiplicationFactor(std::vector< uint8_t >::const_iterator data_ptr) const
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
void setDerivedStartAngle(const int32_t &start_angle)
Set the start angle of the scan.
Definition: ConfigData.cpp:253
void setDerivedAngularBeamResolution(const int32_t &angular_beam_resolution)
Set the angular resolution between beams.
Definition: ConfigData.cpp:263
uint8_t readInterfaceType(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
uint16_t readHostPort(std::vector< uint8_t >::const_iterator data_ptr) const
void setDerivedScanTime(const uint16_t &scan_time)
Sets the time of the scan.
Definition: ConfigData.cpp:242
void setEndAngle(const int32_t &end_angle)
Sets the end angle of the scan.
Definition: ConfigData.cpp:191
uint8_t readMajorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
uint16_t readDerivedScanTime(std::vector< uint8_t >::const_iterator data_ptr) const
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