Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
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"
39
40namespace goby
41{
42namespace acomms
43{
45inline 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
60
62inline 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
71inline 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
86
93
95inline 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
105inline 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
provides an API to the goby-acomms MAC library. MACManager is essentially a std::list<protobuf::Modem...
Definition mac_manager.h:51
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
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition driver_base.h:59
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...
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
virtual void handle_initiate_transmission(const protobuf::ModemTransmission &m)=0
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
provides an API to the goby-acomms Queuing Library.
boost::signals2::signal< void(protobuf::QueuedMessageMeta *meta, const google::protobuf::Message &data_msg, int modem_id)> signal_out_route
Used by a router to change next-hop destination (in meta)
void handle_modem_receive(const protobuf::ModemTransmission &message)
Receive incoming data from the modem.
void handle_modem_data_request(protobuf::ModemTransmission *msg)
Finds data to send to the modem.
boost::signals2::signal< void(const protobuf::QueuedMessageMeta &meta, const google::protobuf::Message &data_msg, int modem_id)> signal_in_route
Used by a router to intercept messages and requeue them if desired.
void handle_out(protobuf::QueuedMessageMeta *meta, const google::protobuf::Message &data_msg, int modem_id)
void handle_in(const protobuf::QueuedMessageMeta &meta, const google::protobuf::Message &data_msg, int modem_id)
void add_subnet_queue(QueueManager *manager)
void connect(Signal *signal, Slot slot)
connect a signal to a slot (e.g. function pointer)
Definition connect.h:38
void unbind(ModemDriverBase &driver, QueueManager &queue_manager)
unbinds the driver link-layer callbacks to the QueueManager
Definition bind.h:78
void bind(ModemDriverBase &driver, QueueManager &queue_manager)
binds the driver link-layer callbacks to the QueueManager
Definition bind.h:45
void disconnect(Signal *signal, Slot slot)
disconnect a signal to a slot (e.g. function pointer)
Definition connect.h:65
The global namespace for the Goby project.