Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
store_server_driver.h
Go to the documentation of this file.
1// Copyright 2024:
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_ACOMMS_MODEMDRIVER_STORE_SERVER_DRIVER_H
25#define GOBY_ACOMMS_MODEMDRIVER_STORE_SERVER_DRIVER_H
26
28
33
34namespace goby
35{
36namespace acomms
37{
39{
40 public:
43 void shutdown();
44 void do_work();
46
47 constexpr static const char* eol{"\r"};
48 constexpr static int default_port{11244};
49
50 template <typename StoreServerMessage>
51 static void parse_store_server_message(const std::string& bytes, StoreServerMessage* msg)
52 {
53 std::string pb_encoded;
54 goby::acomms::parse_rudics_packet(&pb_encoded, bytes, std::string(eol));
55 msg->ParseFromString(pb_encoded);
56 }
57
58 template <typename StoreServerMessage>
59 static void serialize_store_server_message(const StoreServerMessage& msg, std::string* bytes)
60 {
61 std::string pb_encoded;
62 msg.SerializeToString(&pb_encoded);
63 goby::acomms::serialize_rudics_packet(pb_encoded, bytes, std::string(eol));
64 }
65
66 private:
67 void handle_response(const protobuf::StoreServerResponse& response);
68
69 private:
70 protobuf::DriverConfig driver_cfg_;
71 store_server::protobuf::Config store_server_driver_cfg_;
73 std::uint64_t last_send_time_;
74 double query_interval_seconds_;
75 double reset_interval_seconds_;
76 bool waiting_for_reply_;
77 std::uint32_t next_frame_;
78};
79} // namespace acomms
80} // namespace goby
81#endif
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition driver_base.h:59
void startup(const protobuf::DriverConfig &cfg)
Starts the modem driver. Must be called before poll().
static constexpr const char * eol
static void serialize_store_server_message(const StoreServerMessage &msg, std::string *bytes)
void shutdown()
Shuts down the modem driver.
void do_work()
Allows the modem driver to do its work.
static void parse_store_server_message(const std::string &bytes, StoreServerMessage *msg)
void handle_initiate_transmission(const protobuf::ModemTransmission &m)
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
void parse_rudics_packet(std::string *bytes, std::string rudics_pkt, const std::string &reserved=std::string("\0\r\n", 3)+std::string(1, 0xff), bool include_crc=true)
void serialize_rudics_packet(std::string bytes, std::string *rudics_pkt, const std::string &reserved=std::string("\0\r\n", 3)+std::string(1, 0xff), bool include_crc=true)
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