Goby3  3.1.5a
2024.05.23
bind.h
Go to the documentation of this file.
1 // Copyright 2010-2023:
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 // gives functions for binding the goby-acomms libraries together
26 
27 #ifndef GOBY_ACOMMS_BIND_H
28 #define GOBY_ACOMMS_BIND_H
29 
30 #include <boost/bind/bind.hpp>
31 
32 #include "goby/acomms/amac.h"
33 #include "goby/acomms/connect.h"
34 #include "goby/acomms/dccl.h"
36 #include "goby/acomms/queue.h"
37 #include "goby/acomms/route.h"
38 #include "goby/util/debug_logger.h"
39 
40 namespace goby
41 {
42 namespace acomms
43 {
45 inline void bind(ModemDriverBase& driver, QueueManager& queue_manager)
46 {
47  goby::acomms::connect(&driver.signal_receive, &queue_manager,
49 
50  goby::acomms::connect(&driver.signal_data_request, &queue_manager,
52 }
53 
55 inline void bind(MACManager& mac, ModemDriverBase& driver)
56 {
59 }
60 
62 inline void bind(QueueManager& queue_manager, RouteManager& route_manager)
63 {
64  route_manager.add_subnet_queue(&queue_manager);
65  goby::acomms::connect(&queue_manager.signal_in_route, &route_manager, &RouteManager::handle_in);
66  goby::acomms::connect(&queue_manager.signal_out_route, &route_manager,
68 }
69 
71 inline void bind(ModemDriverBase& driver, QueueManager& queue_manager, MACManager& mac)
72 {
73  goby::acomms::bind(driver, queue_manager);
74  goby::acomms::bind(mac, driver);
75 }
76 
78 inline void unbind(ModemDriverBase& driver, QueueManager& queue_manager)
79 {
80  goby::acomms::disconnect(&driver.signal_receive, &queue_manager,
82 
83  goby::acomms::disconnect(&driver.signal_data_request, &queue_manager,
85 }
86 
88 inline void unbind(MACManager& mac, ModemDriverBase& driver)
89 {
92 }
93 
95 inline void unbind(QueueManager& queue_manager, RouteManager& route_manager)
96 {
97  route_manager.add_subnet_queue(&queue_manager);
98  goby::acomms::disconnect(&queue_manager.signal_in_route, &route_manager,
100  goby::acomms::disconnect(&queue_manager.signal_out_route, &route_manager,
102 }
103 
105 inline void unbind(ModemDriverBase& driver, QueueManager& queue_manager, MACManager& mac)
106 {
107  goby::acomms::unbind(driver, queue_manager);
108  goby::acomms::unbind(mac, driver);
109 }
110 
111 // examples
116 
117 } // namespace acomms
118 
119 } // namespace goby
120 
121 #endif
goby::acomms::MACManager::signal_initiate_transmission
boost::signals2::signal< void(const protobuf::ModemTransmission &m)> signal_initiate_transmission
Signals when it is time for this platform to begin transmission of an acoustic message at the start o...
Definition: mac_manager.h:91
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::acomms::unbind
void unbind(ModemDriverBase &driver, QueueManager &queue_manager)
unbinds the driver link-layer callbacks to the QueueManager
Definition: bind.h:78
goby::acomms::RouteManager::handle_out
void handle_out(protobuf::QueuedMessageMeta *meta, const google::protobuf::Message &data_msg, int modem_id)
goby::acomms::ModemDriverBase::signal_data_request
boost::signals2::signal< void(protobuf::ModemTransmission *msg)> signal_data_request
Called when the modem or modem driver needs data to send. The returned data should be stored in Modem...
Definition: driver_base.h:107
goby::acomms::RouteManager::add_subnet_queue
void add_subnet_queue(QueueManager *manager)
goby::acomms::QueueManager::handle_modem_receive
void handle_modem_receive(const protobuf::ModemTransmission &message)
Receive incoming data from the modem.
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
amac.h
goby::acomms::ModemDriverBase::signal_receive
boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_receive
Called when a binary data transmission is received from the modem.
Definition: driver_base.h:96
modem_driver.h
dccl.h
goby::acomms::QueueManager::handle_modem_data_request
void handle_modem_data_request(protobuf::ModemTransmission *msg)
Finds data to send to the modem.
route.h
goby::acomms::connect
void connect(Signal *signal, Slot slot)
connect a signal to a slot (e.g. function pointer)
Definition: connect.h:38
connect.h
queue.h
goby::acomms::QueueManager
provides an API to the goby-acomms Queuing Library.
Definition: queue_manager.h:66
goby::acomms::bind
void bind(ModemDriverBase &driver, QueueManager &queue_manager)
binds the driver link-layer callbacks to the QueueManager
Definition: bind.h:45
debug_logger.h
goby::acomms::RouteManager
Definition: route.h:53
goby::acomms::RouteManager::handle_in
void handle_in(const protobuf::QueuedMessageMeta &meta, const google::protobuf::Message &data_msg, int modem_id)
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::acomms::ModemDriverBase::handle_initiate_transmission
virtual void handle_initiate_transmission(const protobuf::ModemTransmission &m)=0
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
goby::acomms::disconnect
void disconnect(Signal *signal, Slot slot)
disconnect a signal to a slot (e.g. function pointer)
Definition: connect.h:65