GNSS-SDR  0.0.17
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 <cstdint> // for int32_t
24 #include <fstream> // for std::ofstream
25 #include <map> // for std::map
26 #include <memory> // std::shared_ptr
27 #include <string>
28 
29 /** \addtogroup PVT
30  * \{ */
31 /** \addtogroup PVT_libs
32  * \{ */
33 
34 
35 class Galileo_Ephemeris;
38 class Gnss_Synchro;
39 class Gps_CNAV_Ephemeris;
40 class Gps_Ephemeris;
41 class Rtcm;
42 class Rtklib_Solver;
43 
44 /*!
45  * \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages
46  */
48 {
49 public:
50  /*!
51  * \brief Default constructor.
52  */
53  Rtcm_Printer(const std::string& filename,
54  bool flag_rtcm_file_dump,
55  bool flag_rtcm_server,
56  bool flag_rtcm_tty_port,
57  uint16_t rtcm_tcp_port,
58  uint16_t rtcm_station_id,
59  const std::string& rtcm_dump_devname,
60  bool time_tag_name = true,
61  const std::string& base_path = ".");
62 
63  /*!
64  * \brief Default destructor.
65  */
66  ~Rtcm_Printer();
67 
68  /*!
69  * \brief Print RTCM messages.
70  */
71  void Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
72  const std::map<int, Gnss_Synchro>& gnss_observables_map,
73  double rx_time,
74  int32_t type_of_rx,
75  int32_t rtcm_MSM_rate_ms,
76  int32_t rtcm_MT1019_rate_ms,
77  int32_t rtcm_MT1020_rate_ms,
78  int32_t rtcm_MT1045_rate_ms,
79  int32_t rtcm_MT1077_rate_ms,
80  int32_t rtcm_MT1097_rate_ms,
81  bool flag_write_RTCM_MSM_output,
82  bool flag_write_RTCM_1019_output,
83  bool flag_write_RTCM_1020_output,
84  bool flag_write_RTCM_1045_output,
85  bool enable_rx_clock_correction);
86 
87  uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
88  uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
89  uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
90 
91  /*!
92  * \brief Locks time for logging given GLONASS GNAV Broadcast Ephemeris
93  * \note Code added as part of GSoC 2017 program
94  * \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
95  * \params obs_time Time of observation at the moment of printing
96  * \params observables Set of observables as defined by the platform
97  * \return locked time during logging process
98  */
99  uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
100 
101  std::string print_MT1005_test(); //!< For testing purposes
102 
103 private:
104  bool Print_Rtcm_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
105  bool Print_Rtcm_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
106  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);
107  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);
108 
109  /*
110  * \brief Prints L1-Only GLONASS RTK Observables
111  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
112  * \note Code added as part of GSoC 2017 program
113  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
114  * \param obs_time Time of observation at the moment of printing
115  * \param observables Set of observables as defined by the platform
116  * \return true or false upon operation success
117  */
118  bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
119 
120  /*
121  * \brief Prints Extended L1-Only GLONASS RTK Observables
122  * \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.
123  * \note Code added as part of GSoC 2017 program
124  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
125  * \param obs_time Time of observation at the moment of printing
126  * \param observables Set of observables as defined by the platform
127  * \return true or false upon operation success
128  */
129  bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
130 
131  /*
132  * \brief Prints L1&L2 GLONASS RTK Observables
133  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
134  * \note Code added as part of GSoC 2017 program
135  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
136  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
137  * \param obs_time Time of observation at the moment of printing
138  * \param observables Set of observables as defined by the platform
139  * \return true or false upon operation success
140  */
141  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);
142 
143  /*
144  * \brief Prints Extended L1&L2 GLONASS RTK Observables
145  * \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.
146  * \note Code added as part of GSoC 2017 program
147  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
148  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
149  * \param obs_time Time of observation at the moment of printing
150  * \param observables Set of observables as defined by the platform
151  * \return true or false upon operation success
152  */
153  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);
154 
155  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.
156  bool Print_Rtcm_MT1045(const Galileo_Ephemeris& gal_eph); // Galileo Ephemeris, should be broadcast every 2 minutes
157 
158  /*
159  * \brief Prints GLONASS GNAV Ephemeris
160  * \details This GLONASS message should be broadcast every 2 minutes
161  * \note Code added as part of GSoC 2017 program
162  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
163  * \param utc_model GLONASS GNAV Clock Information broadcast in string 5
164  * \return true or false upon operation success
165  */
166  bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& utc_model);
167 
168  bool Print_Rtcm_MSM(uint32_t msm_number,
169  const Gps_Ephemeris& gps_eph,
170  const Gps_CNAV_Ephemeris& gps_cnav_eph,
171  const Galileo_Ephemeris& gal_eph,
172  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
173  double obs_time,
174  const std::map<int32_t, Gnss_Synchro>& observables,
175  uint32_t clock_steering_indicator,
176  uint32_t external_clock_indicator,
177  int32_t smooth_int,
178  bool divergence_free,
179  bool more_messages);
180 
181  int32_t init_serial(const std::string& serial_device); // serial port control
182  void close_serial() const;
183  bool Print_Message(const std::string& message);
184 
185  std::unique_ptr<Rtcm> rtcm;
186  std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
187  std::string rtcm_filename; // String with the RTCM log filename
188  std::string rtcm_base_path;
189  std::string rtcm_devname;
190  int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
191  uint16_t port;
192  uint16_t station_id;
193  bool d_rtcm_writing_started;
194  bool d_rtcm_file_dump;
195 };
196 
197 
198 /** \} */
199 /** \} */
200 #endif // GNSS_SDR_RTCM_PRINTER_H
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 provides a implementation of a subset of the RTCM Standard 10403.2 messages.
Definition: rtcm_printer.h:47
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:75
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:90
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...
void Print_Rtcm_Messages(const Rtklib_Solver *pvt_solver, const std::map< int, Gnss_Synchro > &gnss_observables_map, double rx_time, int32_t type_of_rx, int32_t rtcm_MSM_rate_ms, int32_t rtcm_MT1019_rate_ms, int32_t rtcm_MT1020_rate_ms, int32_t rtcm_MT1045_rate_ms, int32_t rtcm_MT1077_rate_ms, int32_t rtcm_MT1097_rate_ms, 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.
~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, bool time_tag_name=true, const std::string &base_path=".")
Default constructor.