Goby3 3.5.1
2026.06.04
Loading...
Searching...
No Matches
iridium_shore_driver.h
Go to the documentation of this file.
1// Copyright 2015-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_ACOMMS_MODEMDRIVER_IRIDIUM_SHORE_DRIVER_H
26#define GOBY_ACOMMS_MODEMDRIVER_IRIDIUM_SHORE_DRIVER_H
27
28#include <cstdint> // for uint32_t
29#include <map> // for map
30#include <memory> // for shared_ptr
31#include <string> // for string
32
33#include <boost/bimap.hpp>
34#include <boost/circular_buffer.hpp> // for circular_b...
35
36#include "goby/acomms/modemdriver/driver_base.h" // for ModemDrive...
37#include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
38#include "goby/acomms/protobuf/iridium_driver.pb.h" // for MessageTyp...
39#include "goby/acomms/protobuf/iridium_shore_driver.pb.h" // for ShoreConfig
40#include "goby/acomms/protobuf/modem_message.pb.h" // for ModemTrans...
42
43namespace goby
44{
45namespace acomms
46{
47class OnCallBase;
48class RUDICSConnection;
49class RUDICSServer;
50namespace directip
51{
52class SBDServer;
53} // namespace directip
54namespace iridium
55{
56namespace protobuf
57{
61} // namespace protobuf
62} // namespace iridium
63
65{
66 public:
69 void startup(const protobuf::DriverConfig& cfg) override;
70
71 void modem_init();
72
73 void shutdown() override;
74 void do_work() override;
75
78
79 private:
80 typedef unsigned ModemId;
81
82 void receive(const protobuf::ModemTransmission& msg);
83 void send(const protobuf::ModemTransmission& msg);
84
85 void decode_mo(iridium::protobuf::DirectIPMOPreHeader* pre_header,
87 iridium::protobuf::DirectIPMOPayload* body, const std::string& data);
88
89 void receive_sbd_mo();
90 void receive_sbd_mo_data(const std::string& data, protobuf::ModemTransmission* modem_msg);
91
92 void send_sbd_mt(const std::string& bytes, const std::string& imei);
93
94 void rudics_send(const std::string& data, ModemId id);
95 void rudics_disconnect(const std::shared_ptr<RUDICSConnection>& connection);
96 void rudics_line(const std::string& line, const std::shared_ptr<RUDICSConnection>& connection);
97 void rudics_connect(const std::shared_ptr<RUDICSConnection>& connection);
98
99 const iridium::protobuf::Config& iridium_driver_cfg() const
100 {
101 return driver_cfg_.GetExtension(iridium::protobuf::config);
102 }
103
104 const iridium::protobuf::ShoreConfig& iridium_shore_driver_cfg() const
105 {
107 }
108
109 // in iridium_shore_driver_sbd_directip.cpp
110 void startup_sbd_directip(const protobuf::DriverConfig& cfg);
111 void receive_sbd_mo_directip();
112 void send_sbd_mt_directip(const std::string& bytes, const std::string& imei);
113
114 // in iridium_shore_driver_sbd_rockblock.cpp
115 void startup_sbd_rockblock(const protobuf::DriverConfig& cfg);
116 void receive_sbd_mo_rockblock();
117 void send_sbd_mt_rockblock(const std::string& bytes, const std::string& imei);
118
119 private:
120 protobuf::DriverConfig driver_cfg_;
121
122 protobuf::ModemTransmission rudics_mac_msg_;
123
124 std::uint32_t next_frame_{0};
125
126 struct RemoteNode
127 {
128 enum
129 {
130 DATA_BUFFER_CAPACITY = 30
131 };
132 RemoteNode() : data_out(DATA_BUFFER_CAPACITY) {}
133
134 std::shared_ptr<OnCallBase> on_call;
135 boost::circular_buffer<protobuf::ModemTransmission> data_out;
136 };
137
138 std::map<ModemId, RemoteNode> remote_;
139
140 std::unique_ptr<boost::asio::io_context> rudics_io_;
141 std::unique_ptr<RUDICSServer> rudics_server_;
142 std::unique_ptr<boost::asio::io_context> sbd_io_;
143 std::unique_ptr<directip::SBDServer> directip_mo_sbd_server_;
144
145 // maps remote modem to connection
146 boost::bimap<ModemId, std::shared_ptr<RUDICSConnection>> clients_;
147
148 using IMEI = std::string;
149 std::map<ModemId, IMEI> modem_id_to_imei_;
150
151 struct RockblockHTTPMessage
152 {
153 enum class MessageState
154 {
155 HEADER,
156 BODY,
157 COMPLETE
158 };
159 MessageState state{MessageState::HEADER};
160 std::map<std::string, std::string> header;
161 std::string body;
162 };
163
164 std::unique_ptr<RockblockHTTPMessage> rb_msg_;
165};
166} // namespace acomms
167} // namespace goby
168#endif
void startup(const protobuf::DriverConfig &cfg) override
Starts the modem driver. Must be called before poll().
void do_work() override
Allows the modem driver to do its work.
void process_transmission(protobuf::ModemTransmission msg)
void handle_initiate_transmission(const protobuf::ModemTransmission &m) override
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
void shutdown() override
Shuts down the modem driver.
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition driver_base.h:58
_proto_TypeTraits::Singular::ConstType GetExtension(const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< DriverConfig, _proto_TypeTraits, _field_type, _is_packed > &id) const
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::acomms::iridium::protobuf::ShoreConfig >, 11, false > shore_config
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::acomms::iridium::protobuf::Config >, 11, false > config
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