45 , m_command_mode(command_mode)
46 , m_command_type(command_type)
50 m_tcp_parser_ptr = std::make_shared<sick::data_processing::ParseTCPPacket>();
51 m_writer_ptr = std::make_shared<sick::data_processing::ReadWriteHelper>();
125 uint8_t* data_ptr = header.data();
127 telegram.insert(telegram.begin(), header.begin(), header.end());
162 uint32_t cola2_stx = 0x02020202;
163 m_writer_ptr->writeuint32_tBigEndian(data_ptr, cola2_stx, 0);
169 uint32_t length = 10 + telegram.size();
170 m_writer_ptr->writeuint32_tBigEndian(data_ptr, length, 4);
175 uint8_t cola2_hub_cntr = 0x00;
176 m_writer_ptr->writeuint8_tBigEndian(data_ptr, cola2_hub_cntr, 8);
181 uint8_t cola2_noc = 0x00;
182 m_writer_ptr->writeuint8_tBigEndian(data_ptr, cola2_noc, 9);
void setCommandMode(const uint8_t &command_mode)
Sets the command mode.
void setSessionID(const uint32_t &session_id)
Sets the session ID.
void setDataVector(const std::vector< uint8_t > &data)
Sets the data vector.
std::shared_ptr< sick::data_processing::ReadWriteHelper > m_writer_ptr
std::vector< uint8_t > getDataVector() const
Returns the data vector.
uint16_t getRequestID() const
Returns the request id of the command.
void processReplyBase(const sick::datastructure::PacketBuffer::VectorBuffer &packet)
Parses the da incoming data package and then processes it with the inherited processReply. Afterwards the mutex will be unlocked to allow new commands to be send.
void writeCommandTypeToDataPtr(uint8_t *&data_ptr) const
sick::datastructure::PacketBuffer::VectorBuffer prepareHeader() const
boost::mutex m_execution_mutex
uint8_t getCommandType() const
Returns the command type.
void setRequestID(const uint16_t &request_id)
Sets the request ID of the command.
virtual void addTelegramData(sick::datastructure::PacketBuffer::VectorBuffer &telegram) const =0
void writeCola2HubCntrToDataPtr(uint8_t *&data_ptr) const
void writeDataToDataPtr(uint8_t *&data_ptr, datastructure::PacketBuffer::VectorBuffer &telegram) const
void constructTelegram(sick::datastructure::PacketBuffer::VectorBuffer &telegram) const
Adds the data to the telegram and afterwards the header with the correct length.
void setCommandType(const uint8_t &command_type)
Sets the command type.
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.
uint32_t getSessionID() const
Returns the current session ID.
void writeLengthToDataPtr(uint8_t *&data_ptr, datastructure::PacketBuffer::VectorBuffer &telegram) const
std::shared_ptr< sick::data_processing::ParseTCPPacket > m_tcp_parser_ptr
void waitForCompletion()
Scooped call to the mutex, which will block until the reply was processed.
void writeCola2NoCToDataPtr(uint8_t *&data_ptr) const
sick::cola2::Cola2Session & m_session
uint8_t getCommandMode() const
Returns the command mode.
void writeCommandModeToDataPtr(uint8_t *&data_ptr) const
uint16_t getNextRequestID()
Returns the next request ID. The request ID is used to match the return packages of the sensor to the...
void writeRequestIdToDataPtr(uint8_t *&data_ptr) const
void lockExecutionMutex()
Locks a mutex to prevent other commands being executed in parallel.
uint32_t getSessionID() const
Returns the current session ID.
std::vector< uint8_t > m_data_vector
std::vector< uint8_t > VectorBuffer
Typedef for a vector buffer, to sort the incoming packets.
Establishes a cola2 session with a sensor and enables execution of commands in this session...
bool wasSuccessful() const
Returns if the command was successfully parsed.
virtual bool processReply()=0
void writeSessionIdToDataPtr(uint8_t *&data_ptr) const
void writeCola2StxToDataPtr(uint8_t *&data_ptr) const
void addTelegramHeader(sick::datastructure::PacketBuffer::VectorBuffer &telegram) const