Goby v2
abc_frontseat_driver.h
1 // Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 //
5 //
6 // This file is part of the Goby Underwater Autonomy Project Binaries
7 // ("The Goby Binaries").
8 //
9 // The Goby Binaries are free software: you can redistribute them and/or modify
10 // them under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // The Goby Binaries are distributed in the hope that they will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef AbcFrontSeat20130220H
23 #define AbcFrontSeat20130220H
24 
25 #include <boost/bimap.hpp>
26 
27 #include "goby/util/linebasedcomms/tcp_client.h"
28 
29 #include "goby/moos/frontseat/frontseat.h"
30 
31 #include "abc_frontseat_driver_config.pb.h"
32 
33 extern "C"
34 {
35  FrontSeatInterfaceBase* frontseat_driver_load(iFrontSeatConfig*);
36 }
37 
39 {
40  public:
41  AbcFrontSeat(const iFrontSeatConfig& cfg);
42 
43  private: // virtual methods from FrontSeatInterfaceBase
44  void loop();
45 
46  void send_command_to_frontseat(const goby::moos::protobuf::CommandRequest& command);
47  void send_data_to_frontseat(const goby::moos::protobuf::FrontSeatInterfaceData& data);
48  void send_raw_to_frontseat(const goby::moos::protobuf::FrontSeatRaw& data);
49  goby::moos::protobuf::FrontSeatState frontseat_state() const;
50  bool frontseat_providing_data() const;
51 
52  private: // internal non-virtual methods
53  void check_connection_state();
54 
55  void try_receive();
56  void process_receive(const std::string& s);
57  void parse_in(const std::string& in, std::map<std::string, std::string>* out);
58 
59  void write(const std::string& s);
60 
61  private:
62  const ABCFrontSeatConfig abc_config_;
64 
65  bool frontseat_providing_data_;
66  double last_frontseat_data_time_;
67  goby::moos::protobuf::FrontSeatState frontseat_state_;
68 
70 };
71 
72 #endif
provides a basic TCP client for line by line text based communications to a remote TCP server ...
Definition: tcp_client.h:34