io.hpp
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // © Copyright 2020, Septentrio NV/SA.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // 1. Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // 2. Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // 3. Neither the name of the copyright holder nor the names of its
14 // contributors may be used to endorse or promote products derived
15 // from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 // *****************************************************************************
30 
31 #pragma once
32 
33 // C++
34 #include <thread>
35 
36 // Linux
37 #include <linux/input.h>
38 #include <linux/serial.h>
39 
40 // Boost
41 #include <boost/asio.hpp>
42 
43 // pcap
44 #include <pcap.h>
45 
46 // ROSaic
49 
51 const static std::array<uint32_t, 21> baudrates = {
52  1200, 2400, 4800, 9600, 19200, 38400, 57600,
53  115200, 230400, 460800, 500000, 576000, 921600, 1000000,
54  1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000};
55 
56 namespace io {
57 
58  class UdpClient
59  {
60  public:
61  UdpClient(ROSaicNodeBase* node, int16_t port, TelegramQueue* telegramQueue) :
62  node_(node), running_(true), port_(port), telegramQueue_(telegramQueue)
63  {
64  connect();
66  std::thread(boost::bind(&UdpClient::runWatchdog, this));
67  }
68 
70  {
71  running_ = false;
72 
73  node_->log(log_level::INFO, "UDP client shutting down threads");
74  ioService_.stop();
75  ioThread_.join();
76  watchdogThread_.join();
77  node_->log(log_level::INFO, " UDP client threads stopped");
78  }
79 
80  private:
81  void connect()
82  {
83  socket_.reset(new boost::asio::ip::udp::socket(
84  ioService_,
85  boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port_)));
86 
87  asyncReceive();
88 
89  ioThread_ = std::thread(boost::bind(&UdpClient::runIoService, this));
90 
92  "Listening on UDP port " + std::to_string(port_));
93  }
94 
95  void asyncReceive()
96 
97  {
98  socket_->async_receive_from(
99  boost::asio::buffer(buffer_, MAX_UDP_PACKET_SIZE), eP_,
100  boost::bind(&UdpClient::handleReceive, this,
101  boost::asio::placeholders::error,
102  boost::asio::placeholders::bytes_transferred));
103  }
104 
105  void handleReceive(const boost::system::error_code& error,
106  size_t bytes_recvd)
107  {
108  Timestamp stamp = node_->getTime();
109  size_t idx = 0;
110 
111  if (!error && (bytes_recvd > 0))
112  {
113  while ((bytes_recvd - idx) > 2)
114  {
115  std::shared_ptr<Telegram> telegram(new Telegram);
116  telegram->stamp = stamp;
117  /*node_->log(log_level::DEBUG,
118  "Buffer: " + std::string(telegram->message.begin(),
119  telegram->message.end()));*/
120  if (buffer_[idx] == SYNC_BYTE_1)
121  {
122  if (buffer_[idx + 1] == SBF_SYNC_BYTE_2)
123  {
124  if ((bytes_recvd - idx) > SBF_HEADER_SIZE)
125  {
127  &buffer_[idx + 6]);
128  telegram->message.assign(&buffer_[idx],
129  &buffer_[idx + length]);
130  if (crc::isValid(telegram->message))
131  {
132  telegram->type = telegram_type::SBF;
133  telegramQueue_->push(telegram);
134  } else
135  node_->log(
137  "AsyncManager crc failed for SBF " +
138  std::to_string(parsing_utilities::getId(
139  telegram->message)) +
140  ".");
141 
142  idx += length;
143  }
144 
145  } else if ((buffer_[idx + 1] == NMEA_SYNC_BYTE_2) &&
146  (buffer_[idx + 2] == NMEA_SYNC_BYTE_3))
147  {
148  size_t idx_end = findNmeaEnd(idx, bytes_recvd);
149  telegram->message.assign(&buffer_[idx],
150  &buffer_[idx_end + 1]);
151  telegram->type = telegram_type::NMEA;
152  telegramQueue_->push(telegram);
153  idx = idx_end + 1;
154 
155  } else if ((buffer_[idx + 1] == NMEA_INS_SYNC_BYTE_2) &&
156  (buffer_[idx + 2] == NMEA_INS_SYNC_BYTE_3))
157  {
158  size_t idx_end = findNmeaEnd(idx, bytes_recvd);
159  telegram->message.assign(&buffer_[idx],
160  &buffer_[idx_end + 1]);
161  telegram->type = telegram_type::NMEA_INS;
162  telegramQueue_->push(telegram);
163  idx = idx_end + 1;
164  } else
165  {
167  "head: " +
168  std::string(std::string(
169  telegram->message.begin(),
170  telegram->message.begin() + 2)));
171  }
172  } else
173  {
174  node_->log(log_level::DEBUG, "UDP msg resync.");
175  ++idx;
176  }
177  }
178  } else
179  {
181  "UDP client receive error: " + error.message());
182  }
183 
184  asyncReceive();
185  }
186 
188  {
189  ioService_.run();
190  node_->log(log_level::INFO, "UDP client ioService terminated.");
191  }
192 
193  void runWatchdog()
194  {
195  while (running_)
196  {
197  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
198 
199  if (running_ && ioService_.stopped())
200  {
202  "UDP client connection lost. Trying to reconnect.");
203  ioService_.reset();
204  ioThread_.join();
205  connect();
206  }
207  }
208  }
209 
210  private:
211  size_t findNmeaEnd(size_t idx, size_t bytes_recvd)
212  {
213  size_t idx_end = idx + 2;
214 
215  while (idx_end < bytes_recvd)
216  {
217  if ((buffer_[idx_end] == LF) && (buffer_[idx_end - 1] == CR))
218  break;
219 
220  ++idx_end;
221  }
222  return idx_end;
223  }
226  std::atomic<bool> running_;
227  int16_t port_;
228  boost::asio::io_service ioService_;
229  std::thread ioThread_;
230  std::thread watchdogThread_;
231  boost::asio::ip::udp::endpoint eP_;
232  std::unique_ptr<boost::asio::ip::udp::socket> socket_;
233  std::array<uint8_t, MAX_UDP_PACKET_SIZE> buffer_;
235  };
236 
237  class TcpIo
238  {
239  public:
241  std::shared_ptr<boost::asio::io_service> ioService) :
242  node_(node),
243  ioService_(ioService)
244  {
246  }
247 
248  ~TcpIo() { stream_->close(); }
249 
250  void close() { stream_->close(); }
251 
252  void setPort(const std::string& port) { port_ = port; }
253 
254  [[nodiscard]] bool connect()
255  {
256  boost::asio::ip::tcp::resolver::iterator endpointIterator;
257 
258  try
259  {
260  boost::asio::ip::tcp::resolver resolver(*ioService_);
261  boost::asio::ip::tcp::resolver::query query(
263  endpointIterator = resolver.resolve(query);
264  } catch (std::runtime_error& e)
265  {
267  "Could not resolve " + node_->settings()->device_tcp_ip +
268  " on port " + port_ + ": " + e.what());
269  return false;
270  }
271 
272  stream_.reset(new boost::asio::ip::tcp::socket(*ioService_));
273 
274  node_->log(log_level::INFO, "Connecting to tcp://" +
275  node_->settings()->device_tcp_ip + ":" +
276  port_ + "...");
277 
278  try
279  {
280  stream_->connect(*endpointIterator);
281 
282  stream_->set_option(boost::asio::ip::tcp::no_delay(true));
283 
285  "Connected to " + endpointIterator->host_name() + ":" +
286  endpointIterator->service_name() + ".");
287  } catch (std::runtime_error& e)
288  {
290  "Could not connect to " + endpointIterator->host_name() +
291  ": " + endpointIterator->service_name() + ": " +
292  e.what());
293  return false;
294  }
295  return true;
296  }
297 
298  private:
300  std::shared_ptr<boost::asio::io_service> ioService_;
301 
302  std::string port_;
303 
304  public:
305  std::unique_ptr<boost::asio::ip::tcp::socket> stream_;
306  };
307 
308  class SerialIo
309  {
310  public:
312  std::shared_ptr<boost::asio::io_service> ioService) :
313  node_(node),
314  ioService_(ioService), flowcontrol_(node->settings()->hw_flow_control),
315  baudrate_(node->settings()->baudrate)
316  {
317  stream_.reset(new boost::asio::serial_port(*ioService_));
318  }
319 
320  ~SerialIo() { stream_->close(); }
321 
322  void close() { stream_->close(); }
323 
324  [[nodiscard]] bool connect()
325  {
326  if (stream_->is_open())
327  {
328  stream_->close();
329  }
330 
331  bool opened = false;
332 
333  while (!opened)
334  {
335  try
336  {
338  "Connecting serially to device " +
339  node_->settings()->device +
340  ", targeted baudrate: " +
341  std::to_string(node_->settings()->baudrate));
342  stream_->open(node_->settings()->device);
343  opened = true;
344  } catch (const boost::system::system_error& err)
345  {
346  node_->log(log_level::ERROR, "Could not open serial port " +
347  node_->settings()->device +
348  ". Error: " + err.what() +
349  ". Will retry every second.");
350 
351  using namespace std::chrono_literals;
352  std::this_thread::sleep_for(1s);
353  }
354  }
355 
356  // No Parity, 8bits data, 1 stop Bit
357  stream_->set_option(boost::asio::serial_port_base::baud_rate(baudrate_));
358  stream_->set_option(boost::asio::serial_port_base::parity(
359  boost::asio::serial_port_base::parity::none));
360  stream_->set_option(boost::asio::serial_port_base::character_size(8));
361  stream_->set_option(boost::asio::serial_port_base::stop_bits(
362  boost::asio::serial_port_base::stop_bits::one));
363 
364  // Hardware flow control settings
365  if (flowcontrol_ == "RTS|CTS")
366  {
367  stream_->set_option(boost::asio::serial_port_base::flow_control(
368  boost::asio::serial_port_base::flow_control::hardware));
369  } else
370  {
371  stream_->set_option(boost::asio::serial_port_base::flow_control(
372  boost::asio::serial_port_base::flow_control::none));
373  }
374 
375  // Set low latency
376  int fd = stream_->native_handle();
377  struct serial_struct serialInfo;
378  ioctl(fd, TIOCGSERIAL, &serialInfo);
379  serialInfo.flags |= ASYNC_LOW_LATENCY;
380  ioctl(fd, TIOCSSERIAL, &serialInfo);
381 
382  return setBaudrate();
383  }
384 
385  [[nodiscard]] bool setBaudrate()
386  {
387  // Setting the baudrate, incrementally..
389  "Gradually increasing the baudrate to the desired value...");
390  boost::asio::serial_port_base::baud_rate current_baudrate;
391  node_->log(log_level::DEBUG, "Initiated current_baudrate object...");
392  try
393  {
394  stream_->get_option(current_baudrate); // Note that this sets
395  // current_baudrate.value()
396  // often to 115200, since by
397  // default, all Rx COM ports,
398  // at least for mosaic Rxs, are set to a baudrate of 115200 baud,
399  // using 8 data-bits, no parity and 1 stop-bit.
400  } catch (boost::system::system_error& e)
401  {
402 
403  node_->log(log_level::ERROR, "get_option failed due to " +
404  static_cast<std::string>(e.what()));
405  node_->log(log_level::INFO, "Additional info about error is " +
406  static_cast<std::string>(e.what()));
407  /*
408  boost::system::error_code e_loop;
409  do // Caution: Might cause infinite loop..
410  {
411  stream_->get_option(current_baudrate, e_loop);
412  } while(e_loop);
413  */
414  return false;
415  }
416  // Gradually increase the baudrate to the desired value
417  // The desired baudrate can be lower or larger than the
418  // current baudrate; the for loop takes care of both scenarios.
420  "Current baudrate is " +
421  std::to_string(current_baudrate.value()));
422  for (uint8_t i = 0; i < baudrates.size(); i++)
423  {
424  if (current_baudrate.value() == baudrate_)
425  {
426  break; // Break if the desired baudrate has been reached.
427  }
428  if (current_baudrate.value() >= baudrates[i] &&
429  baudrate_ > baudrates[i])
430  {
431  continue;
432  }
433  // Increment until Baudrate[i] matches current_baudrate.
434  try
435  {
436  stream_->set_option(
437  boost::asio::serial_port_base::baud_rate(baudrates[i]));
438  } catch (boost::system::system_error& e)
439  {
440 
442  "set_option failed due to " +
443  static_cast<std::string>(e.what()));
445  "Additional info about error is " +
446  static_cast<std::string>(e.what()));
447  return false;
448  }
449  using namespace std::chrono_literals;
450  std::this_thread::sleep_for(500ms);
451 
452  try
453  {
454  stream_->get_option(current_baudrate);
455  } catch (boost::system::system_error& e)
456  {
457 
459  "get_option failed due to " +
460  static_cast<std::string>(e.what()));
462  "Additional info about error is " +
463  static_cast<std::string>(e.what()));
464  /*
465  boost::system::error_code e_loop;
466  do // Caution: Might cause infinite loop..
467  {
468  stream_->get_option(current_baudrate, e_loop);
469  } while(e_loop);
470  */
471  return false;
472  }
474  "Set ASIO baudrate to " +
475  std::to_string(current_baudrate.value()));
476  }
478  "Set ASIO baudrate to " +
479  std::to_string(current_baudrate.value()) +
480  ", leaving InitializeSerial() method");
481 
482  // clear io
483  ::tcflush(stream_->native_handle(), TCIOFLUSH);
484 
485  return true;
486  }
487 
488  private:
490  std::shared_ptr<boost::asio::io_service> ioService_;
491  std::string flowcontrol_;
492  uint32_t baudrate_;
493 
494  public:
495  std::unique_ptr<boost::asio::serial_port> stream_;
496  };
497 
498  class SbfFileIo
499  {
500  public:
502  std::shared_ptr<boost::asio::io_service> ioService) :
503  node_(node),
504  ioService_(ioService)
505  {
506  }
507 
508  ~SbfFileIo() { stream_->close(); }
509 
510  void close() { stream_->close(); }
511 
512  [[nodiscard]] bool connect()
513  {
514  node_->log(log_level::INFO, "Opening SBF file stream" +
515  node_->settings()->device + "...");
516 
517  int fd = open(node_->settings()->device.c_str(), O_RDONLY);
518  if (fd == -1)
519  {
520  node_->log(log_level::ERROR, "open SBF file failed.");
521  return false;
522  }
523 
524  try
525  {
526  stream_.reset(
527  new boost::asio::posix::stream_descriptor(*ioService_));
528  stream_->assign(fd);
529 
530  } catch (std::runtime_error& e)
531  {
532  node_->log(log_level::ERROR, "assigning SBF file failed due to " +
533  static_cast<std::string>(e.what()));
534  return false;
535  }
536  return true;
537  }
538 
539  private:
541  std::shared_ptr<boost::asio::io_service> ioService_;
542 
543  public:
544  std::unique_ptr<boost::asio::posix::stream_descriptor> stream_;
545  };
546 
548  {
549  public:
551  std::shared_ptr<boost::asio::io_service> ioService) :
552  node_(node),
553  ioService_(ioService)
554  {
555  }
556 
558  {
559  pcap_close(pcap_);
560  stream_->close();
561  }
562 
563  void close()
564  {
565  pcap_close(pcap_);
566  stream_->close();
567  }
568 
569  [[nodiscard]] bool connect()
570  {
571  try
572  {
573  node_->log(log_level::INFO, "Opening pcap file stream" +
574  node_->settings()->device + "...");
575 
576  stream_.reset(
577  new boost::asio::posix::stream_descriptor(*ioService_));
578 
579  pcap_ = pcap_open_offline(node_->settings()->device.c_str(),
580  errBuff_.data());
581  stream_->assign(pcap_get_selectable_fd(pcap_));
582 
583  } catch (std::runtime_error& e)
584  {
585  node_->log(log_level::ERROR, "assigning PCAP file failed due to " +
586  static_cast<std::string>(e.what()));
587  return false;
588  }
589  return true;
590  }
591 
592  private:
594  std::shared_ptr<boost::asio::io_service> ioService_;
595  std::array<char, 100> errBuff_;
596  pcap_t* pcap_;
597 
598  public:
599  std::unique_ptr<boost::asio::posix::stream_descriptor> stream_;
600  };
601 } // namespace io
log_level::DEBUG
@ DEBUG
Definition: typedefs.hpp:172
io::PcapFileIo::connect
bool connect()
Definition: io.hpp:569
io::UdpClient
Definition: io.hpp:58
crc::isValid
bool isValid(const std::vector< uint8_t > &message)
Validates whether the calculated CRC of the SBF block at hand matches the CRC field of the streamed S...
Definition: crc.cpp:71
Timestamp
uint64_t Timestamp
Definition: typedefs.hpp:92
NMEA_INS_SYNC_BYTE_3
static const uint8_t NMEA_INS_SYNC_BYTE_3
0x4E is ASCII for N - 3rd byte to indicate NMEA-type ASCII message
Definition: telegram.hpp:54
ConcurrentQueue< std::shared_ptr< Telegram > >
io::UdpClient::port_
int16_t port_
Definition: io.hpp:227
io::TcpIo::connect
bool connect()
Definition: io.hpp:254
io::UdpClient::socket_
std::unique_ptr< boost::asio::ip::udp::socket > socket_
Definition: io.hpp:232
io::PcapFileIo::PcapFileIo
PcapFileIo(ROSaicNodeBase *node, std::shared_ptr< boost::asio::io_service > ioService)
Definition: io.hpp:550
telegram_type::NMEA_INS
@ NMEA_INS
Definition: telegram.hpp:96
ROSaicNodeBase::log
void log(log_level::LogLevel logLevel, const std::string &s) const
Log function to provide abstraction of ROS loggers.
Definition: typedefs.hpp:257
s
XmlRpcServer s
io::SerialIo::~SerialIo
~SerialIo()
Definition: io.hpp:320
io::SerialIo::ioService_
std::shared_ptr< boost::asio::io_service > ioService_
Definition: io.hpp:490
io::TcpIo::close
void close()
Definition: io.hpp:250
io::UdpClient::runIoService
void runIoService()
Definition: io.hpp:187
SYNC_BYTE_1
static const uint8_t SYNC_BYTE_1
0x24 is ASCII for $ - 1st byte in each message
Definition: telegram.hpp:44
io::TcpIo::stream_
std::unique_ptr< boost::asio::ip::tcp::socket > stream_
Definition: io.hpp:305
io::SbfFileIo::close
void close()
Definition: io.hpp:510
telegram.hpp
io::UdpClient::watchdogThread_
std::thread watchdogThread_
Definition: io.hpp:230
telegram_type::NMEA
@ NMEA
Definition: telegram.hpp:95
log_level::INFO
@ INFO
Definition: typedefs.hpp:173
io::SerialIo::setBaudrate
bool setBaudrate()
Definition: io.hpp:385
ROSaicNodeBase
This class is the base class for abstraction.
Definition: typedefs.hpp:184
io::UdpClient::ioThread_
std::thread ioThread_
Definition: io.hpp:229
io::UdpClient::ioService_
boost::asio::io_service ioService_
Definition: io.hpp:228
io::UdpClient::~UdpClient
~UdpClient()
Definition: io.hpp:69
Settings::baudrate
uint32_t baudrate
Baudrate.
Definition: settings.hpp:155
io::UdpClient::running_
std::atomic< bool > running_
Definition: io.hpp:226
io::UdpClient::connect
void connect()
Definition: io.hpp:81
io::SerialIo
Definition: io.hpp:308
parsing_utilities::parseUInt16
uint16_t parseUInt16(const uint8_t *buffer)
Converts a 2-byte-buffer into an unsigned 16-bit integer.
Definition: parsing_utilities.cpp:173
baudrates
const static std::array< uint32_t, 21 > baudrates
Possible baudrates for the Rx.
Definition: io.hpp:51
SBF_SYNC_BYTE_2
static const uint8_t SBF_SYNC_BYTE_2
0x40 is ASCII for @ - 2nd byte to indicate SBF block
Definition: telegram.hpp:46
io::UdpClient::telegramQueue_
TelegramQueue * telegramQueue_
Definition: io.hpp:234
io::PcapFileIo::node_
ROSaicNodeBase * node_
Definition: io.hpp:593
io::PcapFileIo::stream_
std::unique_ptr< boost::asio::posix::stream_descriptor > stream_
Definition: io.hpp:599
io::SbfFileIo::connect
bool connect()
Definition: io.hpp:512
io::SerialIo::stream_
std::unique_ptr< boost::asio::serial_port > stream_
Definition: io.hpp:495
ROSaicNodeBase::settings
const Settings * settings() const
Definition: typedefs.hpp:194
io::SerialIo::flowcontrol_
std::string flowcontrol_
Definition: io.hpp:491
io
Definition: async_manager.hpp:83
io::TcpIo::TcpIo
TcpIo(ROSaicNodeBase *node, std::shared_ptr< boost::asio::io_service > ioService)
Definition: io.hpp:240
io::UdpClient::node_
ROSaicNodeBase * node_
Pointer to the node.
Definition: io.hpp:225
io::TcpIo::~TcpIo
~TcpIo()
Definition: io.hpp:248
ConcurrentQueue::push
void push(const T &input) noexcept
Definition: telegram.hpp:181
io::UdpClient::handleReceive
void handleReceive(const boost::system::error_code &error, size_t bytes_recvd)
Definition: io.hpp:105
parsing_utilities::getId
uint16_t getId(const std::vector< uint8_t > &message)
Get the ID of the SBF message.
Definition: parsing_utilities.cpp:419
Settings::device_tcp_port
std::string device_tcp_port
TCP port.
Definition: settings.hpp:134
Telegram
Definition: telegram.hpp:104
io::SbfFileIo::~SbfFileIo
~SbfFileIo()
Definition: io.hpp:508
io::UdpClient::buffer_
std::array< uint8_t, MAX_UDP_PACKET_SIZE > buffer_
Definition: io.hpp:233
log_level::ERROR
@ ERROR
Definition: typedefs.hpp:175
typedefs.hpp
io::UdpClient::runWatchdog
void runWatchdog()
Definition: io.hpp:193
io::SerialIo::SerialIo
SerialIo(ROSaicNodeBase *node, std::shared_ptr< boost::asio::io_service > ioService)
Definition: io.hpp:311
io::SbfFileIo::node_
ROSaicNodeBase * node_
Definition: io.hpp:540
io::SerialIo::connect
bool connect()
Definition: io.hpp:324
io::SbfFileIo::SbfFileIo
SbfFileIo(ROSaicNodeBase *node, std::shared_ptr< boost::asio::io_service > ioService)
Definition: io.hpp:501
io::PcapFileIo::close
void close()
Definition: io.hpp:563
io::TcpIo
Definition: io.hpp:237
SBF_HEADER_SIZE
static const uint16_t SBF_HEADER_SIZE
Definition: telegram.hpp:86
io::SerialIo::close
void close()
Definition: io.hpp:322
io::SerialIo::baudrate_
uint32_t baudrate_
Definition: io.hpp:492
io::PcapFileIo::errBuff_
std::array< char, 100 > errBuff_
Definition: io.hpp:595
ROSaicNodeBase::getTime
Timestamp getTime() const
Gets current timestamp.
Definition: typedefs.hpp:285
Settings::device_tcp_ip
std::string device_tcp_ip
TCP IP.
Definition: settings.hpp:132
io::UdpClient::eP_
boost::asio::ip::udp::endpoint eP_
Definition: io.hpp:231
io::PcapFileIo::~PcapFileIo
~PcapFileIo()
Definition: io.hpp:557
io::TcpIo::port_
std::string port_
Definition: io.hpp:302
io::TcpIo::setPort
void setPort(const std::string &port)
Definition: io.hpp:252
NMEA_SYNC_BYTE_2
static const uint8_t NMEA_SYNC_BYTE_2
0x47 is ASCII for G - 2nd byte to indicate NMEA-type ASCII message
Definition: telegram.hpp:48
io::PcapFileIo::ioService_
std::shared_ptr< boost::asio::io_service > ioService_
Definition: io.hpp:594
io::UdpClient::asyncReceive
void asyncReceive()
Definition: io.hpp:95
NMEA_INS_SYNC_BYTE_2
static const uint8_t NMEA_INS_SYNC_BYTE_2
0x49 is ASCII for I - 2nd byte to indicate INS NMEA-type ASCII message
Definition: telegram.hpp:52
telegram_type::SBF
@ SBF
Definition: telegram.hpp:94
CR
static const uint8_t CR
0x0D is ASCII for "Carriage Return", i.e. "Enter"
Definition: telegram.hpp:65
length
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
io::SbfFileIo::stream_
std::unique_ptr< boost::asio::posix::stream_descriptor > stream_
Definition: io.hpp:544
io::SbfFileIo::ioService_
std::shared_ptr< boost::asio::io_service > ioService_
Definition: io.hpp:541
io::TcpIo::node_
ROSaicNodeBase * node_
Definition: io.hpp:299
io::TcpIo::ioService_
std::shared_ptr< boost::asio::io_service > ioService_
Definition: io.hpp:300
NMEA_SYNC_BYTE_3
static const uint8_t NMEA_SYNC_BYTE_3
0x50 is ASCII for P - 3rd byte to indicate NMEA-type ASCII message
Definition: telegram.hpp:50
Settings::device
std::string device
Device.
Definition: settings.hpp:128
io::SbfFileIo
Definition: io.hpp:498
io::UdpClient::findNmeaEnd
size_t findNmeaEnd(size_t idx, size_t bytes_recvd)
Definition: io.hpp:211
io::PcapFileIo::pcap_
pcap_t * pcap_
Definition: io.hpp:596
io::UdpClient::UdpClient
UdpClient(ROSaicNodeBase *node, int16_t port, TelegramQueue *telegramQueue)
Definition: io.hpp:61
io::SerialIo::node_
ROSaicNodeBase * node_
Definition: io.hpp:489
LF
static const uint8_t LF
0x0A is ASCII for "Line Feed", i.e. "New Line"
Definition: telegram.hpp:67
io::PcapFileIo
Definition: io.hpp:547
MAX_UDP_PACKET_SIZE
static const uint16_t MAX_UDP_PACKET_SIZE
Definition: telegram.hpp:88


septentrio_gnss_driver
Author(s): Tibor Dome
autogenerated on Wed Nov 22 2023 04:04:27