Class UDPClient
Defined in File UDPClient.h
Class Documentation
-
class UDPClient
A UDP client allowing for synchronous and asynchronous receiving of sensor data.
Public Functions
-
UDPClient(boost::asio::io_service &io_service, sick::types::port_t server_port)
Constructor of a UDPClient object.
- Parameters:
io_service – Instance of the boost::asio io_service
server_port – The local port number on the receiver (this client’s) side.
-
UDPClient(boost::asio::io_service &io_service, sick::types::port_t server_port, boost::asio::ip::address_v4 host_ip, boost::asio::ip::address_v4 interface_ip)
Constructor of a UDPClient object.
- Parameters:
io_service – Instance of the boost::asio io_service
server_port – The local port number on the receiver (this client’s) side.
host_ip – The multicast ip to enable the multicast registration.
interface_ip – The used host (client’s) interface IP which is needed to join the multicast group.
-
UDPClient() = delete
-
template<typename Callable>
inline void run(Callable &&callback) Asynchronous function to subscribe to the sensor data stream.
param Callable
- Parameters:
callback – A callback of variable templated type Callable to support various formats like std::function.
-
void stop()
Stops the currently running asynchronous sensor data stream subscribers.
-
sick::types::port_t getLocalPort() const
Returns the actual port assigned to the local client.
- Returns:
-
bool isConnected() const
Indicates whether the UDP ports are still opened.
- Returns:
true
- Returns:
false
-
bool isDataAvailable() const
Indicates available data in the receiving buffer.
- Returns:
true
- Returns:
false
-
sick::datastructure::PacketBuffer receive(sick::types::time_duration_t timeout)
A synchronous function to receive data. This operation is blocking unless the timeout has been exceeded.
- Parameters:
timeout – Timeout on receiving operation.
- Returns:
-
UDPClient(boost::asio::io_service &io_service, sick::types::port_t server_port)