17#ifndef STAUBLI_ROBOT_DRIVER__COMMUNICATION__TCP_SOCKET_HPP_
18#define STAUBLI_ROBOT_DRIVER__COMMUNICATION__TCP_SOCKET_HPP_
27#include <condition_variable>
46 const std::string& remote_address,
48 uint16_t local_port)
override;
51 const std::string& remote_address,
53 const std::string& local_address,
54 uint16_t local_port)
override;
57 const std::string& remote_address,
66 bool send(std::vector<uint8_t>& data)
override;
68 bool receive_once(
int timeout_ms, std::vector<uint8_t>& data)
override;
72 std::vector<uint8_t>& ,
73 size_t )> reception_callback)
override;
80 std::unique_ptr<TCPSocketImpl> impl_;
92 static std::shared_ptr<Socket>
create();
Abstract interface for communication with the robot.
Definition socket.hpp:38
Factory implementation for TCP communication.
Definition tcp_socket.hpp:86
static std::shared_ptr< Socket > create()
Create a TCP communication interface.
Class for handling bidirectional TCP communication.
Definition tcp_socket.hpp:39
bool send(std::vector< uint8_t > &data) override
Send data to the remote endpoint.
bool connect(const std::string &remote_address, uint16_t remote_port, uint16_t local_port, int timeout_ms)
bool is_receiving() const override
Check if the receive thread is running.
bool is_connected() const override
Check if the connection is established.
bool start_receive_thread(std::function< void(std::vector< uint8_t > &, size_t)> reception_callback) override
Start a receive thread that calls the provided reception_callback when data is received.
bool stop_receive_thread() override
Stop the receive thread.
bool disconnect() override
Disconnect from the remote endpoint.
bool connect(const std::string &remote_address, uint16_t remote_port, const std::string &local_address, uint16_t local_port) override
Connect to the remote endpoint with specific local address.
bool connect(const std::string &remote_address, uint16_t remote_port, uint16_t local_port) override
Connect to the remote endpoint.
bool receive_once(int timeout_ms, std::vector< uint8_t > &data) override
Receive data from socket (blocking with timeout)
Definition messages.hpp:23