Goby3
3.1.5a
2024.05.23
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
30
#include "
goby/middleware/frontseat/interface.h
"
31
#include "
goby/middleware/frontseat/simulator/basic/basic_simulator_frontseat_driver_config.pb.h
"
32
#include "
goby/middleware/protobuf/frontseat.pb.h
"
33
#include "
goby/time/system_clock.h
"
34
#include "
goby/util/linebasedcomms/tcp_client.h
"
35
36
namespace
goby
37
{
38
namespace
middleware
39
{
40
namespace
frontseat
41
{
42
namespace
protobuf
43
{
44
class
Config;
45
}
// namespace protobuf
46
}
// namespace frontseat
47
}
// namespace middleware
48
}
// namespace goby
49
50
extern
"C"
51
{
52
goby::middleware::frontseat::InterfaceBase
*
53
frontseat_driver_load
(
goby::middleware::frontseat::protobuf::Config
* cfg);
54
}
55
56
namespace
goby
57
{
58
namespace
middleware
59
{
60
namespace
frontseat
61
{
62
class
BasicSimulatorFrontSeatInterface
:
public
InterfaceBase
63
{
64
public
:
65
BasicSimulatorFrontSeatInterface
(
const
protobuf::Config
&
cfg
);
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
:
86
const
protobuf::BasicSimulatorFrontSeatConfig
sim_config_;
87
goby::util::TCPClient
tcp_;
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
basic_simulator_frontseat_driver_config.pb.h
system_clock.h
goby::middleware::frontseat::protobuf::FrontSeatState
FrontSeatState
Definition:
frontseat.pb.h:136
goby
The global namespace for the Goby project.
Definition:
acomms_constants.h:33
tcp_client.h
goby::middleware::frontseat::BasicSimulatorFrontSeatInterface
Definition:
basic_simulator_frontseat_driver.h:62
frontseat.pb.h
goby::middleware::frontseat::InterfaceBase
Definition:
interface.h:59
goby::middleware::frontseat::BasicSimulatorFrontSeatInterface::BasicSimulatorFrontSeatInterface
BasicSimulatorFrontSeatInterface(const protobuf::Config &cfg)
goby::middleware::frontseat::protobuf::InterfaceData
Definition:
frontseat.pb.h:795
goby::middleware::frontseat::protobuf::Config
Definition:
frontseat_config.pb.h:81
goby::middleware::frontseat::InterfaceBase::cfg
const protobuf::Config & cfg() const
Definition:
interface.h:103
goby::time::SystemClock::time_point
std::chrono::time_point< SystemClock > time_point
Definition:
system_clock.h:55
goby::middleware::frontseat::protobuf::CommandRequest
Definition:
frontseat.pb.h:488
interface.h
frontseat_driver_load
goby::middleware::frontseat::InterfaceBase * frontseat_driver_load(goby::middleware::frontseat::protobuf::Config *cfg)
goby::middleware::frontseat::protobuf::BasicSimulatorFrontSeatConfig
Definition:
basic_simulator_frontseat_driver_config.pb.h:383
goby::util::TCPClient
provides a basic TCP client for line by line text based communications to a remote TCP server
Definition:
tcp_client.h:43
goby::middleware::frontseat::protobuf::Raw
Definition:
frontseat.pb.h:950
goby
middleware
frontseat
simulator
basic
basic_simulator_frontseat_driver.h
Generated by
1.8.17