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