ParseStatusOverview.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,
47  sick::datastructure::StatusOverview& status_overview) const
48 {
49  // Keep our own copy of the shared_ptr to keep the iterators valid
50  const std::shared_ptr<std::vector<uint8_t> const> vec_ptr = buffer.getBuffer();
51  std::vector<uint8_t>::const_iterator data_ptr = vec_ptr->begin();
52  status_overview.setVersionCVersion(readVersionIndicator(data_ptr));
53  status_overview.setVersionMajorVersionNumber(readMajorNumber(data_ptr));
54  status_overview.setVersionMinorVersionNumber(readMinorNumber(data_ptr));
55  status_overview.setVersionReleaseNumber(readReleaseNumber(data_ptr));
56  status_overview.setDeviceState(readDeviceState(data_ptr));
57  status_overview.setConfigState(readConfigState(data_ptr));
58  status_overview.setApplicationState(readApplicationState(data_ptr));
59  status_overview.setCurrentTimePowerOnCount(readPowerOnCount(data_ptr));
60  status_overview.setCurrentTimeTime(readCurrentTime(data_ptr));
61  status_overview.setCurrentTimeDate(readCurrentDate(data_ptr));
62  status_overview.setErrorInfoCode(readErrorInfoCode(data_ptr));
63  status_overview.setErrorInfoTime(readErrorInfoTime(data_ptr));
64  status_overview.setErrorInfoDate(readErrorInfoDate(data_ptr));
65  return true;
66 }
67 
68 std::string
69 ParseStatusOverviewData::readVersionIndicator(std::vector<uint8_t>::const_iterator data_ptr) const
70 {
71  std::string result;
72  result.push_back(read_write_helper::readUint8(data_ptr + 0));
73  return result;
74 }
75 
76 uint8_t
77 ParseStatusOverviewData::readMajorNumber(std::vector<uint8_t>::const_iterator data_ptr) const
78 {
79  return read_write_helper::readUint8(data_ptr + 1);
80 }
81 
82 uint8_t
83 ParseStatusOverviewData::readMinorNumber(std::vector<uint8_t>::const_iterator data_ptr) const
84 {
85  return read_write_helper::readUint8(data_ptr + 2);
86 }
87 
88 uint8_t
89 ParseStatusOverviewData::readReleaseNumber(std::vector<uint8_t>::const_iterator data_ptr) const
90 {
91  return read_write_helper::readUint8(data_ptr + 3);
92 }
93 
94 uint8_t
95 ParseStatusOverviewData::readDeviceState(std::vector<uint8_t>::const_iterator data_ptr) const
96 {
97  return read_write_helper::readUint8(data_ptr + 4);
98 }
99 
100 uint8_t
101 ParseStatusOverviewData::readConfigState(std::vector<uint8_t>::const_iterator data_ptr) const
102 {
103  return read_write_helper::readUint8(data_ptr + 5);
104 }
105 
106 uint8_t
107 ParseStatusOverviewData::readApplicationState(std::vector<uint8_t>::const_iterator data_ptr) const
108 {
109  return read_write_helper::readUint8(data_ptr + 6);
110 }
111 
112 uint32_t
113 ParseStatusOverviewData::readPowerOnCount(std::vector<uint8_t>::const_iterator data_ptr) const
114 {
115  return read_write_helper::readUint32LittleEndian(data_ptr + 12);
116 }
117 
118 uint32_t
119 ParseStatusOverviewData::readCurrentTime(std::vector<uint8_t>::const_iterator data_ptr) const
120 {
121  return read_write_helper::readUint32LittleEndian(data_ptr + 16);
122 }
123 
124 uint16_t
125 ParseStatusOverviewData::readCurrentDate(std::vector<uint8_t>::const_iterator data_ptr) const
126 {
127  return read_write_helper::readUint16LittleEndian(data_ptr + 20);
128 }
129 
130 uint32_t
131 ParseStatusOverviewData::readErrorInfoCode(std::vector<uint8_t>::const_iterator data_ptr) const
132 {
133  return read_write_helper::readUint32LittleEndian(data_ptr + 24);
134 }
135 
136 uint32_t
137 ParseStatusOverviewData::readErrorInfoTime(std::vector<uint8_t>::const_iterator data_ptr) const
138 {
139  return read_write_helper::readUint32LittleEndian(data_ptr + 52);
140 }
141 
142 uint16_t
143 ParseStatusOverviewData::readErrorInfoDate(std::vector<uint8_t>::const_iterator data_ptr) const
144 {
145  return read_write_helper::readUint16LittleEndian(data_ptr + 56);
146 }
147 
148 
149 } // namespace data_processing
150 } // namespace sick
uint32_t readErrorInfoTime(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readReleaseNumber(std::vector< uint8_t >::const_iterator data_ptr) const
void setApplicationState(uint8_t application_state)
Sets the application state for the scanner.
void setErrorInfoDate(uint16_t error_info_date)
Sets the error info date for the scanner.
void setVersionMinorVersionNumber(const uint8_t &version_minor_version_number)
Sets the minor version number for the scanner.
void setErrorInfoCode(uint32_t error_info_code)
Sets the error info code for the scanner.
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.
void setCurrentTimeTime(uint32_t current_time_time)
Sets the current time time for the scanner.
uint32_t readPowerOnCount(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readMinorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
uint8_t readApplicationState(std::vector< uint8_t >::const_iterator data_ptr) const
void setErrorInfoTime(uint32_t error_info_time)
Sets the error info time for the scanner.
uint8_t readConfigState(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.
uint8_t readDeviceState(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readCurrentTime(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.
uint16_t readErrorInfoDate(std::vector< uint8_t >::const_iterator data_ptr) const
Class containing the serial number of a laser scanner.
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::StatusOverview &status_overview) const
Parses a tcp sequence to read the status overview of the sensor.
void setCurrentTimeDate(uint16_t current_time_date)
Sets the current time date for the scanner.
void setConfigState(uint8_t config_state)
Sets the config state for the scanner.
void setCurrentTimePowerOnCount(uint32_t current_time_power_on_count)
Sets the current time power on count for the scanner.
void setVersionReleaseNumber(const uint8_t &version_release_number)
Sets the version release number for the scanner.
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.
uint8_t readMajorNumber(std::vector< uint8_t >::const_iterator data_ptr) const
void setDeviceState(uint8_t device_state)
Sets the device state for the scanner.
uint16_t readCurrentDate(std::vector< uint8_t >::const_iterator data_ptr) const
std::string readVersionIndicator(std::vector< uint8_t >::const_iterator data_ptr) const
uint32_t readErrorInfoCode(std::vector< uint8_t >::const_iterator data_ptr) const


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