Goby3  3.1.5a
2024.05.23
abc_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_ACOMMS_MODEMDRIVER_ABC_DRIVER_H
26 #define GOBY_ACOMMS_MODEMDRIVER_ABC_DRIVER_H
27 
28 #include <map> // for map
29 #include <string> // for string
30 
31 #include "driver_base.h" // for ModemDriverBase
32 #include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
33 
34 namespace goby
35 {
36 namespace acomms
37 {
38 namespace protobuf
39 {
40 class ModemTransmission;
41 } // namespace protobuf
42 
46 class ABCDriver : public ModemDriverBase
47 {
48  public:
49  ABCDriver();
50  void startup(const protobuf::DriverConfig& cfg) override;
51  void shutdown() override;
52  void do_work() override;
54 
55  private:
56  void parse_in(const std::string& in, std::map<std::string, std::string>* out);
57  void signal_and_write(const std::string& raw);
58 
59  private:
60  enum
61  {
62  DEFAULT_BAUD = 4800
63  };
64 
65  protobuf::DriverConfig driver_cfg_; // configuration given to you at launch
66  // rest is up to you!
67 };
68 } // namespace acomms
69 } // namespace goby
70 #endif
goby::acomms::protobuf::DriverConfig
Definition: driver_base.pb.h:123
goby::acomms::protobuf::ModemTransmission
Definition: modem_message.pb.h:166
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::acomms::ABCDriver::do_work
void do_work() override
Allows the modem driver to do its work.
goby::acomms::ABCDriver
provides an API to the imaginary ABC modem (as an example how to write drivers)
Definition: abc_driver.h:46
driver_base.h
goby::acomms::ABCDriver::handle_initiate_transmission
void handle_initiate_transmission(const protobuf::ModemTransmission &m) override
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
driver_base.pb.h
goby::acomms::ABCDriver::ABCDriver
ABCDriver()
goby::acomms::ABCDriver::startup
void startup(const protobuf::DriverConfig &cfg) override
Starts the modem driver. Must be called before poll().
goby::acomms::ABCDriver::shutdown
void shutdown() override
Shuts down the modem driver.
goby::acomms::ModemDriverBase
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition: driver_base.h:58