CoLaCommand.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2023 SICK AG, Waldkirch
3 //
4 // SPDX-License-Identifier: Unlicense
5 
6 #pragma once
7 
8 #include <cstdint>
9 #include <string>
10 #include <vector>
11 
12 #include "CoLaCommandType.h"
13 #include "CoLaError.h"
14 
15 namespace visionary {
16 
18 {
19 public:
20  using ByteBuffer = std::vector<std::uint8_t>;
21 
22  CoLaCommand();
23  ~CoLaCommand();
24 
27  CoLaCommand(const ByteBuffer& buffer);
28 
30  const ByteBuffer& getBuffer() const;
31 
34 
36  const char* getName() const;
37 
39  std::size_t getParameterOffset() const;
40 
42  CoLaError::Enum getError() const;
43 
45  static CoLaCommand errorCommand();
46 
49 
50 private:
53  std::string m_name;
54  std::size_t m_parameterOffset;
56 
58  CoLaCommand(CoLaCommandType::Enum commandType, CoLaError::Enum error, const std::string& name);
59 
61  bool fromBuffer(const ByteBuffer& buffer);
62 };
63 
64 } // namespace visionary
visionary::CoLaCommand::errorCommand
static CoLaCommand errorCommand()
Create a command for network errors.
visionary::CoLaCommand::getParameterOffset
std::size_t getParameterOffset() const
Get offset in bytes to where first parameter starts.
Definition: CoLaCommand.cpp:154
visionary::CoLaCommand::networkErrorCommand
static CoLaCommand networkErrorCommand()
Create a command for network errors.
Definition: CoLaCommand.cpp:164
visionary
Definition: MD5.cpp:44
visionary::CoLaCommand::getError
CoLaError::Enum getError() const
Get error.
Definition: CoLaCommand.cpp:159
visionary::CoLaCommand
Definition: CoLaCommand.h:17
visionary::CoLaCommand::m_type
CoLaCommandType::Enum m_type
Definition: CoLaCommand.h:52
visionary::CoLaCommand::m_error
CoLaError::Enum m_error
Definition: CoLaCommand.h:55
visionary::CoLaError::Enum
Enum
Possible CoLa errors.
Definition: CoLaError.h:12
visionary::CoLaCommand::getBuffer
const ByteBuffer & getBuffer() const
Get the binary data buffer.
Definition: CoLaCommand.cpp:139
visionary::CoLaCommand::getName
const char * getName() const
Get the name of command.
Definition: CoLaCommand.cpp:149
visionary::CoLaCommand::getType
CoLaCommandType::Enum getType() const
Get the type of command.
Definition: CoLaCommand.cpp:144
CoLaCommandType.h
visionary::CoLaCommand::~CoLaCommand
~CoLaCommand()
visionary::CoLaCommandType::Enum
Enum
Definition: CoLaCommandType.h:12
visionary::CoLaCommand::CoLaCommand
CoLaCommand()
CoLaError.h
visionary::CoLaCommand::fromBuffer
bool fromBuffer(const ByteBuffer &buffer)
Decode a CoLa command from a given buffer.
Definition: CoLaCommand.cpp:15
visionary::CoLaCommand::m_name
std::string m_name
Definition: CoLaCommand.h:53
visionary::CoLaCommand::ByteBuffer
std::vector< std::uint8_t > ByteBuffer
Definition: CoLaCommand.h:20
visionary::CoLaCommand::m_buffer
ByteBuffer m_buffer
Definition: CoLaCommand.h:51
visionary::CoLaCommand::m_parameterOffset
std::size_t m_parameterOffset
Definition: CoLaCommand.h:54


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:38:05