Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sick::cola2::Cola2Session Class Reference

Establishes a cola2 session with a sensor and enables execution of commands in this session. More...

#include <Cola2Session.h>

Public Types

typedef std::shared_ptr< sick::cola2::CommandCommandPtr
 Typedef for a pointer containing a command to be executed. More...
 

Public Member Functions

bool close ()
 Closes a session with the sensor. Executes the close session command. More...
 
 Cola2Session (const std::shared_ptr< communication::AsyncTCPClient > &async_tcp_client)
 Constructor of the cola2 session. More...
 
void doDisconnect ()
 Triggers the disconnection of the tcp socket. More...
 
bool executeCommand (const CommandPtr &command)
 Executes the command passed to the function. More...
 
uint16_t getNextRequestID ()
 Returns the next request ID. The request ID is used to match the return packages of the sensor to the right command. More...
 
uint32_t getSessionID () const
 Returns the current session ID. More...
 
bool open ()
 Opens a session with the sensor. Executes the create session command. More...
 
void setSessionID (const uint32_t &session_id)
 Sets the current session ID. More...
 

Private Member Functions

bool addCommand (const uint16_t &request_id, const CommandPtr &command)
 
bool addPacketToMerger (const sick::datastructure::PacketBuffer &packet)
 
bool checkIfPacketIsCompleteAndOtherwiseListenForMorePackets ()
 
bool findCommand (const uint16_t &request_id, CommandPtr &command)
 
void processPacket (const sick::datastructure::PacketBuffer &packet)
 
bool removeCommand (const uint16_t &request_id)
 
bool sendTelegramAndListenForAnswer (const CommandPtr &command)
 
bool startProcessingAndRemovePendingCommandAfterwards (const sick::datastructure::PacketBuffer &packet)
 

Private Attributes

std::shared_ptr< sick::communication::AsyncTCPClientm_async_tcp_client_ptr
 
boost::mutex m_execution_mutex
 
uint16_t m_last_request_id
 
std::shared_ptr< sick::data_processing::TCPPacketMergerm_packet_merger_ptr
 
std::shared_ptr< sick::data_processing::ParseTCPPacketm_parser_ptr
 
std::map< uint16_t, CommandPtrm_pending_commands_map
 
uint32_t m_session_id
 
std::shared_ptr< sick::data_processing::ParseTCPPacketm_tcp_parser_ptr
 

Detailed Description

Establishes a cola2 session with a sensor and enables execution of commands in this session.

Definition at line 72 of file Cola2Session.h.

Member Typedef Documentation

Typedef for a pointer containing a command to be executed.

Definition at line 78 of file Cola2Session.h.

Constructor & Destructor Documentation

sick::cola2::Cola2Session::Cola2Session ( const std::shared_ptr< communication::AsyncTCPClient > &  async_tcp_client)
explicit

Constructor of the cola2 session.

Parameters
async_tcp_clientPointer to an instance of a TCP-client. Will be used to establish a connection to the sensor.

Definition at line 40 of file Cola2Session.cpp.

Member Function Documentation

bool sick::cola2::Cola2Session::addCommand ( const uint16_t &  request_id,
const CommandPtr command 
)
private

Definition at line 138 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::addPacketToMerger ( const sick::datastructure::PacketBuffer packet)
private

Definition at line 104 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::checkIfPacketIsCompleteAndOtherwiseListenForMorePackets ( )
private

Definition at line 114 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::close ( )

Closes a session with the sensor. Executes the close session command.

Returns
If closing the session was successful.

Definition at line 56 of file Cola2Session.cpp.

void sick::cola2::Cola2Session::doDisconnect ( )

Triggers the disconnection of the tcp socket.

Definition at line 62 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::executeCommand ( const CommandPtr command)

Executes the command passed to the function.

Parameters
commandThe command to be executed.
Returns
If the execution was successful.

Definition at line 67 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::findCommand ( const uint16_t &  request_id,
CommandPtr command 
)
private

Definition at line 148 of file Cola2Session.cpp.

uint16_t sick::cola2::Cola2Session::getNextRequestID ( )

Returns the next request ID. The request ID is used to match the return packages of the sensor to the right command.

Returns
A new request ID.

Definition at line 169 of file Cola2Session.cpp.

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

Returns the current session ID.

Returns
The current session ID.

Definition at line 85 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::open ( )

Opens a session with the sensor. Executes the create session command.

Returns
If opening a session was successful.

Definition at line 50 of file Cola2Session.cpp.

void sick::cola2::Cola2Session::processPacket ( const sick::datastructure::PacketBuffer packet)
private

Definition at line 95 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::removeCommand ( const uint16_t &  request_id)
private

Definition at line 158 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::sendTelegramAndListenForAnswer ( const CommandPtr command)
private

Definition at line 74 of file Cola2Session.cpp.

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

Sets the current session ID.

Parameters
session_idThe new session ID.

Definition at line 90 of file Cola2Session.cpp.

bool sick::cola2::Cola2Session::startProcessingAndRemovePendingCommandAfterwards ( const sick::datastructure::PacketBuffer packet)
private

Definition at line 125 of file Cola2Session.cpp.

Member Data Documentation

std::shared_ptr<sick::communication::AsyncTCPClient> sick::cola2::Cola2Session::m_async_tcp_client_ptr
private

Definition at line 143 of file Cola2Session.h.

boost::mutex sick::cola2::Cola2Session::m_execution_mutex
private

Definition at line 150 of file Cola2Session.h.

uint16_t sick::cola2::Cola2Session::m_last_request_id
private

Definition at line 153 of file Cola2Session.h.

std::shared_ptr<sick::data_processing::TCPPacketMerger> sick::cola2::Cola2Session::m_packet_merger_ptr
private

Definition at line 145 of file Cola2Session.h.

std::shared_ptr<sick::data_processing::ParseTCPPacket> sick::cola2::Cola2Session::m_parser_ptr
private

Definition at line 144 of file Cola2Session.h.

std::map<uint16_t, CommandPtr> sick::cola2::Cola2Session::m_pending_commands_map
private

Definition at line 148 of file Cola2Session.h.

uint32_t sick::cola2::Cola2Session::m_session_id
private

Definition at line 152 of file Cola2Session.h.

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

Definition at line 146 of file Cola2Session.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