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_command_map_mutex
 
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

◆ CommandPtr

Typedef for a pointer containing a command to be executed.

Definition at line 78 of file Cola2Session.h.

Constructor & Destructor Documentation

◆ Cola2Session()

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

◆ addCommand()

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

Definition at line 141 of file Cola2Session.cpp.

◆ addPacketToMerger()

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

Definition at line 107 of file Cola2Session.cpp.

◆ checkIfPacketIsCompleteAndOtherwiseListenForMorePackets()

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

Definition at line 117 of file Cola2Session.cpp.

◆ close()

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.

◆ doDisconnect()

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

Triggers the disconnection of the tcp socket.

Definition at line 62 of file Cola2Session.cpp.

◆ executeCommand()

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.

◆ findCommand()

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

Definition at line 153 of file Cola2Session.cpp.

◆ getNextRequestID()

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 178 of file Cola2Session.cpp.

◆ getSessionID()

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.

◆ open()

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.

◆ processPacket()

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

Definition at line 95 of file Cola2Session.cpp.

◆ removeCommand()

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

Definition at line 165 of file Cola2Session.cpp.

◆ sendTelegramAndListenForAnswer()

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

Definition at line 74 of file Cola2Session.cpp.

◆ setSessionID()

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.

◆ startProcessingAndRemovePendingCommandAfterwards()

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

Definition at line 128 of file Cola2Session.cpp.

Member Data Documentation

◆ m_async_tcp_client_ptr

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

Definition at line 143 of file Cola2Session.h.

◆ m_command_map_mutex

boost::mutex sick::cola2::Cola2Session::m_command_map_mutex
private

Definition at line 150 of file Cola2Session.h.

◆ m_execution_mutex

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

Definition at line 151 of file Cola2Session.h.

◆ m_last_request_id

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

Definition at line 154 of file Cola2Session.h.

◆ m_packet_merger_ptr

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

Definition at line 145 of file Cola2Session.h.

◆ m_parser_ptr

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

Definition at line 144 of file Cola2Session.h.

◆ m_pending_commands_map

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

Definition at line 148 of file Cola2Session.h.

◆ m_session_id

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

Definition at line 153 of file Cola2Session.h.

◆ m_tcp_parser_ptr

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 Fri Jun 21 2024 02:40:51