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. | |
Public Member Functions | |
bool | close () |
Closes a session with the sensor. Executes the close session command. | |
Cola2Session (const std::shared_ptr< communication::AsyncTCPClient > &async_tcp_client) | |
Constructor of the cola2 session. | |
void | doDisconnect () |
Triggers the disconnection of the tcp socket. | |
bool | executeCommand (const CommandPtr &command) |
Executes the command passed to the function. | |
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. | |
uint32_t | getSessionID () const |
Returns the current session ID. | |
bool | open () |
Opens a session with the sensor. Executes the create session command. | |
void | setSessionID (const uint32_t &session_id) |
Sets the current session ID. | |
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.
sick::cola2::Cola2Session::Cola2Session | ( | const std::shared_ptr< communication::AsyncTCPClient > & | async_tcp_client | ) | [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.
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.
Definition at line 56 of file Cola2Session.cpp.
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.
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.
Definition at line 169 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.
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.
session_id | The 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.
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.