GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
nmea_printer.h
Go to the documentation of this file.
1 /*!
2  * \file nmea_printer.h
3  * \brief Interface of a NMEA 2.1 printer for GNSS-SDR
4  * This class provides a implementation of a subset of the NMEA-0183 standard for interfacing
5  * marine electronic devices as defined by the National Marine Electronics Association (NMEA).
6  * See https://www.nmea.org/ for the NMEA 183 standard
7  *
8  * \author Javier Arribas, 2012. jarribas(at)cttc.es
9  *
10  *
11  * -----------------------------------------------------------------------------
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  *
15  * GNSS-SDR is a software defined Global Navigation
16  * Satellite Systems receiver
17  *
18  * This file is part of GNSS-SDR.
19  *
20  * SPDX-License-Identifier: GPL-3.0-or-later
21  *
22  * -----------------------------------------------------------------------------
23  */
24 
25 #ifndef GNSS_SDR_NMEA_PRINTER_H
26 #define GNSS_SDR_NMEA_PRINTER_H
27 
28 #include <boost/date_time/posix_time/ptime.hpp> // for ptime
29 #include <fstream> // for ofstream
30 #include <memory> // for shared_ptr
31 #include <string> // for string
32 
33 class Rtklib_Solver;
34 
35 /*!
36  * \brief This class provides a implementation of a subset of the NMEA-0183 standard for interfacing
37  * marine electronic devices as defined by the National Marine Electronics Association (NMEA).
38  *
39  * See https://en.wikipedia.org/wiki/NMEA_0183
40  */
42 {
43 public:
44  /*!
45  * \brief Default constructor.
46  */
47  Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path = ".");
48 
49  /*!
50  * \brief Default destructor.
51  */
52  ~Nmea_Printer();
53 
54  /*!
55  * \brief Print NMEA PVT and satellite info to the initialized device
56  */
57  bool Print_Nmea_Line(const Rtklib_Solver* const pvt_data, bool print_average_values);
58 
59 private:
60  int init_serial(const std::string& serial_device); // serial port control
61  void close_serial();
62  std::string get_GPGGA() const; // fix data
63  std::string get_GPGSV() const; // satellite data
64  std::string get_GPGSA() const; // overall satellite reception data
65  std::string get_GPRMC() const; // minimum recommended data
66  std::string get_UTC_NMEA_time(const boost::posix_time::ptime d_position_UTC_time) const;
67  std::string longitude_to_hm(double longitude) const;
68  std::string latitude_to_hm(double lat) const;
69  char checkSum(const std::string& sentence) const;
70 
71  const Rtklib_Solver* d_PVT_data;
72 
73  std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
74 
75  std::string nmea_filename; // String with the NMEA log filename
76  std::string nmea_base_path;
77  std::string nmea_devname;
78 
79  int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
80 
81  bool print_avg_pos;
82  bool d_flag_nmea_output_file;
83 };
84 
85 #endif
~Nmea_Printer()
Default destructor.
This class implements a PVT solution based on RTKLIB.
Definition: rtklib_solver.h:69
This class provides a implementation of a subset of the NMEA-0183 standard for interfacing marine ele...
Definition: nmea_printer.h:41
bool Print_Nmea_Line(const Rtklib_Solver *const pvt_data, bool print_average_values)
Print NMEA PVT and satellite info to the initialized device.
Nmea_Printer(const std::string &filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string &base_path=".")
Default constructor.