Goby v2
abc_driver.h
1 // Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 //
6 //
7 // This file is part of the Goby Underwater Autonomy Project Libraries
8 // ("The Goby Libraries").
9 //
10 // The Goby Libraries are free software: you can redistribute them and/or modify
11 // them under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 2.1 of the License, or
13 // (at your option) any later version.
14 //
15 // The Goby Libraries are distributed in the hope that they will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef Modem20110225H
24 #define Modem20110225H
25 
26 #include "goby/common/time.h"
27 
28 #include "driver_base.h"
29 #include "goby/acomms/acomms_helpers.h"
30 #include "goby/acomms/protobuf/abc_driver.pb.h"
31 
32 namespace goby
33 {
34 namespace acomms
35 {
39 class ABCDriver : public ModemDriverBase
40 {
41  public:
42  ABCDriver();
43  void startup(const protobuf::DriverConfig& cfg);
44  void shutdown();
45  void do_work();
47 
48  private:
49  void parse_in(const std::string& in, std::map<std::string, std::string>* out);
50  void signal_and_write(const std::string& raw);
51 
52  private:
53  enum
54  {
55  DEFAULT_BAUD = 4800
56  };
57 
58  protobuf::DriverConfig driver_cfg_; // configuration given to you at launch
59  // rest is up to you!
60 };
61 } // namespace acomms
62 } // namespace goby
63 #endif
provides an API to the imaginary ABC modem (as an example how to write drivers)
Definition: abc_driver.h:39
void do_work()
Allows the modem driver to do its work.
Definition: abc_driver.cpp:112
The global namespace for the Goby project.
void handle_initiate_transmission(const protobuf::ModemTransmission &m)
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
Definition: abc_driver.cpp:77
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition: driver_base.h:47
void startup(const protobuf::DriverConfig &cfg)
Starts the modem driver. Must be called before poll().
Definition: abc_driver.cpp:39
void shutdown()
Shuts down the modem driver.
Definition: abc_driver.cpp:70