Goby3  3.1.5a
2024.05.23
moos_bluefin_driver.h
Go to the documentation of this file.
1 // Copyright 2011-2021:
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_MOOS_MOOS_BLUEFIN_DRIVER_H
26 #define GOBY_MOOS_MOOS_BLUEFIN_DRIVER_H
27 
28 #include <map> // for map
29 #include <string> // for string
30 
31 #include <MOOS/libMOOS/Comms/MOOSCommClient.h> // for CMOOSCommClient
32 #include <boost/bimap.hpp> // for bimap
33 
34 #include "goby/acomms/modemdriver/driver_base.h" // for ModemDriverBase
35 #include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
36 #include "goby/acomms/protobuf/modem_message.pb.h" // for ModemTransmission
37 #include "goby/moos/protobuf/bluefin_driver.pb.h" // for Config
38 
39 namespace goby
40 {
41 namespace acomms
42 {
43 class MACManager;
44 } // namespace acomms
45 namespace util
46 {
47 class NMEASentence;
48 } // namespace util
49 
50 namespace moos
51 {
56 {
57  public:
59  void startup(const goby::acomms::protobuf::DriverConfig& cfg) override;
60  void shutdown() override;
61  void do_work() override;
63 
64  private:
65  std::string unix_time2nmea_time(double time);
66  void bfcma(const goby::util::NMEASentence& nmea);
67  void bfcps(const goby::util::NMEASentence& nmea);
68  void bfcpr(const goby::util::NMEASentence& nmea);
69 
70  private:
71  CMOOSCommClient moos_client_;
72  goby::acomms::protobuf::DriverConfig driver_cfg_; // configuration given to you at launch
73  goby::moos::bluefin::protobuf::Config bluefin_driver_cfg_;
74 
75  std::string current_modem_;
76  double end_of_mac_window_;
77 
78  // modem name to map of rate to bytes
79  std::map<std::string, std::map<int, int> > modem_to_rate_to_bytes_;
80 
81  // maps goby modem id to bluefin modem id
82  boost::bimap<int, int> goby_to_bluefin_id_;
83 
85 
86  int last_request_id_;
88 };
89 } // namespace moos
90 } // namespace goby
91 
92 #endif
goby::acomms::protobuf::DriverConfig
Definition: driver_base.pb.h:123
goby::acomms::protobuf::ModemTransmission
Definition: modem_message.pb.h:166
goby::moos::BluefinCommsDriver
provides a driver for the Bluefin Huxley communications infrastructure (initially uses SonarDyne as u...
Definition: moos_bluefin_driver.h:55
goby::moos::bluefin::protobuf::Config
Definition: bluefin_driver.pb.h:357
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
modem_message.pb.h
goby::moos::BluefinCommsDriver::shutdown
void shutdown() override
Shuts down the modem driver.
goby::acomms::MACManager
provides an API to the goby-acomms MAC library. MACManager is essentially a std::list<protobuf::Modem...
Definition: mac_manager.h:50
driver_base.h
goby::moos::BluefinCommsDriver::startup
void startup(const goby::acomms::protobuf::DriverConfig &cfg) override
Starts the modem driver. Must be called before poll().
driver_base.pb.h
goby::moos::BluefinCommsDriver::BluefinCommsDriver
BluefinCommsDriver(goby::acomms::MACManager *mac)
boost::units::si::time
unit< time_dimension, si::system > time
Definition: time.hpp:22
goby::acomms::ModemDriverBase
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition: driver_base.h:58
goby::moos::BluefinCommsDriver::handle_initiate_transmission
void handle_initiate_transmission(const goby::acomms::protobuf::ModemTransmission &m) override
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
goby::moos::BluefinCommsDriver::do_work
void do_work() override
Allows the modem driver to do its work.
goby::util::NMEASentence
Definition: nmea_sentence.h:51
bluefin_driver.pb.h