snark
sensors/sick/protocol.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_SENSORS_SICK_PROTOCOL_H_
20 #define SNARK_SENSORS_SICK_PROTOCOL_H_
21 
25 
26 #include <iostream>
27 #include <string>
28 #include <boost/noncopyable.hpp>
29 #include <boost/optional.hpp>
31 
32 namespace snark { namespace sick { namespace ldmrs {
33 
34 class protocol : public boost::noncopyable
35 {
36  public:
38  protocol( std::iostream& stream );
39 
41  protocol( std::istream& stream );
42 
44  ~protocol();
45 
47  void reset_dsp();
48 
50  template < typename command > typename command::response write( const command& c );
51 
54  const scan_packet* readscan();
55 
57  boost::optional< fault > last_fault();
58 
60  struct faultException : public std::exception {};
61 
62  private:
63  class impl;
64  impl* m_pimpl;
65 };
66 
67 } } } // namespace snark { namespace sick { namespace ldmrs {
68 
69 #endif // #ifndef SNARK_SENSORS_SICK_PROTOCOL_H_