Goby3  3.1.5a
2024.05.23
benthos_atm900_driver_fsm.h
Go to the documentation of this file.
1 // Copyright 2016-2023:
2 // GobySoft, LLC (2013-)
3 // Community contributors (see AUTHORS file)
4 // File authors:
5 // Toby Schneider <toby@gobysoft.org>
6 // Brandon Zoss <brandon.zoss@str.us>
7 //
8 //
9 // This file is part of the Goby Underwater Autonomy Project Libraries
10 // ("The Goby Libraries").
11 //
12 // The Goby Libraries are free software: you can redistribute them and/or modify
13 // them under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation, either version 2.1 of the License, or
15 // (at your option) any later version.
16 //
17 // The Goby Libraries are distributed in the hope that they will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
24 
25 #ifndef GOBY_ACOMMS_MODEMDRIVER_BENTHOS_ATM900_DRIVER_FSM_H
26 #define GOBY_ACOMMS_MODEMDRIVER_BENTHOS_ATM900_DRIVER_FSM_H
27 
28 #include <iostream> // for basic_ostrea...
29 #include <memory> // for allocator
30 #include <string> // for string, oper...
31 #include <utility> // for move, pair
32 
33 #include <boost/circular_buffer.hpp> // for circular_buffer
34 #include <boost/date_time/date.hpp> // for date<>::day_...
35 #include <boost/date_time/gregorian_calendar.hpp> // for gregorian_ca...
36 #include <boost/date_time/posix_time/ptime.hpp> // for ptime
37 #include <boost/date_time/time.hpp> // for base_time<>:...
38 #include <boost/date_time/time_system_counted.hpp> // for counted_time...
39 #include <boost/format.hpp> // for basic_altstr...
40 #include <boost/lexical_cast/bad_lexical_cast.hpp> // for bad_lexical_...
41 #include <boost/mpl/list.hpp>
42 #include <boost/smart_ptr/intrusive_ptr.hpp> // for intrusive_ptr
43 #include <boost/statechart/custom_reaction.hpp>
44 #include <boost/statechart/deep_history.hpp>
45 #include <boost/statechart/event.hpp> // for event
46 #include <boost/statechart/event_base.hpp> // for event_base
47 #include <boost/statechart/in_state_reaction.hpp> // for in_state_rea...
48 #include <boost/statechart/result.hpp> // for reaction_result
49 #include <boost/statechart/simple_state.hpp> // for simple_state...
50 #include <boost/statechart/state.hpp> // for state, state...
51 #include <boost/statechart/state_machine.hpp> // for state_machine
52 #include <boost/statechart/transition.hpp> // for transition
53 
54 #include "goby/acomms/acomms_constants.h" // for BROADCAST_ID
55 #include "goby/acomms/protobuf/benthos_atm900.pb.h" // for Config, Mess...
56 #include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
57 #include "goby/acomms/protobuf/modem_message.pb.h" // for ModemTransmi...
58 #include "goby/time/convert.h" // for SystemClock:...
59 #include "goby/time/system_clock.h" // for SystemClock
60 #include "goby/util/as.h" // for as
61 #include "goby/util/debug_logger/flex_ostream.h" // for FlexOstream
62 #include "goby/util/debug_logger/flex_ostreambuf.h" // for DEBUG1
63 #include "goby/util/debug_logger/logger_manipulators.h" // for operator<<
64 
65 namespace goby
66 {
67 namespace acomms
68 {
69 namespace benthos
70 {
71 namespace fsm
72 {
73 // events
75 {
76  std::string line;
77 };
79 {
80 };
81 
83 {
84  EvAck(std::string response) : response_(std::move(response)) {}
85 
86  std::string response_;
87 };
88 
90 {
91 };
93 {
94 };
95 
97 {
98  EvDial(int dest, int rate) : dest_(dest), rate_(rate) {}
99 
100  int dest_;
101  int rate_;
102 };
103 
105 {
106  EvRange(int dest) : dest_(dest) {}
107  int dest_;
108 };
109 
110 struct EvRequestLowPower : boost::statechart::event<EvRequestLowPower>
111 {
112 };
114 {
115 };
116 
118 {
119 };
121 {
122 };
123 
125 {
126 };
127 
128 struct EvTransmitBegun : boost::statechart::event<EvTransmitBegun>
129 {
130 };
131 
133 {
134  EvReceive(std::string first) : first_(std::move(first)) {}
135  std::string first_;
136 };
137 
138 struct EvReceiveComplete : boost::statechart::event<EvReceiveComplete>
139 {
140 };
142 {
143 };
144 struct EvRangingComplete : boost::statechart::event<EvRangingComplete>
145 {
146 };
147 
148 struct Active;
149 struct ReceiveData;
150 struct Command;
151 struct Ready;
152 struct Configure;
153 struct SetClock;
154 struct Dial;
155 struct LowPower;
156 struct Range;
157 struct Online;
158 struct Listen;
159 struct TransmitData;
160 
161 // state machine
162 struct BenthosATM900FSM : boost::statechart::state_machine<BenthosATM900FSM, Active>
163 {
164  public:
166  : serial_tx_buffer_(SERIAL_BUFFER_CAPACITY),
167  received_(RECEIVED_BUFFER_CAPACITY),
168  driver_cfg_(driver_cfg),
169  data_out_(DATA_BUFFER_CAPACITY)
170  {
171  ++count_;
172  glog_fsm_group_ = "benthosatm900::fsm::" + goby::util::as<std::string>(count_);
173  }
174 
176 
177  // messages for the serial line at next opportunity
178  boost::circular_buffer<std::string>& serial_tx_buffer() { return serial_tx_buffer_; }
179 
180  // received messages to be passed up out of the ModemDriver
181  boost::circular_buffer<goby::acomms::protobuf::ModemTransmission>& received()
182  {
183  return received_;
184  }
185 
186  // data that should (eventually) be sent out across the connection
187  boost::circular_buffer<goby::acomms::protobuf::ModemTransmission>& data_out()
188  {
189  return data_out_;
190  }
191 
192  const goby::acomms::protobuf::DriverConfig& driver_cfg() const { return driver_cfg_; }
194  {
195  return driver_cfg_.GetExtension(goby::acomms::benthos::protobuf::config);
196  }
197 
198  const std::string& glog_fsm_group() const { return glog_fsm_group_; }
199 
200  private:
201  enum
202  {
203  SERIAL_BUFFER_CAPACITY = 10
204  };
205  enum
206  {
207  RECEIVED_BUFFER_CAPACITY = 10
208  };
209 
210  boost::circular_buffer<std::string> serial_tx_buffer_;
211  boost::circular_buffer<goby::acomms::protobuf::ModemTransmission> received_;
212  const goby::acomms::protobuf::DriverConfig& driver_cfg_;
213 
214  enum
215  {
216  DATA_BUFFER_CAPACITY = 5
217  };
218  boost::circular_buffer<goby::acomms::protobuf::ModemTransmission> data_out_;
219 
220  std::string glog_fsm_group_;
221 
222  static int count_;
223 };
224 
226 {
227  StateNotify(std::string name) : name_(std::move(name))
228  {
229  glog.is(goby::util::logger::DEBUG1) && glog << group("benthosatm900::fsm") << name_
230  << std::endl;
231  }
233  {
234  glog.is(goby::util::logger::DEBUG1) && glog << group("benthosatm900::fsm") << "~" << name_
235  << std::endl;
236  }
237 
238  private:
239  std::string name_;
240 };
241 
242 // Active
243 struct Active : boost::statechart::simple_state<Active, BenthosATM900FSM, Command,
244  boost::statechart::has_deep_history>,
246 {
247  Active() : StateNotify("Active") {}
248  ~Active() override = default;
249 
250  void in_state_react(const EvRxSerial&);
251 
252  typedef boost::mpl::list<
253  boost::statechart::transition<EvReset, Active>,
254  boost::statechart::in_state_reaction<EvRxSerial, Active, &Active::in_state_react>,
255  boost::statechart::transition<EvReceive, ReceiveData> >
257 };
258 
259 struct ReceiveData : boost::statechart::state<ReceiveData, BenthosATM900FSM>, StateNotify
260 {
261  ReceiveData(my_context ctx);
262  ~ReceiveData() override = default;
263 
264  void in_state_react(const EvRxSerial&);
265 
266  using reactions = boost::mpl::list<
267  boost::statechart::in_state_reaction<EvRxSerial, ReceiveData, &ReceiveData::in_state_react>,
268  boost::statechart::transition<EvReceiveComplete, boost::statechart::deep_history<Command>>>;
269 
271  unsigned reported_size_;
272  std::string encoded_bytes_; // still base 255 encoded
273 };
274 
275 // Command
276 struct Command : boost::statechart::simple_state<Command, Active, Configure,
277  boost::statechart::has_deep_history>,
279 {
280  public:
281  void in_state_react(const EvAck&);
282  void in_state_react(const EvTxSerial&);
283  boost::statechart::result react(const EvConnect&)
284  {
285  if (at_out_.empty() || at_out_.front().second != "+++")
286  {
287  at_out_.clear();
288  return transit<Online>();
289  }
290  else
291  {
292  // connect when trying to send "+++"
293  return discard_event();
294  }
295  }
296 
297  Command() : StateNotify("Command"), at_out_(AT_BUFFER_CAPACITY)
298  {
299  // in case we start up in Online mode - likely as the @OpMode=1 is the default
300  context<Command>().push_at_command("+++");
301  // the modem seems to like to reset the OpMode
302  context<Command>().push_clam_command("@OpMode=0");
303  }
304  ~Command() override = default;
305 
306  using reactions = boost::mpl::list<
307  boost::statechart::custom_reaction<EvConnect>,
308  boost::statechart::in_state_reaction<EvAck, Command, &Command::in_state_react>,
309  boost::statechart::in_state_reaction<EvTxSerial, Command, &Command::in_state_react>>;
310 
312  {
313  ATSentenceMeta() = default;
314  double last_send_time_{0};
315  int tries_{0};
316  };
317 
318  void push_at_command(std::string cmd)
319  {
320  if (cmd != "+++")
321  cmd = "AT" + cmd;
322 
323  at_out_.push_back(std::make_pair(ATSentenceMeta(), cmd));
324  }
325  void push_clam_command(const std::string& cmd)
326  {
327  at_out_.push_back(std::make_pair(ATSentenceMeta(), cmd));
328  }
329 
330  boost::circular_buffer<std::pair<ATSentenceMeta, std::string> >& at_out() { return at_out_; }
331 
332  private:
333  enum
334  {
335  AT_BUFFER_CAPACITY = 100
336  };
337  boost::circular_buffer<std::pair<ATSentenceMeta, std::string> > at_out_;
338  enum
339  {
340  COMMAND_TIMEOUT_SECONDS = 2
341  };
342 
343  enum
344  {
345  RETRIES_BEFORE_RESET = 10
346  };
347 };
348 
349 struct Configure : boost::statechart::state<Configure, Command>, StateNotify
350 {
351  using reactions = boost::mpl::list<boost::statechart::transition<EvAtEmpty, SetClock>>;
352 
353  Configure(my_context ctx) : my_base(std::move(ctx)), StateNotify("Configure")
354  {
355  context<Command>().push_at_command("");
356 
357  // disable local echo to avoid confusing our parser
358  context<Command>().push_clam_command("@P1EchoChar=Dis");
359 
360  if (context<BenthosATM900FSM>().benthos_driver_cfg().factory_reset())
361  context<Command>().push_clam_command("factory_reset");
362 
363  if (context<BenthosATM900FSM>().benthos_driver_cfg().has_config_load())
364  {
365  context<Command>().push_clam_command(
366  "cfg load " + context<BenthosATM900FSM>().benthos_driver_cfg().config_load());
367  }
368 
369  for (int i = 0, n = context<BenthosATM900FSM>().benthos_driver_cfg().config_size(); i < n;
370  ++i)
371  {
372  context<Command>().push_clam_command(
373  context<BenthosATM900FSM>().benthos_driver_cfg().config(i));
374  }
375 
376  // ensure serial output is the format we expect
377  context<Command>().push_clam_command("@P1Prompt=7");
378  context<Command>().push_clam_command("@Verbose=3");
379 
380  // Goby will handle retries
381  context<Command>().push_clam_command("@DataRetry=0");
382 
383  // Send the data immediately after we post it
384  context<Command>().push_clam_command("@FwdDelay=0.05");
385  context<Command>().push_clam_command(
386  "@LocalAddr=" +
387  goby::util::as<std::string>(context<BenthosATM900FSM>().driver_cfg().modem_id()));
388 
389  // Hex format for data
390  context<Command>().push_clam_command("@PrintHex=Ena");
391 
392  // Wake tones are required so the modem will resume from low power at packet receipt
393  context<Command>().push_clam_command("@WakeTones=Ena");
394 
395  // Receive all packets, let Goby deal with discarding them
396  context<Command>().push_clam_command("@RcvAll=Ena");
397 
398  // Show data for bad packets so we can stats
399  context<Command>().push_clam_command("@ShowBadData=Ena");
400 
401  // start up in Command mode after reboot/lowpower resume
402  context<Command>().push_clam_command("@OpMode=0");
403 
404  // store the current configuration for later inspection
405  // context<Command>().push_clam_command("cfg store /ffs/goby.ini");
406  }
407 
408  ~Configure() override = default;
409 };
410 
411 struct SetClock : boost::statechart::state<SetClock, Command>, StateNotify
412 {
413  using reactions = boost::mpl::list<boost::statechart::transition<EvAtEmpty, Ready>>;
414 
415  SetClock(my_context ctx) : my_base(std::move(ctx)), StateNotify("SetClock")
416  {
417  auto p = time::SystemClock::now<boost::posix_time::ptime>();
418 
419  std::string date_str = boost::str(boost::format("-d%02d/%02d/%04d") %
420  (int)p.date().month() % p.date().day() % p.date().year());
421  std::string time_str =
422  boost::str(boost::format("-t%02d:%02d:%02d") % p.time_of_day().hours() %
423  p.time_of_day().minutes() % p.time_of_day().seconds());
424 
425  context<Command>().push_clam_command("date " + time_str + " " + date_str);
426  }
427 
428  ~SetClock() override = default;
429 };
430 
432 {
433  private:
434  void in_state_react(const EvRequestLowPower&) { context<Command>().push_at_command("L"); }
435 
436  public:
437  Ready() : StateNotify("Ready") {}
438  ~Ready() override = default;
439 
440  using reactions = boost::mpl::list<
441  boost::statechart::transition<EvDial, Dial>, boost::statechart::transition<EvRange, Range>,
442  boost::statechart::in_state_reaction<EvRequestLowPower, Ready, &Ready::in_state_react>,
443  boost::statechart::transition<EvLowPower, LowPower>>;
444 };
445 
446 struct Dial : boost::statechart::state<Dial, Command>, StateNotify
447 {
448  enum
449  {
451  };
452  enum
453  {
455  RATE_MIN = 2,
456  RATE_MAX = 13
457  };
458 
459  Dial(my_context ctx)
460  : my_base(std::move(ctx)),
461  StateNotify("Dial"),
462  dest_(BENTHOS_BROADCAST_ID),
463  rate_(DEFAULT_RATE)
464  {
465  if (const auto* evdial = dynamic_cast<const EvDial*>(triggering_event()))
466  {
467  dest_ = evdial->dest_;
468  if (dest_ == goby::acomms::BROADCAST_ID)
469  dest_ = BENTHOS_BROADCAST_ID;
470 
471  if (evdial->rate_ >= RATE_MIN && evdial->rate_ <= RATE_MAX)
472  rate_ = evdial->rate_;
473  }
474  context<Command>().push_clam_command("@RemoteAddr=" + goby::util::as<std::string>(dest_));
475  context<Command>().push_clam_command("@TxRate=" + goby::util::as<std::string>(rate_));
476  context<Command>().push_at_command("O");
477  }
478  ~Dial() override = default;
479 
480  private:
481  int dest_;
482  int rate_;
483 };
484 
485 struct LowPower : boost::statechart::state<LowPower, Command>, StateNotify
486 {
487  LowPower(my_context ctx) : my_base(std::move(ctx)), StateNotify("LowPower") {}
488  ~LowPower() override = default;
489 };
490 
491 struct Range : boost::statechart::state<Range, Command>, StateNotify
492 {
493  void in_state_react(const EvRxSerial&);
494 
495  Range(my_context ctx) : my_base(std::move(ctx)), StateNotify("Range"), dest_(0)
496  {
497  if (const auto* ev = dynamic_cast<const EvRange*>(triggering_event()))
498  {
499  dest_ = ev->dest_;
500  }
501  context<Command>().push_at_command("R" + goby::util::as<std::string>(dest_));
502  }
503  ~Range() override = default;
504 
505  using reactions = boost::mpl::list<
506  boost::statechart::transition<EvRangingComplete, Ready>,
507  boost::statechart::in_state_reaction<EvRxSerial, Range, &Range::in_state_react>>;
508 
509  private:
510  int dest_;
511 };
512 
513 // Online
514 struct Online : boost::statechart::state<Online, Active, Listen>, StateNotify
515 {
516  Online(my_context ctx) : my_base(std::move(ctx)), StateNotify("Online") {}
517  ~Online() override = default;
518 
519  using reactions = boost::mpl::list<
520  boost::statechart::transition<EvShellPrompt, boost::statechart::deep_history<Command>>>;
521 };
522 
523 struct Listen : boost::statechart::state<Listen, Online>, StateNotify
524 {
525  Listen(my_context ctx) : my_base(std::move(ctx)), StateNotify("Listen")
526  {
527  if (!context<BenthosATM900FSM>().data_out().empty())
529  }
530  ~Listen() override = default;
531 
532  using reactions = boost::mpl::list<boost::statechart::transition<EvTransmit, TransmitData>>;
533 };
534 
535 struct TransmitData : boost::statechart::state<TransmitData, Online>, StateNotify
536 {
537  TransmitData(my_context ctx) : my_base(std::move(ctx)), StateNotify("TransmitData") {}
538  ~TransmitData() override = default;
539 
540  void in_state_react(const EvTxSerial&);
541  void in_state_react(const EvAck&);
542 
543  using reactions = boost::mpl::list<
544  boost::statechart::transition<EvTransmitBegun, Ready>,
545  boost::statechart::in_state_reaction<EvTxSerial, TransmitData,
547  boost::statechart::in_state_reaction<EvAck, TransmitData, &TransmitData::in_state_react>>;
548 };
549 
550 } // namespace fsm
551 } // namespace benthos
552 } // namespace acomms
553 } // namespace goby
554 
556 
557 #endif
goby::acomms::benthos::fsm::TransmitData::TransmitData
TransmitData(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:537
goby::acomms::protobuf::DriverConfig
Definition: driver_base.pb.h:123
goby::acomms::protobuf::ModemTransmission
Definition: modem_message.pb.h:166
goby::acomms::benthos::fsm::EvRequestLowPower
Definition: benthos_atm900_driver_fsm.h:110
goby::acomms::benthos::fsm::ReceiveData::in_state_react
void in_state_react(const EvRxSerial &)
goby::acomms::benthos::fsm::EvRange::EvRange
EvRange(int dest)
Definition: benthos_atm900_driver_fsm.h:106
goby::acomms::benthos::fsm::Online::reactions
boost::mpl::list< boost::statechart::transition< EvShellPrompt, boost::statechart::deep_history< Command > >> reactions
Definition: benthos_atm900_driver_fsm.h:520
goby::acomms::benthos::fsm::Command::in_state_react
void in_state_react(const EvAck &)
goby::acomms::benthos::fsm::Listen::Listen
Listen(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:525
goby::acomms::benthos::fsm::EvAck::response_
std::string response_
Definition: benthos_atm900_driver_fsm.h:86
goby::acomms::benthos::fsm::Active
Definition: benthos_atm900_driver_fsm.h:243
goby::acomms::benthos::fsm::ReceiveData::reactions
boost::mpl::list< boost::statechart::in_state_reaction< EvRxSerial, ReceiveData, &ReceiveData::in_state_react >, boost::statechart::transition< EvReceiveComplete, boost::statechart::deep_history< Command > >> reactions
Definition: benthos_atm900_driver_fsm.h:268
boost::statechart::simple_state< Listen, Online, mpl::list<>, has_no_history >::post_event
void post_event(const event_base_ptr_type &pEvent)
Definition: simple_state.hpp:284
goby::acomms::benthos::fsm::EvLowPower
Definition: benthos_atm900_driver_fsm.h:113
goby::acomms::benthos::fsm::Active::reactions
boost::mpl::list< boost::statechart::transition< EvReset, Active >, boost::statechart::in_state_reaction< EvRxSerial, Active, &Active::in_state_react >, boost::statechart::transition< EvReceive, ReceiveData > > reactions
Definition: benthos_atm900_driver_fsm.h:256
goby::ev
extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::EnumValueOptions, ::google::protobuf::internal::MessageTypeTraits< ::goby::GobyEnumValueOptions >, 11, false > ev
Definition: option_extensions.pb.h:1331
goby::acomms::benthos::fsm::EvShellPrompt
Definition: benthos_atm900_driver_fsm.h:141
goby::acomms::benthos::fsm::Command::ATSentenceMeta::ATSentenceMeta
ATSentenceMeta()=default
system_clock.h
goby::acomms::benthos::fsm::Command::push_at_command
void push_at_command(std::string cmd)
Definition: benthos_atm900_driver_fsm.h:318
goby::util::FlexOstream::is
bool is(goby::util::logger::Verbosity verbosity)
goby::acomms::benthos::fsm::EvReceive::first_
std::string first_
Definition: benthos_atm900_driver_fsm.h:135
goby::acomms::benthos::fsm::EvAck
Definition: benthos_atm900_driver_fsm.h:82
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
boost_statechart_compat.h
goby::acomms::benthos::fsm::ReceiveData::reported_size_
unsigned reported_size_
Definition: benthos_atm900_driver_fsm.h:271
goby::acomms::benthos::fsm::StateNotify::StateNotify
StateNotify(std::string name)
Definition: benthos_atm900_driver_fsm.h:227
as.h
goby::acomms::benthos::fsm::Command::ATSentenceMeta::tries_
int tries_
Definition: benthos_atm900_driver_fsm.h:315
goby::acomms::benthos::fsm::EvConnect
Definition: benthos_atm900_driver_fsm.h:117
goby::acomms::benthos::fsm::EvReceiveComplete
Definition: benthos_atm900_driver_fsm.h:138
goby::acomms::benthos::fsm::SetClock::SetClock
SetClock(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:415
boost::statechart::simple_state< Dial, Command, mpl::list<>, has_no_history >::triggering_event
const event_base * triggering_event() const
Definition: simple_state.hpp:351
goby::acomms::benthos::fsm::EvDial::rate_
int rate_
Definition: benthos_atm900_driver_fsm.h:101
goby::acomms::abc::protobuf::config
extern ::google::protobuf::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::google::protobuf::internal::MessageTypeTraits< ::goby::acomms::abc::protobuf::Config >, 11, false > config
Definition: abc_driver.pb.h:203
goby::acomms::benthos::fsm::EvTxSerial
Definition: benthos_atm900_driver_fsm.h:78
goby::acomms::benthos::fsm::Range
Definition: benthos_atm900_driver_fsm.h:491
goby::acomms::benthos::fsm::EvRange
Definition: benthos_atm900_driver_fsm.h:104
goby::acomms::benthos::fsm::EvRangingComplete
Definition: benthos_atm900_driver_fsm.h:144
event.hpp
goby::acomms::benthos::fsm::TransmitData
Definition: benthos_atm900_driver_fsm.h:535
goby::acomms::BROADCAST_ID
constexpr int BROADCAST_ID
special modem id for the broadcast destination - no one is assigned this address. Analogous to intern...
Definition: acomms_constants.h:43
goby::acomms::benthos::fsm::EvAck::EvAck
EvAck(std::string response)
Definition: benthos_atm900_driver_fsm.h:84
group
goby::util::logger::GroupSetter group(std::string n)
Definition: logger_manipulators.h:134
modem_message.pb.h
boost::statechart::simple_state< Command, Active, Configure, boost::statechart::has_deep_history >::discard_event
result discard_event()
Definition: simple_state.hpp:294
goby::acomms::benthos::fsm::SetClock
Definition: benthos_atm900_driver_fsm.h:411
goby::acomms::benthos::fsm::Dial::Dial
Dial(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:459
flex_ostreambuf.h
goby::acomms::benthos::fsm::Command::Command
Command()
Definition: benthos_atm900_driver_fsm.h:297
goby::time::str
std::string str(TimeType value=SystemClock::now< TimeType >())
Returns the provided time (or current time if omitted) as a human-readable string.
Definition: convert.h:191
goby::acomms::benthos::fsm::Command::react
boost::statechart::result react(const EvConnect &)
Definition: benthos_atm900_driver_fsm.h:283
goby::acomms::benthos::fsm::Dial::RATE_MAX
@ RATE_MAX
Definition: benthos_atm900_driver_fsm.h:456
goby::acomms::benthos::fsm::Range::in_state_react
void in_state_react(const EvRxSerial &)
goby::acomms::benthos::fsm::EvReceive::EvReceive
EvReceive(std::string first)
Definition: benthos_atm900_driver_fsm.h:134
goby::acomms::benthos::fsm::EvRxSerial
Definition: benthos_atm900_driver_fsm.h:74
goby::acomms::benthos::fsm::SetClock::~SetClock
~SetClock() override=default
goby::acomms::benthos::fsm::Command::ATSentenceMeta
Definition: benthos_atm900_driver_fsm.h:311
goby::acomms::benthos::fsm::ReceiveData::ReceiveData
ReceiveData(my_context ctx)
goby::acomms::benthos::fsm::EvNoCarrier
Definition: benthos_atm900_driver_fsm.h:120
goby::acomms::benthos::fsm::Dial::~Dial
~Dial() override=default
goby::acomms::benthos::fsm::BenthosATM900FSM
Definition: benthos_atm900_driver_fsm.h:162
benthos_atm900.pb.h
goby::acomms::benthos::fsm::EvDial
Definition: benthos_atm900_driver_fsm.h:96
goby::acomms::benthos::fsm::Online
Definition: benthos_atm900_driver_fsm.h:514
boost::statechart::simple_state
Definition: simple_state.hpp:191
boost::statechart::event
Definition: event.hpp:30
goby::acomms::benthos::fsm::EvDial::dest_
int dest_
Definition: benthos_atm900_driver_fsm.h:100
goby::acomms::benthos::fsm::Command::~Command
~Command() override=default
goby::acomms::benthos::fsm::EvRxSerial::line
std::string line
Definition: benthos_atm900_driver_fsm.h:76
driver_base.pb.h
goby::acomms::benthos::fsm::Range::Range
Range(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:495
goby::acomms::benthos::fsm::Listen::reactions
boost::mpl::list< boost::statechart::transition< EvTransmit, TransmitData > > reactions
Definition: benthos_atm900_driver_fsm.h:532
goby::acomms::benthos::fsm::BenthosATM900FSM::benthos_driver_cfg
const goby::acomms::benthos::protobuf::Config & benthos_driver_cfg() const
Definition: benthos_atm900_driver_fsm.h:193
goby::acomms::benthos::fsm::EvDial::EvDial
EvDial(int dest, int rate)
Definition: benthos_atm900_driver_fsm.h:98
goby::acomms::benthos::fsm::Configure::reactions
boost::mpl::list< boost::statechart::transition< EvAtEmpty, SetClock > > reactions
Definition: benthos_atm900_driver_fsm.h:351
goby::acomms::benthos::fsm::Configure::Configure
Configure(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:353
goby::acomms::benthos::fsm::BenthosATM900FSM::driver_cfg
const goby::acomms::protobuf::DriverConfig & driver_cfg() const
Definition: benthos_atm900_driver_fsm.h:192
goby::acomms::benthos::fsm::EvTransmit
Definition: benthos_atm900_driver_fsm.h:124
goby::acomms::benthos::fsm::Dial::RATE_MIN
@ RATE_MIN
Definition: benthos_atm900_driver_fsm.h:455
goby::acomms::benthos::fsm::BenthosATM900FSM::buffer_data_out
void buffer_data_out(const goby::acomms::protobuf::ModemTransmission &msg)
goby::acomms::benthos::fsm::TransmitData::~TransmitData
~TransmitData() override=default
goby::acomms::benthos::fsm::Range::~Range
~Range() override=default
goby::acomms::benthos::fsm::Online::~Online
~Online() override=default
goby::acomms::benthos::fsm::EvTransmitBegun
Definition: benthos_atm900_driver_fsm.h:128
goby::acomms::benthos::fsm::EvReceive
Definition: benthos_atm900_driver_fsm.h:132
goby::acomms::benthos::fsm::Configure::~Configure
~Configure() override=default
goby::acomms::benthos::fsm::LowPower::~LowPower
~LowPower() override=default
goby::acomms::benthos::fsm::Dial
Definition: benthos_atm900_driver_fsm.h:446
goby::acomms::benthos::fsm::Command::at_out
boost::circular_buffer< std::pair< ATSentenceMeta, std::string > > & at_out()
Definition: benthos_atm900_driver_fsm.h:330
goby::acomms::benthos::fsm::LowPower::LowPower
LowPower(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:487
goby::acomms::benthos::fsm::Range::reactions
boost::mpl::list< boost::statechart::transition< EvRangingComplete, Ready >, boost::statechart::in_state_reaction< EvRxSerial, Range, &Range::in_state_react > > reactions
Definition: benthos_atm900_driver_fsm.h:507
goby::acomms::benthos::fsm::Online::Online
Online(my_context ctx)
Definition: benthos_atm900_driver_fsm.h:516
goby::acomms::benthos::fsm::TransmitData::reactions
boost::mpl::list< boost::statechart::transition< EvTransmitBegun, Ready >, boost::statechart::in_state_reaction< EvTxSerial, TransmitData, &TransmitData::in_state_react >, boost::statechart::in_state_reaction< EvAck, TransmitData, &TransmitData::in_state_react > > reactions
Definition: benthos_atm900_driver_fsm.h:547
goby::acomms::benthos::fsm::TransmitData::in_state_react
void in_state_react(const EvTxSerial &)
boost::statechart::state_machine
Definition: state_machine.hpp:235
flex_ostream.h
goby::msg
extern ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, ::google::protobuf::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
Definition: option_extensions.pb.h:1327
goby::acomms::benthos::fsm::Command::push_clam_command
void push_clam_command(const std::string &cmd)
Definition: benthos_atm900_driver_fsm.h:325
goby::acomms::benthos::protobuf::config
extern ::google::protobuf::internal::ExtensionIdentifier< ::goby::acomms::protobuf::DriverConfig, ::google::protobuf::internal::MessageTypeTraits< ::goby::acomms::benthos::protobuf::Config >, 11, false > config
Definition: benthos_atm900.pb.h:944
goby::acomms::benthos::fsm::BenthosATM900FSM::data_out
boost::circular_buffer< goby::acomms::protobuf::ModemTransmission > & data_out()
Definition: benthos_atm900_driver_fsm.h:187
goby::acomms::benthos::fsm::BenthosATM900FSM::BenthosATM900FSM
BenthosATM900FSM(const goby::acomms::protobuf::DriverConfig &driver_cfg)
Definition: benthos_atm900_driver_fsm.h:165
goby::acomms::benthos::fsm::EvRange::dest_
int dest_
Definition: benthos_atm900_driver_fsm.h:107
simple_state.hpp
goby::acomms::benthos::fsm::ReceiveData
Definition: benthos_atm900_driver_fsm.h:259
convert.h
goby::acomms::benthos::fsm::EvReset
Definition: benthos_atm900_driver_fsm.h:92
goby::acomms::benthos::fsm::ReceiveData::encoded_bytes_
std::string encoded_bytes_
Definition: benthos_atm900_driver_fsm.h:272
logger_manipulators.h
goby::acomms::benthos::fsm::LowPower
Definition: benthos_atm900_driver_fsm.h:485
goby::acomms::benthos::fsm::Listen
Definition: benthos_atm900_driver_fsm.h:523
goby::acomms::benthos::fsm::ReceiveData::rx_msg_
goby::acomms::protobuf::ModemTransmission rx_msg_
Definition: benthos_atm900_driver_fsm.h:270
goby::acomms::benthos::fsm::EvAtEmpty
Definition: benthos_atm900_driver_fsm.h:89
goby::acomms::benthos::fsm::Command::ATSentenceMeta::last_send_time_
double last_send_time_
Definition: benthos_atm900_driver_fsm.h:314
goby::acomms::benthos::fsm::ReceiveData::~ReceiveData
~ReceiveData() override=default
goby::acomms::benthos::fsm::StateNotify::~StateNotify
~StateNotify()
Definition: benthos_atm900_driver_fsm.h:232
goby::acomms::benthos::fsm::Command
Definition: benthos_atm900_driver_fsm.h:276
boost::statechart::state
Definition: state.hpp:28
goby::acomms::benthos::fsm::BenthosATM900FSM::serial_tx_buffer
boost::circular_buffer< std::string > & serial_tx_buffer()
Definition: benthos_atm900_driver_fsm.h:178
goby::acomms::benthos::fsm::Ready::reactions
boost::mpl::list< boost::statechart::transition< EvDial, Dial >, boost::statechart::transition< EvRange, Range >, boost::statechart::in_state_reaction< EvRequestLowPower, Ready, &Ready::in_state_react >, boost::statechart::transition< EvLowPower, LowPower > > reactions
Definition: benthos_atm900_driver_fsm.h:443
state.hpp
goby::util::logger::DEBUG1
@ DEBUG1
Definition: flex_ostreambuf.h:77
goby::acomms::benthos::fsm::Dial::BENTHOS_BROADCAST_ID
@ BENTHOS_BROADCAST_ID
Definition: benthos_atm900_driver_fsm.h:450
goby::acomms::benthos::fsm::Active::~Active
~Active() override=default
goby::acomms::benthos::fsm::SetClock::reactions
boost::mpl::list< boost::statechart::transition< EvAtEmpty, Ready > > reactions
Definition: benthos_atm900_driver_fsm.h:413
goby::acomms::benthos::fsm::StateNotify
Definition: benthos_atm900_driver_fsm.h:225
goby::glog
util::FlexOstream glog
Access the Goby logger through this object.
goby::acomms::benthos::fsm::Ready
Definition: benthos_atm900_driver_fsm.h:431
acomms_constants.h
goby::acomms::benthos::fsm::BenthosATM900FSM::received
boost::circular_buffer< goby::acomms::protobuf::ModemTransmission > & received()
Definition: benthos_atm900_driver_fsm.h:181
goby::acomms::benthos::fsm::Configure
Definition: benthos_atm900_driver_fsm.h:349
state_machine.hpp
goby::acomms::benthos::fsm::Listen::~Listen
~Listen() override=default
goby::acomms::benthos::fsm::Active::in_state_react
void in_state_react(const EvRxSerial &)
goby::acomms::benthos::fsm::Dial::DEFAULT_RATE
@ DEFAULT_RATE
Definition: benthos_atm900_driver_fsm.h:454
goby::acomms::benthos::fsm::BenthosATM900FSM::glog_fsm_group
const std::string & glog_fsm_group() const
Definition: benthos_atm900_driver_fsm.h:198
goby::acomms::benthos::fsm::Ready::~Ready
~Ready() override=default
goby::acomms::benthos::protobuf::Config
Definition: benthos_atm900.pb.h:138
goby::acomms::benthos::fsm::Command::reactions
boost::mpl::list< boost::statechart::custom_reaction< EvConnect >, boost::statechart::in_state_reaction< EvAck, Command, &Command::in_state_react >, boost::statechart::in_state_reaction< EvTxSerial, Command, &Command::in_state_react > > reactions
Definition: benthos_atm900_driver_fsm.h:309
goby::acomms::benthos::fsm::Ready::Ready
Ready()
Definition: benthos_atm900_driver_fsm.h:437
goby::acomms::benthos::fsm::Active::Active
Active()
Definition: benthos_atm900_driver_fsm.h:247