2012-08-28 17:14:18 +00:00
|
|
|
/*!
|
2013-11-25 00:07:00 +00:00
|
|
|
* \file nmea_printer.h
|
|
|
|
* \brief Interface of a NMEA 2.1 printer for GNSS-SDR
|
2012-08-28 17:14:18 +00:00
|
|
|
* This class provides a implementation of a subset of the NMEA-0183 standard for interfacing
|
|
|
|
* marine electronic devices as defined by the National Marine Electronics Association (NMEA).
|
2020-02-05 09:20:32 +00:00
|
|
|
* See https://www.nmea.org/ for the NMEA 183 standard
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
|
|
|
* \author Javier Arribas, 2012. jarribas(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2012-08-28 17:14:18 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-08-28 17:14:18 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_NMEA_PRINTER_H
|
|
|
|
#define GNSS_SDR_NMEA_PRINTER_H
|
2012-08-28 17:14:18 +00:00
|
|
|
|
2019-03-06 17:45:27 +00:00
|
|
|
#include <boost/date_time/posix_time/ptime.hpp> // for ptime
|
|
|
|
#include <fstream> // for ofstream
|
|
|
|
#include <memory> // for shared_ptr
|
|
|
|
#include <string> // for string
|
2012-08-28 17:14:18 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup PVT
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup PVT_libs
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2019-03-06 17:45:27 +00:00
|
|
|
class Rtklib_Solver;
|
2013-11-25 00:07:00 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This class provides a implementation of a subset of the NMEA-0183 standard for interfacing
|
|
|
|
* marine electronic devices as defined by the National Marine Electronics Association (NMEA).
|
|
|
|
*
|
2020-02-05 20:24:46 +00:00
|
|
|
* See https://en.wikipedia.org/wiki/NMEA_0183
|
2013-11-25 00:07:00 +00:00
|
|
|
*/
|
2012-08-28 17:14:18 +00:00
|
|
|
class Nmea_Printer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
* \brief Default constructor.
|
|
|
|
*/
|
2018-12-02 14:42:38 +00:00
|
|
|
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 = ".");
|
2012-08-28 17:14:18 +00:00
|
|
|
|
|
|
|
/*!
|
2020-06-23 07:47:58 +00:00
|
|
|
* \brief Default destructor.
|
2012-08-28 17:14:18 +00:00
|
|
|
*/
|
2020-06-23 07:47:58 +00:00
|
|
|
~Nmea_Printer();
|
2012-08-28 17:14:18 +00:00
|
|
|
|
|
|
|
/*!
|
2020-06-23 07:47:58 +00:00
|
|
|
* \brief Print NMEA PVT and satellite info to the initialized device
|
2012-08-28 17:14:18 +00:00
|
|
|
*/
|
2020-07-26 21:56:36 +00:00
|
|
|
bool Print_Nmea_Line(const Rtklib_Solver* const pvt_data, bool print_average_values);
|
2012-08-28 17:14:18 +00:00
|
|
|
|
|
|
|
private:
|
2019-08-18 20:16:13 +00:00
|
|
|
int init_serial(const std::string& serial_device); // serial port control
|
2020-12-30 20:49:29 +00:00
|
|
|
void close_serial() const;
|
2020-07-26 21:56:36 +00:00
|
|
|
std::string get_GPGGA() const; // fix data
|
|
|
|
std::string get_GPGSV() const; // satellite data
|
|
|
|
std::string get_GPGSA() const; // overall satellite reception data
|
|
|
|
std::string get_GPRMC() const; // minimum recommended data
|
|
|
|
std::string get_UTC_NMEA_time(const boost::posix_time::ptime d_position_UTC_time) const;
|
|
|
|
std::string longitude_to_hm(double longitude) const;
|
|
|
|
std::string latitude_to_hm(double lat) const;
|
|
|
|
char checkSum(const std::string& sentence) const;
|
2020-06-23 07:47:58 +00:00
|
|
|
|
|
|
|
const Rtklib_Solver* d_PVT_data;
|
|
|
|
|
|
|
|
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
|
|
|
|
|
|
|
|
std::string nmea_filename; // String with the NMEA log filename
|
|
|
|
std::string nmea_base_path;
|
|
|
|
std::string nmea_devname;
|
|
|
|
|
|
|
|
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
|
|
|
|
|
2015-11-25 13:03:59 +00:00
|
|
|
bool print_avg_pos;
|
2018-10-27 22:42:28 +00:00
|
|
|
bool d_flag_nmea_output_file;
|
2012-08-28 17:14:18 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
#endif // GNSS_SDR_NMEA_PRINTER_H
|