25#ifndef GOBY_ACOMMS_MODEMDRIVER_DRIVER_BASE_H
26#define GOBY_ACOMMS_MODEMDRIVER_DRIVER_BASE_H
29#include <boost/signals2/signal.hpp>
30#include <boost/smart_ptr/shared_ptr.hpp>
50class ModemTransmission;
192 std::shared_ptr<util::LineBasedInterface> modem_;
194 std::string glog_out_group_;
195 std::string glog_in_group_;
196 bool glog_groups_set_{
false};
198 std::shared_ptr<std::ofstream> raw_fs_;
199 bool raw_fs_connections_made_{
false};
202 protobuf::DriverConfig cfg_;
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
static std::string driver_name(const protobuf::DriverConfig &cfg)
Unique driver name (e.g. UDP_MULTICAST::1 or my_driver_name::2)
static std::atomic< int > count_
boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_transmit_result
Called when a transmission is completed.
void modem_write(const std::string &out)
write a line to the serial port.
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 ModemDrive...
virtual void report(protobuf::ModemReport *report)
Returns report including modem availability and signal quality (if known)
virtual void shutdown()=0
Shuts down the modem driver.
virtual ~ModemDriverBase()
Public Destructor.
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-di...
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...
virtual void startup(const protobuf::DriverConfig &cfg)=0
Starts the modem driver. Must be called before poll().
const std::string & glog_out_group() const
bool modem_read(std::string *in)
read a line from the serial port, including end-of-line character(s)
boost::signals2::signal< void(const protobuf::ModemTransmission &message)> signal_receive
Called when a binary data transmission is received from the modem.
virtual void do_work()=0
Allows the modem driver to do its work.
const std::string & glog_in_group() const
util::LineBasedInterface & modem()
use for direct access to the modem
void modem_close()
closes the serial port. Use modem_start to reopen the port.
virtual void update_cfg(const protobuf::DriverConfig &cfg)
Update configuration while running (not required to be implemented)
virtual void handle_initiate_transmission(const protobuf::ModemTransmission &m)=0
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
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 ...
int driver_order()
Integer for the order in which this driver was started (first driver started is 1,...
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 d...
ModemDriverBase()
Constructor.
basic interface class for all the derived serial (and networking mimics) line-based nodes (serial,...
The global namespace for the Goby project.
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::PROTOBUF_NAMESPACE_ID::MessageOptions, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg