GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
rtcm_printer.h
Go to the documentation of this file.
1 /*!
2  * \file rtcm_printer.h
3  * \brief Interface of a RTCM 3.2 printer for GNSS-SDR
4  * This class provides a implementation of a subset of the RTCM Standard 10403.2
5  * for Differential GNSS Services
6  *
7  * \author Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
8  *
9  * -----------------------------------------------------------------------------
10  *
11  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_RTCM_PRINTER_H
21 #define GNSS_SDR_RTCM_PRINTER_H
22 
23 #include "signal_enabled_flags.h"
24 #include <cstdint> // for int32_t
25 #include <fstream> // for std::ofstream
26 #include <map> // for std::map
27 #include <memory> // std::shared_ptr
28 #include <string>
29 
30 /** \addtogroup PVT
31  * \{ */
32 /** \addtogroup PVT_libs
33  * \{ */
34 
35 
36 class Galileo_Ephemeris;
39 class Gnss_Synchro;
40 class Gps_CNAV_Ephemeris;
41 class Gps_Ephemeris;
42 class Rtcm;
43 class Rtklib_Solver;
44 class Galileo_HAS_data;
45 
46 /*!
47  * \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages
48  */
50 {
51 public:
52  /*!
53  * \brief Default constructor.
54  */
55  Rtcm_Printer(const std::string& filename,
56  bool flag_rtcm_file_dump,
57  bool flag_rtcm_server,
58  bool flag_rtcm_tty_port,
59  uint16_t rtcm_tcp_port,
60  uint16_t rtcm_station_id,
61  const std::string& rtcm_dump_devname,
62  uint32_t signal_enabled_flags,
63  bool time_tag_name = true,
64  const std::string& base_path = ".");
65 
66  /*!
67  * \brief Default destructor.
68  */
69  ~Rtcm_Printer();
70 
71  /*!
72  * \brief Print RTCM messages.
73  */
74  void Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
75  const std::map<int, Gnss_Synchro>& gnss_observables_map,
76  double rx_time,
77  bool rtcm_MSM_enabled,
78  bool rtcm_MT1019_enabled,
79  bool rtcm_MT1020_enabled,
80  bool rtcm_MT1045_enabled,
81  bool rtcm_MT1077_enabled,
82  bool rtcm_MT1087_enabled,
83  bool rtcm_MT1097_enabled,
84  bool flag_write_RTCM_MSM_output,
85  bool flag_write_RTCM_1019_output,
86  bool flag_write_RTCM_1020_output,
87  bool flag_write_RTCM_1045_output,
88  bool enable_rx_clock_correction);
89 
90  uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
91  uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
92  uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
93 
94  /*!
95  * \brief Locks time for logging given GLONASS GNAV Broadcast Ephemeris
96  * \note Code added as part of GSoC 2017 program
97  * \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
98  * \params obs_time Time of observation at the moment of printing
99  * \params observables Set of observables as defined by the platform
100  * \return locked time during logging process
101  */
102  uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
103 
104  void Print_IGM_Messages(const Galileo_HAS_data& has_data);
105 
106  std::string print_MT1005_test(); //!< For testing purposes
107 
108 private:
109  bool Print_Rtcm_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
110  bool Print_Rtcm_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
111  bool Print_Rtcm_MT1003(const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& cnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
112  bool Print_Rtcm_MT1004(const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& cnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
113 
114  /*
115  * \brief Prints L1-Only GLONASS RTK Observables
116  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
117  * \note Code added as part of GSoC 2017 program
118  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
119  * \param obs_time Time of observation at the moment of printing
120  * \param observables Set of observables as defined by the platform
121  * \return true or false upon operation success
122  */
123  bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
124 
125  /*
126  * \brief Prints Extended L1-Only GLONASS RTK Observables
127  * \details This GLONASS message type is used when only L1 data is present and bandwidth is very tight, often 1012 is used in such cases.
128  * \note Code added as part of GSoC 2017 program
129  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
130  * \param obs_time Time of observation at the moment of printing
131  * \param observables Set of observables as defined by the platform
132  * \return true or false upon operation success
133  */
134  bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
135 
136  /*
137  * \brief Prints L1&L2 GLONASS RTK Observables
138  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
139  * \note Code added as part of GSoC 2017 program
140  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
141  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
142  * \param obs_time Time of observation at the moment of printing
143  * \param observables Set of observables as defined by the platform
144  * \return true or false upon operation success
145  */
146  bool Print_Rtcm_MT1011(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
147 
148  /*
149  * \brief Prints Extended L1&L2 GLONASS RTK Observables
150  * \details This GLONASS message type is the most common observational message type, with L1/L2/SNR content. This is one of the most common messages found.
151  * \note Code added as part of GSoC 2017 program
152  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
153  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
154  * \param obs_time Time of observation at the moment of printing
155  * \param observables Set of observables as defined by the platform
156  * \return true or false upon operation success
157  */
158  bool Print_Rtcm_MT1012(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
159 
160  bool Print_Rtcm_MT1019(const Gps_Ephemeris& gps_eph); // GPS Ephemeris, should be broadcast in the event that the IODC does not match the IODE, and every 2 minutes.
161  bool Print_Rtcm_MT1045(const Galileo_Ephemeris& gal_eph); // Galileo Ephemeris, should be broadcast every 2 minutes
162 
163  /*
164  * \brief Prints GLONASS GNAV Ephemeris
165  * \details This GLONASS message should be broadcast every 2 minutes
166  * \note Code added as part of GSoC 2017 program
167  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
168  * \param utc_model GLONASS GNAV Clock Information broadcast in string 5
169  * \return true or false upon operation success
170  */
171  bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& utc_model);
172 
173  bool Print_Rtcm_MSM(uint32_t msm_number,
174  const Gps_Ephemeris& gps_eph,
175  const Gps_CNAV_Ephemeris& gps_cnav_eph,
176  const Galileo_Ephemeris& gal_eph,
177  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
178  double obs_time,
179  const std::map<int32_t, Gnss_Synchro>& observables,
180  uint32_t clock_steering_indicator,
181  uint32_t external_clock_indicator,
182  int32_t smooth_int,
183  bool divergence_free,
184  bool more_messages);
185 
186  bool Print_IGM01(const Galileo_HAS_data& has_data); // SSR Orbit Corrections
187  bool Print_IGM02(const Galileo_HAS_data& has_data); // SSR Clock Corrections
188  bool Print_IGM03(const Galileo_HAS_data& has_data); // SSR Combined Orbit & Clock Corrections
189  bool Print_IGM05(const Galileo_HAS_data& has_data); // SSR Bias Corrections
190 
191  int32_t init_serial(const std::string& serial_device); // serial port control
192  void close_serial() const;
193  bool Print_Message(const std::string& message);
194 
195  std::unique_ptr<Rtcm> rtcm;
196  std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
197  std::string rtcm_filename; // String with the RTCM log filename
198  std::string rtcm_base_path;
199  std::string rtcm_devname;
200  int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
201  uint16_t port;
202  uint16_t station_id;
203  bool d_rtcm_has_written_once;
204  bool d_rtcm_file_dump;
205  const Signal_Enabled_Flags d_flags;
206 };
207 
208 
209 /** \} */
210 /** \} */
211 #endif // GNSS_SDR_RTCM_PRINTER_H
void Print_Rtcm_Messages(const Rtklib_Solver *pvt_solver, const std::map< int, Gnss_Synchro > &gnss_observables_map, double rx_time, bool rtcm_MSM_enabled, bool rtcm_MT1019_enabled, bool rtcm_MT1020_enabled, bool rtcm_MT1045_enabled, bool rtcm_MT1077_enabled, bool rtcm_MT1087_enabled, bool rtcm_MT1097_enabled, bool flag_write_RTCM_MSM_output, bool flag_write_RTCM_1019_output, bool flag_write_RTCM_1020_output, bool flag_write_RTCM_1045_output, bool enable_rx_clock_correction)
Print RTCM messages.
This is a storage class for the GPS CNAV ephemeris data as described in IS-GPS-200M.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
Definition: gps_ephemeris.h:40
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
This class provides a implementation of a subset of the RTCM Standard 10403.2 messages.
Definition: rtcm_printer.h:49
Class to check the enabled signals.
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
This class implements a PVT solution based on RTKLIB.
Definition: rtklib_solver.h:82
std::string print_MT1005_test()
For testing purposes.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This class implements the generation and reading of some Message Types defined in the RTCM 3...
Definition: rtcm.h:97
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
~Rtcm_Printer()
Default destructor.
Rtcm_Printer(const std::string &filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string &rtcm_dump_devname, uint32_t signal_enabled_flags, bool time_tag_name=true, const std::string &base_path=".")
Default constructor.