Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
sick::cola2::Command Class Referenceabstract

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]

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

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::ParseTCPPacketm_tcp_parser_ptr
 
bool m_was_successful
 
std::shared_ptr< sick::data_processing::ReadWriteHelperm_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 ( )
inlinevirtual

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
privatepure virtual
void sick::cola2::Command::addTelegramHeader ( sick::datastructure::PacketBuffer::VectorBuffer telegram) const
private

Definition at line 122 of file Command.cpp.

void sick::cola2::Command::constructTelegram ( sick::datastructure::PacketBuffer::VectorBuffer telegram) const

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.

uint8_t sick::cola2::Command::getCommandMode ( ) const

Returns the command mode.

Returns
The command mode.

Definition at line 92 of file Command.cpp.

uint8_t sick::cola2::Command::getCommandType ( ) const

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.

uint16_t sick::cola2::Command::getRequestID ( ) const

Returns the request id of the command.

Returns
The request id.

Definition at line 112 of file Command.cpp.

uint32_t sick::cola2::Command::getSessionID ( ) const

Returns the current session ID.

Returns
The current session ID.

Definition at line 102 of file Command.cpp.

void sick::cola2::Command::lockExecutionMutex ( )

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

Definition at line 54 of file Command.cpp.

sick::datastructure::PacketBuffer::VectorBuffer sick::cola2::Command::prepareHeader ( ) const
private

Definition at line 130 of file Command.cpp.

virtual bool sick::cola2::Command::processReply ( )
privatepure virtual
void sick::cola2::Command::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.

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.

void sick::cola2::Command::waitForCompletion ( )

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

Definition at line 72 of file Command.cpp.

bool sick::cola2::Command::wasSuccessful ( ) const

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

uint8_t sick::cola2::Command::m_command_mode
private

Definition at line 201 of file Command.h.

uint8_t sick::cola2::Command::m_command_type
private

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.

boost::mutex sick::cola2::Command::m_execution_mutex
private

Definition at line 197 of file Command.h.

uint16_t sick::cola2::Command::m_request_id
private

Definition at line 205 of file Command.h.

sick::cola2::Cola2Session& sick::cola2::Command::m_session
protected

Definition at line 191 of file Command.h.

uint32_t sick::cola2::Command::m_session_id
private

Definition at line 204 of file Command.h.

std::shared_ptr<sick::data_processing::ParseTCPPacket> sick::cola2::Command::m_tcp_parser_ptr
private

Definition at line 194 of file Command.h.

bool sick::cola2::Command::m_was_successful
private

Definition at line 199 of file Command.h.

std::shared_ptr<sick::data_processing::ReadWriteHelper> sick::cola2::Command::m_writer_ptr
private

Definition at line 195 of file Command.h.


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


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Thu May 9 2019 02:41:08