35 #ifndef SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCUDPCLIENT_H 36 #define SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCUDPCLIENT_H 43 #include <boost/array.hpp> 44 #include <boost/asio.hpp> 45 #include <boost/cstdint.hpp> 46 #include <boost/function.hpp> 52 namespace communication {
63 typedef boost::function<void(const sick::datastructure::PacketBuffer&)>
PacketHandler;
73 boost::asio::io_service& io_service,
74 const uint16_t& local_port = 0);
84 boost::asio::io_service& io_service,
85 const boost::asio::ip::address_v4 host_ip,
86 const boost::asio::ip::address_v4 multi_ip,
87 const uint16_t& local_port = 0);
116 void handleReceive(
const boost::system::error_code& error,
const std::size_t& bytes_transferred);
124 #endif // SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCUDPCLIENT_H boost::array< uint8_t, MAXSIZE > ArrayBuffer
Typedef for an arraybuffer which can be read from the sensor.
An asynchronous udp client.
unsigned short getLocalPort()
Returns the actual port assigned to the local machine.
void handleReceive(const boost::system::error_code &error, const std::size_t &bytes_transferred)
boost::asio::ip::udp::endpoint m_remote_endpoint
void runService()
Start the listening loop for the udp data packets.
PacketHandler m_packet_handler
std::shared_ptr< boost::asio::ip::udp::socket > m_socket_ptr
boost::asio::io_service & m_io_service
AsyncUDPClient(const PacketHandler &packet_handler, boost::asio::io_service &io_service, const uint16_t &local_port=0)
Constructor of the asynchronous udp client.
datastructure::PacketBuffer::ArrayBuffer m_recv_buffer
boost::function< void(const sick::datastructure::PacketBuffer &)> PacketHandler
Typedef to a reference to a function. Will be used to process the incoming packets.
virtual ~AsyncUDPClient()
The destructor of the asynchronous udp client.
std::shared_ptr< boost::asio::io_service::work > m_io_work_ptr