Note: Goby version 1 (shown here) is now considered obsolete. Please use version 2 for new projects, and consider upgrading old projects.

Goby Underwater Autonomy Project  Series: 1.1, revision: 163, released on 2013-02-06 14:23:27 -0500
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
goby::acomms::MACManager Class Reference

provides an API to the goby-acomms MAC library. More...

#include <goby/acomms/amac.h>

List of all members.

Public Member Functions

Constructors/Destructor
 MACManager (std::ostream *log=0)
 Default constructor.
 ~MACManager ()
Control
void startup (const protobuf::MACConfig &cfg)
 Starts the MAC with given configuration.
void shutdown ()
 Shutdown the MAC.
void do_work ()
 Must be called regularly for the MAC to perform its work (10 Hertz or so is fine)
Modem Slots
void handle_modem_all_incoming (const protobuf::ModemMsgBase &m)
 Call every time a message is received from vehicle to "discover" this vehicle or reset the expire timer. Only needed when the type is amac::mac_auto_decentralized. Typically connected to ModemDriverBase::signal_all_incoming using bind().
Manipulate slots
std::map< int, protobuf::Slot >
::iterator 
add_slot (const protobuf::Slot &s)
bool remove_slot (const protobuf::Slot &s)
 removes any slots in the cycle where protobuf::operator==(const protobuf::Slot&, const protobuf::Slot&) is true.
void clear_all_slots ()
 clears all slots from communications cycle.

Static Public Member Functions

Other
static void add_flex_groups (util::FlexOstream *tout)
 Adds groups for a FlexOstream logger.

Public Attributes

Modem Signals
boost::signal< void(protobuf::ModemMsgBase
*m) 
signal_initiate_transmission )
 Signals when it is time for this platform to begin transmission of an acoustic message at the start of its TDMA slot. Typically connected to ModemDriverBase::handle_initiate_transmission() using bind().
boost::signal< void(protobuf::ModemRangingRequest
*m) 
signal_initiate_ranging )
 Signals when it is time for this platform to begin an acoustic ranging transmission to another vehicle or ranging beacon(s). Typically connected to ModemDriverBase::handle_initiate_ranging() using bind().

Detailed Description

provides an API to the goby-acomms MAC library.

See also:
amac.proto and modem_message.proto for definition of Google Protocol Buffers messages (namespace goby::acomms::protobuf).
Examples:
acomms/chat/chat.cpp, and libamac/amac_simple/amac_simple.cpp.

Definition at line 53 of file mac_manager.h.


Constructor & Destructor Documentation

goby::acomms::MACManager::MACManager ( std::ostream *  log = 0)

Default constructor.

Parameters:
logstd::ostream object or FlexOstream to capture all humanly readable runtime and debug information (optional).

Definition at line 40 of file mac_manager.cpp.


Member Function Documentation

std::map< int, goby::acomms::protobuf::Slot >::iterator goby::acomms::MACManager::add_slot ( const protobuf::Slot &  s)
Returns:
iterator to newly added slot

Definition at line 400 of file mac_manager.cpp.

void goby::acomms::MACManager::handle_modem_all_incoming ( const protobuf::ModemMsgBase &  m)

Call every time a message is received from vehicle to "discover" this vehicle or reset the expire timer. Only needed when the type is amac::mac_auto_decentralized. Typically connected to ModemDriverBase::signal_all_incoming using bind().

Parameters:
mthe new incoming message (used to detect vehicles). (protobuf::ModemMsgBase defined in modem_message.proto)

Definition at line 290 of file mac_manager.cpp.

bool goby::acomms::MACManager::remove_slot ( const protobuf::Slot &  s)

removes any slots in the cycle where protobuf::operator==(const protobuf::Slot&, const protobuf::Slot&) is true.

Returns:
true if one or more slots are removed

Definition at line 426 of file mac_manager.cpp.

void goby::acomms::MACManager::startup ( const protobuf::MACConfig &  cfg)

Starts the MAC with given configuration.

Parameters:
cfgInitial configuration values (protobuf::MACConfig defined in amac.proto)

Definition at line 72 of file mac_manager.cpp.


Member Data Documentation

boost::signal<void (protobuf::ModemRangingRequest* m) goby::acomms::MACManager::signal_initiate_ranging)

Signals when it is time for this platform to begin an acoustic ranging transmission to another vehicle or ranging beacon(s). Typically connected to ModemDriverBase::handle_initiate_ranging() using bind().

Parameters:
mparameters of the ranging request to be performed (protobuf::ModemRangingRequest defined in modem_message.proto).

Definition at line 103 of file mac_manager.h.

boost::signal<void (protobuf::ModemMsgBase* m) goby::acomms::MACManager::signal_initiate_transmission)

Signals when it is time for this platform to begin transmission of an acoustic message at the start of its TDMA slot. Typically connected to ModemDriverBase::handle_initiate_transmission() using bind().

Parameters:
ma message containing details of the transmission to be initated. (protobuf::ModemMsgBase defined in modem_message.proto)

Definition at line 98 of file mac_manager.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends