23 #ifndef IridiumDriverCommon20150508H 24 #define IridiumDriverCommon20150508H 26 #include <dccl/codec.h> 27 #include <dccl/field_codec_fixed.h> 28 #include <dccl/field_codec_manager.h> 30 #include "goby/acomms/protobuf/iridium_driver.pb.h" 47 bye_sent_(
false), total_bytes_sent_(0), last_bytes_sent_(0)
50 double last_rx_tx_time()
const {
return std::max(last_tx_time_, last_rx_time_); }
51 double last_rx_time()
const {
return last_rx_time_; }
52 double last_tx_time()
const {
return last_tx_time_; }
54 int last_bytes_sent()
const {
return last_bytes_sent_; }
55 int total_bytes_sent()
const {
return total_bytes_sent_; }
57 void set_bye_received(
bool b) { bye_received_ = b; }
58 void set_bye_sent(
bool b) { bye_sent_ = b; }
60 bool bye_received()
const {
return bye_received_; }
61 bool bye_sent()
const {
return bye_sent_; }
63 void set_last_tx_time(
double d) { last_tx_time_ = d; }
64 void set_last_rx_time(
double d) { last_rx_time_ = d; }
66 void set_last_bytes_sent(
int i)
69 total_bytes_sent_ += i;
77 int total_bytes_sent_;
84 dccl::Bitset encode() {
return dccl::Bitset(); }
85 dccl::Bitset encode(
const uint32& wire_value) {
return dccl::Bitset(); }
86 dccl::uint32 decode(dccl::Bitset* bits) {
return 0; }
87 virtual unsigned size() {
return 0; }
90 extern boost::shared_ptr<dccl::Codec> iridium_header_dccl_;
92 inline void init_iridium_dccl()
94 dccl::FieldCodecManager::add<IridiumHeaderIdentifierCodec>(
"iridium_header_id");
95 iridium_header_dccl_.reset(
new dccl::Codec(
"iridium_header_id"));
99 inline void serialize_iridium_modem_message(std::string* out,
103 header.set_src(in.src());
104 header.set_dest(in.dest());
106 header.set_rate(in.rate());
107 header.set_type(in.type());
108 if (in.has_ack_requested())
109 header.set_ack_requested(in.ack_requested());
110 if (in.has_frame_start())
111 header.set_frame_start(in.frame_start());
112 if (in.acked_frame_size())
113 header.set_acked_frame(in.acked_frame(0));
115 iridium_header_dccl_->encode(out, header);
120 inline void parse_iridium_modem_message(std::string in,
124 iridium_header_dccl_->decode(&in, &header);
126 out->set_src(header.src());
127 out->set_dest(header.dest());
128 if (header.has_rate())
129 out->set_rate(header.rate());
130 out->set_type(header.type());
131 if (header.has_ack_requested())
132 out->set_ack_requested(header.ack_requested());
133 if (header.has_frame_start())
134 out->set_frame_start(header.frame_start());
135 if (header.has_acked_frame())
136 out->add_acked_frame(header.acked_frame());
google::protobuf::uint32 uint32
an unsigned 32 bit integer
double goby_time< double >()
Returns current UTC time as seconds and fractional seconds since 1970-01-01 00:00:00.
The global namespace for the Goby project.