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);
103 void handleReceive(
const boost::system::error_code& error,
const std::size_t& bytes_transferred);
111 #endif // SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCUDPCLIENT_H boost::array< uint8_t, MAXSIZE > ArrayBuffer
Typedef for an arraybuffer which can be read from the sensor.
AsyncUDPClient(PacketHandler packet_handler, boost::asio::io_service &io_service, const uint16_t &local_port=0)
Constructor of the asynchronous udp client.
An asynchronous udp client.
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
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
unsigned short get_local_port()
Returns the actual port assigned to the local machine.