Go to the documentation of this file.
35 #ifndef SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCTCPCLIENT_H
36 #define SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCTCPCLIENT_H
44 #include <boost/array.hpp>
45 #include <boost/asio.hpp>
46 #include <boost/cstdint.hpp>
47 #include <boost/function.hpp>
48 #include <boost/thread/condition.hpp>
49 #include <boost/thread/mutex.hpp>
54 namespace communication {
80 boost::asio::io_service& io_service,
81 const boost::asio::ip::address_v4& server_ip,
82 const uint16_t& server_port);
134 void handleReceive(
const boost::system::error_code& error,
const std::size_t& bytes_transferred);
140 const std::size_t& bytes_transferred);
145 #endif // SICK_SAFETYSCANNERS_COMMUNICATION_ASYNCTCPCLIENT_H
boost::condition m_connect_condition
void handleSendAndReceive(const boost::system::error_code &error, const std::size_t &bytes_transferred)
PacketHandler m_packet_handler
std::shared_ptr< boost::asio::io_service::work > m_io_work_ptr
boost::array< uint8_t, MAXSIZE > ArrayBuffer
Typedef for an arraybuffer which can be read from the sensor.
virtual ~AsyncTCPClient()
The destructor of the asynchronous tcp client.
boost::asio::ip::tcp::endpoint m_remote_endpoint
void doConnect()
Establishes a connection from the host to the sensor.
void initiateReceive()
Initiates the listening for a message from the server.
void setPacketHandler(const PacketHandler &packet_handler)
Sets the packet handler function.
datastructure::PacketBuffer::ArrayBuffer m_recv_buffer
AsyncTCPClient(const PacketHandler &packet_handler, boost::asio::io_service &io_service, const boost::asio::ip::address_v4 &server_ip, const uint16_t &server_port)
Constructor of the asynchronous tcp client.
A asynchronous tcp client.
boost::mutex m_connect_mutex
std::thread m_service_thread
A packetbuffer for the raw data from the sensor.
void doDisconnect()
Disconnects the host from the sensor.
boost::function< void(const sick::datastructure::PacketBuffer &)> PacketHandler
Typedef to a function referencing a packet handler. This can be passed to the class and therefore be ...
void doSendAndReceive(const std::vector< uint8_t > &sendBuffer)
Start a cycle of sensing a command and waiting got the return.
std::shared_ptr< boost::asio::ip::tcp::socket > m_socket_ptr
boost::asio::io_service & m_io_service
void handleReceive(const boost::system::error_code &error, const std::size_t &bytes_transferred)
boost::mutex m_socket_mutex