Goby3 3.5.1
2026.06.04
Loading...
Searching...
No Matches
waveglider_sv2_frontseat_driver.h
Go to the documentation of this file.
1// Copyright 2017-2026:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6// Copilot <198982749+Copilot@users.noreply.github.com>
7//
8//
9// This file is part of the Goby Underwater Autonomy Project Libraries
10// ("The Goby Libraries").
11//
12// The Goby Libraries are free software: you can redistribute them and/or modify
13// them under the terms of the GNU Lesser General Public License as published by
14// the Free Software Foundation, either version 2.1 of the License, or
15// (at your option) any later version.
16//
17// The Goby Libraries are distributed in the hope that they will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Lesser General Public License for more details.
21//
22// You should have received a copy of the GNU Lesser General Public License
23// along with Goby. If not, see <http://www.gnu.org/licenses/>.
24
25#ifndef GOBY_MIDDLEWARE_FRONTSEAT_WAVEGLIDER_WAVEGLIDER_SV2_FRONTSEAT_DRIVER_H
26#define GOBY_MIDDLEWARE_FRONTSEAT_WAVEGLIDER_WAVEGLIDER_SV2_FRONTSEAT_DRIVER_H
27
28#include <cstdint>
29#include <memory>
30#include <string>
31
32#include <boost/circular_buffer.hpp>
33#include <dccl/codec.h>
34
40
41namespace google
42{
43namespace protobuf
44{
45class Message;
46} // namespace protobuf
47} // namespace google
48
49namespace goby
50{
51namespace middleware
52{
53namespace frontseat
54{
55class SV2SerialConnection;
56namespace protobuf
57{
58class Config;
59class SV2CommandFollowFixedHeading;
60class SV2RequestEnumerate;
61class SV2RequestQueuedMessage;
62class SV2RequestStatus;
63} // namespace protobuf
64
66{
67 public:
69
70 private: // virtual methods from InterfaceBase
71 void loop() override;
72
73 void send_command_to_frontseat(const protobuf::CommandRequest& command) override;
74 void send_data_to_frontseat(const protobuf::InterfaceData& data) override;
75 void send_raw_to_frontseat(const protobuf::Raw& data) override;
76 protobuf::FrontSeatState frontseat_state() const override;
77 bool frontseat_providing_data() const override;
78
79 void handle_sv2_message(const std::string& message);
80 void handle_enumeration_request(const protobuf::SV2RequestEnumerate& msg);
81 void handle_request_status(const protobuf::SV2RequestStatus& request);
82 void handle_request_queued_message(const protobuf::SV2RequestQueuedMessage& request);
83
84 void check_crc(const std::string& message, uint16_t expected);
85 void add_crc(std::string* message);
86 void encode_and_write(const google::protobuf::Message& message);
87
88 private: // internal non-virtual methods
89 void check_connection_state();
90
91 private:
92 const protobuf::WavegliderSV2Config waveglider_sv2_config_;
93
94 bool frontseat_providing_data_;
95 goby::time::SystemClock::time_point last_frontseat_data_time_;
96 protobuf::FrontSeatState frontseat_state_;
97
99 std::shared_ptr<SV2SerialConnection> serial_;
100
101 boost::circular_buffer<std::shared_ptr<protobuf::SV2CommandFollowFixedHeading>>
102 queued_messages_;
103
104 dccl::Codec dccl_;
105};
106} // namespace frontseat
107} // namespace middleware
108} // namespace goby
109
110#endif
const protobuf::Config & cfg() const
Definition interface.h:103
WavegliderSV2(const protobuf::Config &cfg)
The global namespace for the Goby project.
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::PROTOBUF_NAMESPACE_ID::MessageOptions, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
Definition dccl.h:58
std::chrono::time_point< SystemClock > time_point