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