Goby3  3.1.5a
2024.05.23

provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers for different manufacturers' modems. More...

#include <goby/acomms/modem_driver.h>

Inheritance diagram for goby::acomms::ModemDriverBase:
goby::acomms::ABCDriver goby::acomms::BenthosATM900Driver goby::acomms::IridiumDriver goby::acomms::IridiumShoreDriver goby::acomms::MMDriver goby::acomms::PopotoDriver goby::acomms::StoreServerDriver goby::acomms::UDPDriver goby::acomms::UDPMulticastDriver goby::moos::BluefinCommsDriver goby::moos::UFldDriver

Public Member Functions

Control
virtual void startup (const protobuf::DriverConfig &cfg)=0
 Starts the modem driver. Must be called before poll(). More...
 
virtual void update_cfg (const protobuf::DriverConfig &cfg)
 Update configuration while running (not required to be implemented) More...
 
virtual void shutdown ()=0
 Shuts down the modem driver. More...
 
virtual void do_work ()=0
 Allows the modem driver to do its work. More...
 
MAC Slots
virtual void handle_initiate_transmission (const protobuf::ModemTransmission &m)=0
 Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission() using bind(). More...
 

Protected Member Functions

Constructors/Destructor
 ModemDriverBase ()
 Constructor. More...
 

MAC / Queue Signals

boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_receive
 Called when a binary data transmission is received from the modem. More...
 
boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_transmit_result
 Called when a transmission is completed. More...
 
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 ModemTransmission::frame. More...
 
boost::signals2::signal< void(protobuf::ModemTransmission *msg_request)> signal_modify_transmission
 Called before the modem driver begins processing a transmission. This allows a third party to modify the parameters of the transmission (such as destination or rate) on the fly. More...
 
boost::signals2::signal< void(const protobuf::ModemRaw &msg)> signal_raw_incoming
 Called after any message is received from the modem by the driver. Used by the MACManager for auto-discovery of vehicles. Also useful for higher level analysis and debugging of the transactions between the driver and the modem. More...
 
boost::signals2::signal< void(const protobuf::ModemRaw &msg)> signal_raw_outgoing
 Called after any message is sent from the driver to the modem. Useful for higher level analysis and debugging of the transactions between the driver and the modem. More...
 
virtual ~ModemDriverBase ()
 Public Destructor. More...
 

Informational

virtual void report (protobuf::ModemReport *report)
 Returns report including modem availability and signal quality (if known) More...
 
int driver_order ()
 Integer for the order in which this driver was started (first driver started is 1, second driver is 2, etc.) More...
 
static std::string driver_name (const protobuf::DriverConfig &cfg)
 Unique driver name (e.g. UDP_MULTICAST::1 or my_driver_name::2) More...
 

Write/read from the line-based interface to the modem

static std::atomic< intcount_
 
void modem_write (const std::string &out)
 write a line to the serial port. More...
 
bool modem_read (std::string *in)
 read a line from the serial port, including end-of-line character(s) More...
 
void modem_start (const protobuf::DriverConfig &cfg, bool modem_connection_expected=true)
 start the physical connection to the modem (serial port, TCP, etc.). must be called before ModemDriverBase::modem_read() or ModemDriverBase::modem_write() More...
 
void modem_close ()
 closes the serial port. Use modem_start to reopen the port. More...
 
const std::string & glog_out_group () const
 
const std::string & glog_in_group () const
 
util::LineBasedInterfacemodem ()
 use for direct access to the modem More...
 

Detailed Description

provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers for different manufacturers' modems.

See also
acomms_driver_base.proto and acomms_modem_message.proto for definition of Google Protocol Buffers messages (namespace goby::acomms::protobuf).

Definition at line 58 of file driver_base.h.

Constructor & Destructor Documentation

◆ ~ModemDriverBase()

virtual goby::acomms::ModemDriverBase::~ModemDriverBase ( )
virtual

Public Destructor.

◆ ModemDriverBase()

goby::acomms::ModemDriverBase::ModemDriverBase ( )
protected

Constructor.

Member Function Documentation

◆ do_work()

virtual void goby::acomms::ModemDriverBase::do_work ( )
pure virtual

Allows the modem driver to do its work.

Should be called regularly to perform the work of the driver as the driver does not run in its own thread. This allows us to guarantee that no signals are called except inside this method. Does not block.

Implemented in goby::acomms::MMDriver, goby::acomms::IridiumShoreDriver, goby::acomms::UDPDriver, goby::acomms::UDPMulticastDriver, goby::acomms::BenthosATM900Driver, goby::acomms::PopotoDriver, goby::moos::BluefinCommsDriver, goby::acomms::IridiumDriver, goby::moos::UFldDriver, goby::acomms::ABCDriver, and goby::acomms::StoreServerDriver.

◆ driver_name()

static std::string goby::acomms::ModemDriverBase::driver_name ( const protobuf::DriverConfig cfg)
static

Unique driver name (e.g. UDP_MULTICAST::1 or my_driver_name::2)

The name has two parts separated by "::". The first part is the driver_type enum without the "DRIVER_" prefix or the result of goby_driver_name() function (for plugin drivers). The second part is the modem id.

◆ driver_order()

int goby::acomms::ModemDriverBase::driver_order ( )
inline

Integer for the order in which this driver was started (first driver started is 1, second driver is 2, etc.)

Definition at line 136 of file driver_base.h.

◆ glog_in_group()

const std::string& goby::acomms::ModemDriverBase::glog_in_group ( ) const
inlineprotected

Definition at line 178 of file driver_base.h.

◆ glog_out_group()

const std::string& goby::acomms::ModemDriverBase::glog_out_group ( ) const
inlineprotected

Definition at line 177 of file driver_base.h.

◆ handle_initiate_transmission()

virtual void goby::acomms::ModemDriverBase::handle_initiate_transmission ( const protobuf::ModemTransmission m)
pure virtual

Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission() using bind().

Parameters
mModemTransmission (defined in acomms_modem_message.proto) containing the details of the transmission to be started. This may contain data frames. If not, data will be requested when the driver calls the data request signal (ModemDriverBase::signal_data_request)

Implemented in goby::acomms::MMDriver, goby::acomms::IridiumShoreDriver, goby::acomms::UDPDriver, goby::acomms::UDPMulticastDriver, goby::acomms::BenthosATM900Driver, goby::acomms::PopotoDriver, goby::acomms::IridiumDriver, goby::acomms::ABCDriver, goby::acomms::StoreServerDriver, goby::moos::BluefinCommsDriver, and goby::moos::UFldDriver.

◆ modem()

util::LineBasedInterface& goby::acomms::ModemDriverBase::modem ( )
inlineprotected

use for direct access to the modem

Definition at line 181 of file driver_base.h.

◆ modem_close()

void goby::acomms::ModemDriverBase::modem_close ( )
protected

closes the serial port. Use modem_start to reopen the port.

◆ modem_read()

bool goby::acomms::ModemDriverBase::modem_read ( std::string *  in)
protected

read a line from the serial port, including end-of-line character(s)

Parameters
inpointer to string to store line
Returns
true if a line was available, false if no line available

◆ modem_start()

void goby::acomms::ModemDriverBase::modem_start ( const protobuf::DriverConfig cfg,
bool  modem_connection_expected = true 
)
protected

start the physical connection to the modem (serial port, TCP, etc.). must be called before ModemDriverBase::modem_read() or ModemDriverBase::modem_write()

Parameters
cfgConfiguration including the parameters for the physical connection. (protobuf::DriverConfig is defined in acomms_driver_base.proto).
Exceptions
ModemDriverExceptionProblem opening the physical connection.

◆ modem_write()

void goby::acomms::ModemDriverBase::modem_write ( const std::string &  out)
protected

write a line to the serial port.

Parameters
outreference to string to write. Must already include any end-of-line character(s).

◆ report()

virtual void goby::acomms::ModemDriverBase::report ( protobuf::ModemReport report)
virtual

Returns report including modem availability and signal quality (if known)

Reimplemented in goby::acomms::UDPDriver, goby::acomms::UDPMulticastDriver, and goby::acomms::IridiumDriver.

◆ shutdown()

◆ startup()

virtual void goby::acomms::ModemDriverBase::startup ( const protobuf::DriverConfig cfg)
pure virtual

Starts the modem driver. Must be called before poll().

Parameters
cfgStartup configuration for the driver and modem. DriverConfig is defined in acomms_driver_base.proto. Derived classes can define extensions (see https://developers.google.com/protocol-buffers/docs/proto) to DriverConfig to handle modem specific configuration.

Implemented in goby::acomms::IridiumShoreDriver, goby::acomms::MMDriver, goby::acomms::UDPDriver, goby::acomms::UDPMulticastDriver, goby::acomms::BenthosATM900Driver, goby::acomms::PopotoDriver, goby::acomms::IridiumDriver, goby::acomms::ABCDriver, goby::acomms::StoreServerDriver, goby::moos::BluefinCommsDriver, and goby::moos::UFldDriver.

◆ update_cfg()

virtual void goby::acomms::ModemDriverBase::update_cfg ( const protobuf::DriverConfig cfg)
virtual

Update configuration while running (not required to be implemented)

Reimplemented in goby::acomms::MMDriver.

Member Data Documentation

◆ count_

std::atomic<int> goby::acomms::ModemDriverBase::count_
staticprotected

Definition at line 185 of file driver_base.h.

◆ signal_data_request

boost::signals2::signal<void(protobuf::ModemTransmission* msg)> goby::acomms::ModemDriverBase::signal_data_request

Called when the modem or modem driver needs data to send. The returned data should be stored in ModemTransmission::frame.

You should connect one or more slots (a function or member function) to this signal to handle data requests. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemTransmission is defined in acomms_modem_message.proto.

Definition at line 107 of file driver_base.h.

◆ signal_modify_transmission

boost::signals2::signal<void(protobuf::ModemTransmission* msg_request)> goby::acomms::ModemDriverBase::signal_modify_transmission

Called before the modem driver begins processing a transmission. This allows a third party to modify the parameters of the transmission (such as destination or rate) on the fly.

You may connect one or more slots (a function or member function) to this signal to handle data requests. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemTransmission is defined in acomms_modem_message.proto.

Definition at line 113 of file driver_base.h.

◆ signal_raw_incoming

boost::signals2::signal<void(const protobuf::ModemRaw& msg)> goby::acomms::ModemDriverBase::signal_raw_incoming

Called after any message is received from the modem by the driver. Used by the MACManager for auto-discovery of vehicles. Also useful for higher level analysis and debugging of the transactions between the driver and the modem.

If desired, you should connect one or more slots (a function or member function) to this signal to listen on incoming transactions. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemRaw is defined in acomms_modem_message.proto.

Definition at line 118 of file driver_base.h.

◆ signal_raw_outgoing

boost::signals2::signal<void(const protobuf::ModemRaw& msg)> goby::acomms::ModemDriverBase::signal_raw_outgoing

Called after any message is sent from the driver to the modem. Useful for higher level analysis and debugging of the transactions between the driver and the modem.

If desired, you should connect one or more slots (a function or member function) to this signal to listen on outgoing transactions. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemRaw is defined in acomms_modem_message.proto.

Definition at line 123 of file driver_base.h.

◆ signal_receive

boost::signals2::signal<void(const protobuf::ModemTransmission& message)> goby::acomms::ModemDriverBase::signal_receive

Called when a binary data transmission is received from the modem.

You should connect one or more slots (a function or member function) to this signal to receive incoming messages. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemDataTransmission is defined in acomms_modem_message.proto.

Definition at line 96 of file driver_base.h.

◆ signal_transmit_result

boost::signals2::signal<void(const protobuf::ModemTransmission& message)> goby::acomms::ModemDriverBase::signal_transmit_result

Called when a transmission is completed.

You should connect one or more slots (a function or member function) to this signal to receive incoming messages. Use the goby::acomms::connect family of functions to do this. This signal will only be called during a call to poll. ModemDataTransmission is defined in acomms_modem_message.proto.

Definition at line 102 of file driver_base.h.


The documentation for this class was generated from the following file: