26 #ifndef GOBY_ACOMMS_MODEMDRIVER_MM_DRIVER_H
27 #define GOBY_ACOMMS_MODEMDRIVER_MM_DRIVER_H
87 static unsigned packet_size(
int rate) {
return PACKET_SIZE[rate]; }
95 SENTENCE_NOT_DEFINED = 0,
152 void initialize_talkers();
155 void query_all_cfg();
156 void set_hydroid_gateway_prefix(
int id);
160 void cccyc(protobuf::ModemTransmission*
msg);
161 void ccmuc(protobuf::ModemTransmission*
msg);
162 void cctdp(protobuf::ModemTransmission*
msg);
163 void ccmpc(
const protobuf::ModemTransmission&
msg);
164 void ccpdt(
const protobuf::ModemTransmission&
msg);
165 void ccpnt(
const protobuf::ModemTransmission&
msg);
166 void ccmec(
const protobuf::ModemTransmission&
msg);
167 void ccpgt(
const protobuf::ModemTransmission&
msg);
168 void ccswp(
const protobuf::ModemTransmission&
msg);
169 void ccmsq(
const protobuf::ModemTransmission&
msg);
173 void cache_outgoing_data(protobuf::ModemTransmission*
msg);
177 void increment_present_fail();
178 void present_fail_exceeds_retries();
181 void process_receive(
190 void handle_ack(std::uint32_t src, std::uint32_t dest, std::uint32_t frame,
191 protobuf::ModemTransmission* m);
217 void validate_transmission_start(
const protobuf::ModemTransmission& message);
219 void signal_receive_and_clear(protobuf::ModemTransmission* message);
222 void process_incoming_app_ack(protobuf::ModemTransmission* m);
223 void process_outgoing_app_ack(protobuf::ModemTransmission*
msg);
226 void set_rts(
bool state);
228 const micromodem::protobuf::Config& mm_driver_cfg()
const
247 MAX_FAILS_BEFORE_DEAD = 5
256 ROUGH_SPEED_OF_SOUND = 1500
266 static const std::string SERIAL_DELIMITER;
268 static const unsigned PACKET_FRAME_COUNT[];
270 static const unsigned PACKET_SIZE[];
273 protobuf::DriverConfig driver_cfg_;
277 std::deque<util::NMEASentence> out_;
283 bool waiting_for_modem_{
false};
286 bool waiting_for_multimsg_{
false};
290 bool startup_done_{
false};
293 unsigned global_fail_count_{0};
297 unsigned present_fail_count_{0};
303 bool clock_set_{
false};
307 TALKER_NOT_DEFINED = 0,
314 std::map<std::string, TalkerIDs> talker_id_map_;
315 std::map<std::string, SentenceIDs> sentence_id_map_;
316 std::map<std::string, std::string> description_map_;
317 std::map<std::string, std::string> cfg_map_;
326 HYDROID_GATEWAY_PREFIX_LENGTH = 3
331 bool is_hydroid_gateway_{
false};
332 std::string hydroid_gateway_modem_prefix_;
333 std::string hydroid_gateway_gps_request_;
336 std::map<std::string, int> nvram_cfg_;
338 protobuf::ModemTransmission transmit_msg_;
339 unsigned expected_remaining_caxst_{
342 protobuf::ModemTransmission receive_msg_;
343 unsigned expected_remaining_cacst_{
349 std::set<unsigned> frames_waiting_for_ack_;
353 unsigned expected_ack_destination_{0};
355 std::set<unsigned> frames_waiting_to_receive_;
359 bool local_cccyc_{
false};
370 MMRevision() =
default;
375 MMRevision revision_;
377 bool using_application_acks_{
false};
378 int application_ack_max_frames_{0};
381 std::set<unsigned> application_ack_ids_;
386 std::map<unsigned, std::set<unsigned> > frames_to_ack_;
388 std::unique_ptr<dccl::Codec> dccl_;