Go to the documentation of this file.
25 #ifndef GOBY_ACOMMS_MODEMDRIVER_BENTHOS_ATM900_DRIVER_H
26 #define GOBY_ACOMMS_MODEMDRIVER_BENTHOS_ATM900_DRIVER_H
28 #include <boost/algorithm/string/classification.hpp>
29 #include <boost/algorithm/string/constants.hpp>
30 #include <boost/algorithm/string/split.hpp>
31 #include <boost/any.hpp>
33 #include <dccl/bitset.h>
34 #include <dccl/codec.h>
35 #include <dccl/common.h>
36 #include <dccl/exception.h>
37 #include <dccl/field_codec_fixed.h>
38 #include <dccl/field_codec_manager.h>
39 #include <dccl/version.h>
80 static const std::string SERIAL_DELIMITER;
92 unsigned size()
override {
return 0; }
99 auto benthos_id_name =
"benthos_header_id";
100 #ifdef DCCL_VERSION_4_1_OR_NEWER
103 dccl::FieldCodecManager::add<NoOpIdentifierCodec>(benthos_id_name);
124 for (
int i = 0, n = in.
frame_size(); i < n; ++i)
126 if (in.
frame(i).empty())
129 std::string rudics_packet;
131 *out += rudics_packet;
148 std::vector<std::string> encoded_frames;
149 boost::split(encoded_frames, in, boost::is_any_of(
"\r"), boost::token_compress_on);
151 for (
auto& encoded_frame : encoded_frames)
153 if (!encoded_frame.empty())
void handle_initiate_transmission(const protobuf::ModemTransmission &m) override
Virtual initiate_transmission method. Typically connected to MACManager::signal_initiate_transmission...
bool has_ack_requested() const
void set_type(::goby::acomms::protobuf::ModemTransmission_TransmissionType value)
void parse_rudics_packet(std::string *bytes, std::string rudics_pkt, const std::string &reserved=std::string("\0\r\n", 3)+std::string(1, 0xff), bool include_crc=true)
void add_acked_frame(::google::protobuf::int32 value)
void serialize_benthos_modem_message(std::string *out, const goby::acomms::protobuf::ModemTransmission &in)
The global namespace for the Goby project.
std::shared_ptr< dccl::Codec > benthos_header_dccl_
const ::std::string & frame(int index) const
void serialize_rudics_packet(std::string bytes, std::string *rudics_pkt, const std::string &reserved=std::string("\0\r\n", 3)+std::string(1, 0xff), bool include_crc=true)
void shutdown() override
Shuts down the modem driver.
extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, ::google::protobuf::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
extern ::google::protobuf::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::google::protobuf::internal::MessageTypeTraits< ::goby::acomms::benthos::protobuf::Config >, 11, false > config
int acked_frame_size() const
void parse_benthos_modem_message(std::string in, goby::acomms::protobuf::ModemTransmission *out)
void do_work() override
Allows the modem driver to do its work.
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
::google::protobuf::int32 acked_frame(int index) const
::std::string * add_frame()
::goby::acomms::protobuf::ModemTransmission_TransmissionType type() const
void split(const char *b, const char *e, char d, std::function< void(const char *, const char *)> fn)
bool ack_requested() const
void set_ack_requested(bool value)
void startup(const protobuf::DriverConfig &cfg) override
Starts the modem driver. Must be called before poll().