Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
basic_simulator_frontseat_driver.h
Go to the documentation of this file.
1// Copyright 2020-2021:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Goby Underwater Autonomy Project Libraries
9// ("The Goby Libraries").
10//
11// The Goby Libraries are free software: you can redistribute them and/or modify
12// them under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// The Goby Libraries are distributed in the hope that they will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with Goby. If not, see <http://www.gnu.org/licenses/>.
23
24#ifndef GOBY_MIDDLEWARE_FRONTSEAT_SIMULATOR_BASIC_BASIC_SIMULATOR_FRONTSEAT_DRIVER_H
25#define GOBY_MIDDLEWARE_FRONTSEAT_SIMULATOR_BASIC_BASIC_SIMULATOR_FRONTSEAT_DRIVER_H
26
27#include <map>
28#include <string>
29
35
36namespace goby
37{
38namespace middleware
39{
40namespace frontseat
41{
42namespace protobuf
43{
44class Config;
45} // namespace protobuf
46} // namespace frontseat
47} // namespace middleware
48} // namespace goby
49
50extern "C"
51{
54}
55
56namespace goby
57{
58namespace middleware
59{
60namespace frontseat
61{
63{
64 public:
66
67 private: // virtual methods from FrontSeatInterfaceBase
68 void loop() override;
69
70 void send_command_to_frontseat(const protobuf::CommandRequest& command) override;
71 void send_data_to_frontseat(const protobuf::InterfaceData& data) override;
72 void send_raw_to_frontseat(const protobuf::Raw& data) override;
73 protobuf::FrontSeatState frontseat_state() const override;
74 bool frontseat_providing_data() const override;
75
76 private: // internal non-virtual methods
77 void check_connection_state();
78
79 void try_receive();
80 void process_receive(const std::string& s);
81 void parse_in(const std::string& in, std::map<std::string, std::string>* out);
82
83 void write(const std::string& s);
84
85 private:
88
89 bool frontseat_providing_data_;
90 goby::time::SystemClock::time_point last_frontseat_data_time_;
91 protobuf::FrontSeatState frontseat_state_;
92
93 protobuf::CommandRequest last_request_;
94};
95} // namespace frontseat
96} // namespace middleware
97} // namespace goby
98
99#endif
goby::middleware::frontseat::InterfaceBase * frontseat_driver_load(goby::middleware::frontseat::protobuf::Config *cfg)
const protobuf::Config & cfg() const
Definition interface.h:104
provides a basic TCP client for line by line text based communications to a remote TCP server
Definition tcp_client.h:44
The global namespace for the Goby project.
std::chrono::time_point< SystemClock > time_point