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).
|
|
|
|
* See http://www.nmea.org/ for the NMEA 183 standard
|
|
|
|
*
|
|
|
|
* \author Javier Arribas, 2012. jarribas(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-05-13 20:49:11 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2015-01-08 18:49:59 +00:00
|
|
|
* (at your option) any later version.
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2012-08-28 17:14:18 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNSS_SDR_NMEA_PRINTER_H_
|
2016-05-02 21:46:30 +00:00
|
|
|
#define GNSS_SDR_NMEA_PRINTER_H_
|
2012-08-28 17:14:18 +00:00
|
|
|
|
2018-05-07 07:13:45 +00:00
|
|
|
#include "rtklib_solver.h"
|
2012-08-28 17:14:18 +00:00
|
|
|
#include <fstream>
|
2019-02-03 18:24:44 +00:00
|
|
|
#include <memory>
|
2014-01-12 20:07:38 +00:00
|
|
|
#include <string>
|
2012-08-28 17:14:18 +00:00
|
|
|
|
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).
|
|
|
|
*
|
|
|
|
* See http://en.wikipedia.org/wiki/NMEA_0183
|
|
|
|
*/
|
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
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Print NMEA PVT and satellite info to the initialized device
|
|
|
|
*/
|
2018-12-02 14:42:38 +00:00
|
|
|
bool Print_Nmea_Line(const std::shared_ptr<rtklib_solver>& pvt_data, bool print_average_values);
|
2012-08-28 17:14:18 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Default destructor.
|
|
|
|
*/
|
|
|
|
~Nmea_Printer();
|
|
|
|
|
|
|
|
private:
|
2018-10-27 22:42:28 +00:00
|
|
|
std::string nmea_filename; // String with the NMEA log filename
|
|
|
|
std::string nmea_base_path;
|
2018-03-03 01:03:39 +00:00
|
|
|
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
|
2012-08-29 15:32:00 +00:00
|
|
|
std::string nmea_devname;
|
2018-03-03 01:03:39 +00:00
|
|
|
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
|
2018-05-07 07:13:45 +00:00
|
|
|
std::shared_ptr<rtklib_solver> d_PVT_data;
|
2018-12-02 14:42:38 +00:00
|
|
|
int init_serial(const std::string& serial_device); //serial port control
|
2014-08-31 09:42:00 +00:00
|
|
|
void close_serial();
|
2018-03-03 01:03:39 +00:00
|
|
|
std::string get_GPGGA(); // fix data
|
|
|
|
std::string get_GPGSV(); // satellite data
|
|
|
|
std::string get_GPGSA(); // overall satellite reception data
|
|
|
|
std::string get_GPRMC(); // minimum recommended data
|
2012-08-28 17:14:18 +00:00
|
|
|
std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time);
|
|
|
|
std::string longitude_to_hm(double longitude);
|
|
|
|
std::string latitude_to_hm(double lat);
|
2019-02-12 00:00:36 +00:00
|
|
|
char checkSum(const std::string& sentence);
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|