Goby3  3.1.5a
2024.05.23
iridium_driver.h
Go to the documentation of this file.
1 // Copyright 2011-2024:
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 // File authors:
6 // Toby Schneider <toby@gobysoft.org>
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_DRIVER_H
26 #define GOBY_ACOMMS_MODEMDRIVER_IRIDIUM_DRIVER_H
27 
28 #include <cstdint> // for uint32_t
29 #include <iosfwd> // for ostream
30 #include <memory> // for shared_ptr
31 
32 #include "goby/acomms/modemdriver/driver_base.h" // for ModemDriverBase
33 #include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
34 #include "goby/acomms/protobuf/iridium_driver.pb.h" // for Config, MessageT...
35 #include "goby/acomms/protobuf/modem_message.pb.h" // for ModemTransmission
36 #include "iridium_driver_fsm.h" // for IridiumDriverFSM
37 
38 namespace goby
39 {
40 namespace util
41 {
42 class TCPClient;
43 } // namespace util
44 
45 namespace acomms
46 {
48 {
49  public:
50  IridiumDriver();
51  ~IridiumDriver() override;
52  void startup(const protobuf::DriverConfig& cfg) override;
53 
54  void modem_init();
55 
56  void shutdown() override;
57  void do_work() override;
58 
61 
62  private:
63  void process_transmission(protobuf::ModemTransmission msg, bool dial);
64 
65  void receive(const protobuf::ModemTransmission& msg);
66  void send(const protobuf::ModemTransmission& msg);
67 
68  void try_serial_tx();
69  void display_state_cfg(std::ostream* os);
70 
71  void hangup();
72  void set_dtr(bool state);
73  bool query_dtr();
74 
75  const iridium::protobuf::Config& iridium_driver_cfg()
76  {
77  return driver_cfg_.GetExtension(iridium::protobuf::config);
78  };
79 
80  private:
81  protobuf::DriverConfig driver_cfg_;
83 
84  std::shared_ptr<goby::util::TCPClient> debug_client_;
85 
86  double last_triple_plus_time_{0};
87  enum
88  {
89  TRIPLE_PLUS_WAIT = 2
90  };
91 
92  protobuf::ModemTransmission rudics_mac_msg_;
93 
94  std::uint32_t next_frame_{0};
95 
96  bool running_{false};
97 };
98 } // namespace acomms
99 } // namespace goby
100 #endif
goby::acomms::protobuf::DriverConfig
Definition: driver_base.pb.h:123
goby::acomms::protobuf::ModemTransmission
Definition: modem_message.pb.h:166
goby::acomms::IridiumDriver::report
void report(goby::acomms::protobuf::ModemReport *report) override
Returns report including modem availability and signal quality (if known)
goby::acomms::IridiumDriver::~IridiumDriver
~IridiumDriver() override
goby::acomms::IridiumDriver::IridiumDriver
IridiumDriver()
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::acomms::IridiumDriver::do_work
void do_work() override
Allows the modem driver to do its work.
goby::acomms::protobuf::ModemReport
Definition: modem_message.pb.h:673
goby::acomms::IridiumDriver::shutdown
void shutdown() override
Shuts down the modem driver.
modem_message.pb.h
goby::acomms::iridium::fsm::IridiumDriverFSM
Definition: iridium_driver_fsm.h:201
driver_base.h
goby::acomms::iridium::protobuf::config
extern ::google::protobuf::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::google::protobuf::internal::MessageTypeTraits< ::goby::acomms::iridium::protobuf::Config >, 11, false > config
Definition: iridium_driver.pb.h:1512
driver_base.pb.h
iridium_driver_fsm.h
goby::acomms::iridium::protobuf::Config
Definition: iridium_driver.pb.h:327
goby::acomms::IridiumDriver
Definition: iridium_driver.h:47
goby::msg
extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, ::google::protobuf::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
Definition: option_extensions.pb.h:1327
goby::acomms::IridiumDriver::startup
void startup(const protobuf::DriverConfig &cfg) override
Starts the modem driver. Must be called before poll().
goby::acomms::IridiumDriver::handle_initiate_transmission
void handle_initiate_transmission(const protobuf::ModemTransmission &m) override
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
iridium_driver.pb.h
goby::acomms::IridiumDriver::modem_init
void modem_init()
goby::acomms::ModemDriverBase
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition: driver_base.h:58