Go to the documentation of this file.
45 , m_command_mode(command_mode)
46 , m_command_type(command_type)
50 m_tcp_parser_ptr = std::make_shared<sick::data_processing::ParseTCPPacket>();
122 size_t additional_bytes)
const
125 std::vector<uint8_t> output(telegram.size() + additional_bytes);
128 std::copy(telegram.begin(), telegram.end(), output.begin());
135 std::vector<uint8_t>::iterator data_ptr =
header.begin();
138 header.insert(
header.end(), telegram.begin(), telegram.end());
144 return std::vector<uint8_t>(18);
158 const std::vector<uint8_t>& telegram)
const
172 uint32_t cola2_stx = 0x02020202;
177 const std::vector<uint8_t>& telegram)
const
179 uint32_t length = 10 + telegram.size();
185 uint8_t cola2_hub_cntr = 0x00;
191 uint8_t cola2_noc = 0x00;
void setSessionID(const uint32_t &session_id)
Sets the session ID.
void writeCola2HubCntrToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
void lockExecutionMutex()
Locks a mutex to prevent other commands being executed in parallel.
void writeUint16BigEndian(std::vector< uint8_t >::iterator it, const uint16_t v)
Writes an unsigned 16-bit integer to a buffer at offset in big endian encoding.
bool wasSuccessful() const
Returns if the command was successfully parsed.
Establishes a cola2 session with a sensor and enables execution of commands in this session.
std::vector< uint8_t > constructTelegram(const std::vector< uint8_t > &telegram) const
Adds the data to the telegram and afterwards the header with the correct length.
void setRequestID(const uint16_t &request_id)
Sets the request ID of the command.
void writeCola2NoCToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
void waitForCompletion()
Scooped call to the mutex, which will block until the reply was processed.
void setCommandType(const uint8_t &command_type)
Sets the command type.
void setDataVector(const std::vector< uint8_t > &data)
Sets the data vector.
void writeRequestIdToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
std::vector< uint8_t > addTelegramHeader(const std::vector< uint8_t > &telegram) const
std::vector< uint8_t > prepareHeader() const
virtual bool processReply()=0
virtual std::vector< uint8_t > addTelegramData(const std::vector< uint8_t > &telegram) const =0
uint8_t getCommandType() const
Returns the command type.
void writeSessionIdToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
std::vector< uint8_t > m_data_vector
uint16_t getNextRequestID()
Returns the next request ID. The request ID is used to match the return packages of the sensor to the...
void setCommandMode(const uint8_t &command_mode)
Sets the command mode.
std::vector< uint8_t > getDataVector() const
Returns the data vector.
sick::cola2::Cola2Session & m_session
void processReplyBase(const std::vector< uint8_t > &packet)
Parses the da incoming data package and then processes it with the inherited processReply....
uint32_t getSessionID() const
Returns the current session ID.
void writeCommandModeToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
void writeUint32BigEndian(std::vector< uint8_t >::iterator it, const uint32_t v)
Writes an unsigned 32-bit integer to a buffer at offset in big endian encoding.
uint32_t getSessionID() const
Returns the current session ID.
std::vector< uint8_t > expandTelegram(const std::vector< uint8_t > &telegram, size_t additional_bytes) const
void writeLengthToDataPtr(std::vector< uint8_t >::iterator data_ptr, const std::vector< uint8_t > &telegram) const
void writeCola2StxToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
void writeDataToDataPtr(std::vector< uint8_t >::iterator data_ptr, const std::vector< uint8_t > &telegram) const
void writeUint8BigEndian(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes an unsigned 8-bit integer to a buffer at offset in big endian encoding.
boost::mutex m_execution_mutex
Command(sick::cola2::Cola2Session &session, const uint16_t &command_type, const uint16_t &command_mode)
Constructor of the command. Sets the common variables for a command to the sensor.
uint16_t getRequestID() const
Returns the request id of the command.
std::shared_ptr< sick::data_processing::ParseTCPPacket > m_tcp_parser_ptr
void writeCommandTypeToDataPtr(std::vector< uint8_t >::iterator data_ptr) const
uint8_t getCommandMode() const
Returns the command mode.