Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
sick::cola2::Command Class Reference

Base class for commands. Defines the base interface and does the common tasks. More...

#include <Command.h>

Inheritance diagram for sick::cola2::Command:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 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.
void constructTelegram (sick::datastructure::PacketBuffer::VectorBuffer &telegram) const
 Adds the data to the telegram and afterwards the header with the correct length.
uint8_t getCommandMode () const
 Returns the command mode.
uint8_t getCommandType () const
 Returns the command type.
std::vector< uint8_t > getDataVector () const
 Returns the data vector.
uint16_t getRequestID () const
 Returns the request id of the command.
uint32_t getSessionID () const
 Returns the current session ID.
void lockExecutionMutex ()
 Locks a mutex to prevent other commands being executed in parallel.
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 setCommandMode (const uint8_t &command_mode)
 Sets the command mode.
void setCommandType (const uint8_t &command_type)
 Sets the command type.
void setDataVector (const std::vector< uint8_t > &data)
 Sets the data vector.
void setRequestID (const uint16_t &request_id)
 Sets the request ID of the command.
void setSessionID (const uint32_t &session_id)
 Sets the session ID.
void waitForCompletion ()
 Scooped call to the mutex, which will block until the reply was processed.
bool wasSuccessful () const
 Returns if the command was successfully parsed.
virtual ~Command ()
 We have virtual member functions, so a virtual destructor is needed.

Protected Attributes

sick::cola2::Cola2Sessionm_session

Private Member Functions

virtual void addTelegramData (sick::datastructure::PacketBuffer::VectorBuffer &telegram) const =0
void addTelegramHeader (sick::datastructure::PacketBuffer::VectorBuffer &telegram) const
sick::datastructure::PacketBuffer::VectorBuffer prepareHeader () const
virtual bool processReply ()=0
void writeCola2HubCntrToDataPtr (uint8_t *&data_ptr) const
void writeCola2NoCToDataPtr (uint8_t *&data_ptr) const
void writeCola2StxToDataPtr (uint8_t *&data_ptr) const
void writeCommandModeToDataPtr (uint8_t *&data_ptr) const
void writeCommandTypeToDataPtr (uint8_t *&data_ptr) const
void writeDataToDataPtr (uint8_t *&data_ptr, datastructure::PacketBuffer::VectorBuffer &telegram) const
void writeLengthToDataPtr (uint8_t *&data_ptr, datastructure::PacketBuffer::VectorBuffer &telegram) const
void writeRequestIdToDataPtr (uint8_t *&data_ptr) const
void writeSessionIdToDataPtr (uint8_t *&data_ptr) const

Private Attributes

uint8_t m_command_mode
uint8_t m_command_type
std::vector< uint8_t > m_data_vector
boost::mutex m_execution_mutex
uint16_t m_request_id
uint32_t m_session_id
std::shared_ptr
< sick::data_processing::ParseTCPPacket
m_tcp_parser_ptr
bool m_was_successful
std::shared_ptr
< sick::data_processing::ReadWriteHelper
m_writer_ptr

Detailed Description

Base class for commands. Defines the base interface and does the common tasks.

Definition at line 61 of file Command.h.


Constructor & Destructor Documentation

sick::cola2::Command::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.

Parameters:
sessionThe session in which the command will be executed.
command_typeDefines what type of command will be executed in the sensor (Read, Write, Invoking a method).
command_modeSpecifies the mode of the command. If the request is by index or name.

Definition at line 43 of file Command.cpp.

virtual sick::cola2::Command::~Command ( ) [inline, virtual]

We have virtual member functions, so a virtual destructor is needed.

Definition at line 79 of file Command.h.


Member Function Documentation

virtual void sick::cola2::Command::addTelegramData ( sick::datastructure::PacketBuffer::VectorBuffer telegram) const [private, pure virtual]

Definition at line 122 of file Command.cpp.

Adds the data to the telegram and afterwards the header with the correct length.

Parameters:
telegramThe telegram, which will be modified with the data and header.

Definition at line 59 of file Command.cpp.

Returns the command mode.

Returns:
The command mode.

Definition at line 92 of file Command.cpp.

Returns the command type.

Returns:
The command type.

Definition at line 82 of file Command.cpp.

std::vector< uint8_t > sick::cola2::Command::getDataVector ( ) const

Returns the data vector.

Returns:
The data vector.

Definition at line 137 of file Command.cpp.

Returns the request id of the command.

Returns:
The request id.

Definition at line 112 of file Command.cpp.

Returns the current session ID.

Returns:
The current session ID.

Definition at line 102 of file Command.cpp.

Locks a mutex to prevent other commands being executed in parallel.

Definition at line 54 of file Command.cpp.

Definition at line 130 of file Command.cpp.

virtual bool sick::cola2::Command::processReply ( ) [private, pure virtual]

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.

Parameters:
packetThe incoming data package which will be processed.

Definition at line 65 of file Command.cpp.

void sick::cola2::Command::setCommandMode ( const uint8_t &  command_mode)

Sets the command mode.

Parameters:
command_modeThe new command mode.

Definition at line 97 of file Command.cpp.

void sick::cola2::Command::setCommandType ( const uint8_t &  command_type)

Sets the command type.

Parameters:
command_typeThe new command type.

Definition at line 87 of file Command.cpp.

void sick::cola2::Command::setDataVector ( const std::vector< uint8_t > &  data)

Sets the data vector.

Parameters:
dataThe new data vector.

Definition at line 142 of file Command.cpp.

void sick::cola2::Command::setRequestID ( const uint16_t &  request_id)

Sets the request ID of the command.

Parameters:
request_idThe new request id.

Definition at line 117 of file Command.cpp.

void sick::cola2::Command::setSessionID ( const uint32_t &  session_id)

Sets the session ID.

Parameters:
session_idThe new session ID.

Definition at line 107 of file Command.cpp.

Scooped call to the mutex, which will block until the reply was processed.

Definition at line 72 of file Command.cpp.

Returns if the command was successfully parsed.

Returns:
If the command was successfully parsed.

Definition at line 77 of file Command.cpp.

void sick::cola2::Command::writeCola2HubCntrToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 173 of file Command.cpp.

void sick::cola2::Command::writeCola2NoCToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 179 of file Command.cpp.

void sick::cola2::Command::writeCola2StxToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 160 of file Command.cpp.

void sick::cola2::Command::writeCommandModeToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 200 of file Command.cpp.

void sick::cola2::Command::writeCommandTypeToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 195 of file Command.cpp.

void sick::cola2::Command::writeDataToDataPtr ( uint8_t *&  data_ptr,
datastructure::PacketBuffer::VectorBuffer telegram 
) const [private]

Definition at line 147 of file Command.cpp.

void sick::cola2::Command::writeLengthToDataPtr ( uint8_t *&  data_ptr,
datastructure::PacketBuffer::VectorBuffer telegram 
) const [private]

Definition at line 166 of file Command.cpp.

void sick::cola2::Command::writeRequestIdToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 190 of file Command.cpp.

void sick::cola2::Command::writeSessionIdToDataPtr ( uint8_t *&  data_ptr) const [private]

Definition at line 185 of file Command.cpp.


Member Data Documentation

Definition at line 201 of file Command.h.

Definition at line 202 of file Command.h.

std::vector<uint8_t> sick::cola2::Command::m_data_vector [private]

Definition at line 207 of file Command.h.

Definition at line 197 of file Command.h.

Definition at line 205 of file Command.h.

Definition at line 191 of file Command.h.

Definition at line 204 of file Command.h.

Definition at line 194 of file Command.h.

Definition at line 199 of file Command.h.


The documentation for this class was generated from the following files:


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Tue May 7 2019 03:27:37