Fawkes API Fawkes Development Version
sick_tim55x_ethernet_aqt.h
1
2/***************************************************************************
3 * sick_tim55x_ethernet_aqt.h - Retrieve data from Sick TiM 55x via Ethernet
4 *
5 * Created: Sun Jun 15 20:44:32 2014
6 * Copyright 2008-2014 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_LASER_SICK_TIM55X_ETHERNET_AQT_H_
24#define _PLUGINS_LASER_SICK_TIM55X_ETHERNET_AQT_H_
25
26#include "sick_tim55x_common_aqt.h"
27
28#include <boost/asio.hpp>
29#include <string>
30
31namespace fawkes {
32class Mutex;
33}
34
36{
37public:
38 SickTiM55xEthernetAcquisitionThread(std::string &cfg_name, std::string &cfg_prefix);
39
40 virtual void init();
41 virtual void finalize();
42 virtual void loop();
43
44private:
45 void open_device();
46 void close_device();
47 void flush_device();
48 void send_with_reply(const char *request, std::string *reply = NULL);
49
50 void check_deadline();
51 void check_soft_timeout();
52
53#if BOOST_VERSION < 104800
54 void
55 handle_read(boost::system::error_code ec, size_t bytes_read)
56 {
57 ec_ = ec;
58 bytes_read_ = bytes_read;
59 }
60#endif
61
62private:
63 std::string cfg_host_;
64 std::string cfg_port_;
65
66 fawkes::Mutex *socket_mutex_;
67
68 boost::asio::io_service io_service_;
69 boost::asio::ip::tcp::socket socket_;
70 boost::asio::deadline_timer deadline_;
71 boost::asio::deadline_timer soft_deadline_;
72 boost::asio::streambuf input_buffer_;
73
74 boost::system::error_code ec_;
75 size_t bytes_read_;
76};
77
78#endif
Laser acqusition thread for Sick TiM55x laser range finders.
Laser acqusition thread for Sick TiM55x laser range finders.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
SickTiM55xEthernetAcquisitionThread(std::string &cfg_name, std::string &cfg_prefix)
Constructor.
Mutex mutual exclusion lock.
Definition: mutex.h:33
Fawkes library namespace.