ParseRequiredUserAction.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::RequiredUserAction& required_user_action) 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  readRequiredUserAction(data_ptr, required_user_action);
53  return true;
54 }
55 
57  std::vector<uint8_t>::const_iterator data_ptr,
58  sick::datastructure::RequiredUserAction& required_user_action) const
59 {
60  uint16_t word = read_write_helper::readUint16LittleEndian(data_ptr + 0);
61 
62  required_user_action.setConfirmConfiguration(static_cast<bool>(word & (0x01 << 0)));
63  required_user_action.setCheckConfiguration(static_cast<bool>(word & (0x01 << 1)));
64  required_user_action.setCheckEnvironment(static_cast<bool>(word & (0x01 << 2)));
65  required_user_action.setCheckApplicationInterfaces(static_cast<bool>(word & (0x01 << 3)));
66  required_user_action.setCheckDevice(static_cast<bool>(word & (0x01 << 4)));
67  required_user_action.setRunSetupProcedure(static_cast<bool>(word & (0x01 << 5)));
68  required_user_action.setCheckFirmware(static_cast<bool>(word & (0x01 << 6)));
69  required_user_action.setWait(static_cast<bool>(word & (0x01 << 7)));
70  return true;
71 }
72 
73 } // namespace data_processing
74 } // namespace sick
void setConfirmConfiguration(bool confirm_configuration)
Sets whether the configuration has to be confirmed.
bool readRequiredUserAction(std::vector< uint8_t >::const_iterator data_ptr, datastructure::RequiredUserAction &required_user_action) const
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 setCheckEnvironment(bool check_environment)
Sets whether the environment has to be checked.
void setRunSetupProcedure(bool run_setup_procedure)
Sets whether the setup procedure has to be run.
void setCheckConfiguration(bool check_configuration)
Sets whether the configuration has to be checked.
void setCheckDevice(bool check_device)
Sets whether the device has to be checked.
void setCheckApplicationInterfaces(bool check_application_interfaces)
Sets whether the application interfaces have to be checked.
void setWait(bool wait)
Sets whether the user has to wait.
void setCheckFirmware(bool check_firmware)
Sets whether the firmware has to be checked.
Class containing the additional information about the sopas state.
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::RequiredUserAction &required_user_action) const
Parses a tcp sequence to read the required user action of the sensor.


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