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::Command > | CommandPtr |
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::AsyncTCPClient > | m_async_tcp_client_ptr |
boost::mutex | m_execution_mutex |
uint16_t | m_last_request_id |
std::shared_ptr< sick::data_processing::TCPPacketMerger > | m_packet_merger_ptr |
std::shared_ptr< sick::data_processing::ParseTCPPacket > | m_parser_ptr |
std::map< uint16_t, CommandPtr > | m_pending_commands_map |
uint32_t | m_session_id |
std::shared_ptr< sick::data_processing::ParseTCPPacket > | m_tcp_parser_ptr |
Establishes a cola2 session with a sensor and enables execution of commands in this session.
Definition at line 72 of file Cola2Session.h.
typedef std::shared_ptr<sick::cola2::Command> sick::cola2::Cola2Session::CommandPtr |
Typedef for a pointer containing a command to be executed.
Definition at line 78 of file Cola2Session.h.
|
explicit |
Constructor of the cola2 session.
async_tcp_client | Pointer 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.
|
private |
Definition at line 141 of file Cola2Session.cpp.
|
private |
Definition at line 107 of file Cola2Session.cpp.
|
private |
Definition at line 117 of file Cola2Session.cpp.
bool sick::cola2::Cola2Session::close | ( | ) |
Closes a session with the sensor. Executes the close session command.
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.
command | The command to be executed. |
Definition at line 67 of file Cola2Session.cpp.
|
private |
Definition at line 151 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.
Definition at line 172 of file Cola2Session.cpp.
uint32_t sick::cola2::Cola2Session::getSessionID | ( | ) | const |
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.
Definition at line 50 of file Cola2Session.cpp.
|
private |
Definition at line 95 of file Cola2Session.cpp.
|
private |
Definition at line 161 of file Cola2Session.cpp.
|
private |
Definition at line 74 of file Cola2Session.cpp.
void sick::cola2::Cola2Session::setSessionID | ( | const uint32_t & | session_id | ) |
Sets the current session ID.
session_id | The new session ID. |
Definition at line 90 of file Cola2Session.cpp.
|
private |
Definition at line 128 of file Cola2Session.cpp.
|
private |
Definition at line 143 of file Cola2Session.h.
|
private |
Definition at line 150 of file Cola2Session.h.
|
private |
Definition at line 153 of file Cola2Session.h.
|
private |
Definition at line 145 of file Cola2Session.h.
|
private |
Definition at line 144 of file Cola2Session.h.
|
private |
Definition at line 148 of file Cola2Session.h.
|
private |
Definition at line 152 of file Cola2Session.h.
|
private |
Definition at line 146 of file Cola2Session.h.