17#ifndef STAUBLI_ROBOT_DRIVER__COMMUNICATION__UDP_SOCKET_HPP_
18#define STAUBLI_ROBOT_DRIVER__COMMUNICATION__UDP_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;
60 bool send(std::vector<uint8_t>& data)
override;
62 bool receive_once(
int timeout_ms, std::vector<uint8_t>& data)
override;
66 std::vector<uint8_t>& ,
67 size_t )> reception_callback)
override;
74 std::unique_ptr<UDPSocketImpl> impl_;
86 static std::shared_ptr<Socket>
create();
Abstract interface for communication with the robot.
Definition socket.hpp:38
Factory implementation for UDP communication.
Definition udp_socket.hpp:80
static std::shared_ptr< Socket > create()
Create a UDP communication interface.
Class for handling bidirectional UDP communication.
Definition udp_socket.hpp:39
bool send(std::vector< uint8_t > &data) override
Send data to the remote endpoint.
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 receive_once(int timeout_ms, std::vector< uint8_t > &data) override
Receive data from socket (blocking with timeout)
bool stop_receive_thread() override
Stop the receive thread.
bool is_receiving() const override
Check if the receive thread is running.
bool connect(const std::string &remote_address, uint16_t remote_port, uint16_t local_port) override
Connect to the remote endpoint.
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 is_connected() const override
Check if the connection is established.
Definition messages.hpp:23