Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sick::communication::AsyncUDPClient Class Reference

An asynchronous udp client. More...

#include <AsyncUDPClient.h>

Public Types

typedef boost::function< void(const sick::datastructure::PacketBuffer &)> PacketHandler
 Typedef to a reference to a function. Will be used to process the incoming packets. More...
 

Public Member Functions

 AsyncUDPClient (const PacketHandler &packet_handler, boost::asio::io_service &io_service, const uint16_t &local_port=0)
 Constructor of the asynchronous udp client. More...
 
 AsyncUDPClient (const PacketHandler &packet_handler, boost::asio::io_service &io_service, const boost::asio::ip::address_v4 host_ip, const boost::asio::ip::address_v4 multi_ip, const uint16_t &local_port=0)
 Constructor of the asynchronous udp client. More...
 
unsigned short getLocalPort ()
 Returns the actual port assigned to the local machine. More...
 
void runService ()
 Start the listening loop for the udp data packets. More...
 
virtual ~AsyncUDPClient ()
 The destructor of the asynchronous udp client. More...
 

Private Member Functions

 AsyncUDPClient (AsyncUDPClient &)
 
void handleReceive (const boost::system::error_code &error, const std::size_t &bytes_transferred)
 
void startReceive ()
 

Private Attributes

boost::asio::io_service & m_io_service
 
std::shared_ptr< boost::asio::io_service::work > m_io_work_ptr
 
PacketHandler m_packet_handler
 
datastructure::PacketBuffer::ArrayBuffer m_recv_buffer
 
boost::asio::ip::udp::endpoint m_remote_endpoint
 
std::shared_ptr< boost::asio::ip::udp::socket > m_socket_ptr
 

Detailed Description

An asynchronous udp client.

Definition at line 57 of file AsyncUDPClient.h.

Member Typedef Documentation

Typedef to a reference to a function. Will be used to process the incoming packets.

Definition at line 63 of file AsyncUDPClient.h.

Constructor & Destructor Documentation

sick::communication::AsyncUDPClient::AsyncUDPClient ( const PacketHandler packet_handler,
boost::asio::io_service &  io_service,
const uint16_t &  local_port = 0 
)

Constructor of the asynchronous udp client.

Parameters
packet_handlerFunction to handle incoming packets.
io_serviceInstance of the boost io_service.
local_portThe local port, where the udp packets will arrive.

Definition at line 40 of file AsyncUDPClient.cpp.

sick::communication::AsyncUDPClient::AsyncUDPClient ( const PacketHandler packet_handler,
boost::asio::io_service &  io_service,
const boost::asio::ip::address_v4  host_ip,
const boost::asio::ip::address_v4  multi_ip,
const uint16_t &  local_port = 0 
)

Constructor of the asynchronous udp client.

Parameters
packet_handlerFunction to handle incoming packets.
io_serviceInstance of the boost io_service.
local_portThe local port, where the udp packets will arrive.

Definition at line 60 of file AsyncUDPClient.cpp.

sick::communication::AsyncUDPClient::~AsyncUDPClient ( )
virtual

The destructor of the asynchronous udp client.

Definition at line 96 of file AsyncUDPClient.cpp.

sick::communication::AsyncUDPClient::AsyncUDPClient ( AsyncUDPClient )
private

Member Function Documentation

unsigned short sick::communication::AsyncUDPClient::getLocalPort ( )

Returns the actual port assigned to the local machine.

Returns
Local port number

Definition at line 131 of file AsyncUDPClient.cpp.

void sick::communication::AsyncUDPClient::handleReceive ( const boost::system::error_code &  error,
const std::size_t &  bytes_transferred 
)
private

Definition at line 110 of file AsyncUDPClient.cpp.

void sick::communication::AsyncUDPClient::runService ( )

Start the listening loop for the udp data packets.

Definition at line 126 of file AsyncUDPClient.cpp.

void sick::communication::AsyncUDPClient::startReceive ( )
private

Definition at line 101 of file AsyncUDPClient.cpp.

Member Data Documentation

boost::asio::io_service& sick::communication::AsyncUDPClient::m_io_service
private

Definition at line 111 of file AsyncUDPClient.h.

std::shared_ptr<boost::asio::io_service::work> sick::communication::AsyncUDPClient::m_io_work_ptr
private

Definition at line 110 of file AsyncUDPClient.h.

PacketHandler sick::communication::AsyncUDPClient::m_packet_handler
private

Definition at line 108 of file AsyncUDPClient.h.

datastructure::PacketBuffer::ArrayBuffer sick::communication::AsyncUDPClient::m_recv_buffer
private

Definition at line 106 of file AsyncUDPClient.h.

boost::asio::ip::udp::endpoint sick::communication::AsyncUDPClient::m_remote_endpoint
private

Definition at line 113 of file AsyncUDPClient.h.

std::shared_ptr<boost::asio::ip::udp::socket> sick::communication::AsyncUDPClient::m_socket_ptr
private

Definition at line 112 of file AsyncUDPClient.h.


The documentation for this class was generated from the following files:


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Fri Apr 2 2021 02:45:42