GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  *
13  * GNSS-SDR is a software defined Global Navigation
14  * Satellite Systems receiver
15  *
16  * This file is part of GNSS-SDR.
17  *
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  *
20  * -----------------------------------------------------------------------------
21  */
22 
23 #ifndef GNSS_SDR_RTCM_PRINTER_H
24 #define GNSS_SDR_RTCM_PRINTER_H
25 
26 #include <cstdint> // for int32_t
27 #include <fstream> // for std::ofstream
28 #include <map> // for std::map
29 #include <memory> // std::shared_ptr
30 #include <string>
31 
32 class Galileo_Ephemeris;
35 class Gnss_Synchro;
36 class Gps_CNAV_Ephemeris;
37 class Gps_Ephemeris;
38 class Rtcm;
39 
40 /*!
41  * \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages
42  */
44 {
45 public:
46  /*!
47  * \brief Default constructor.
48  */
49  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 = ".");
50 
51  /*!
52  * \brief Default destructor.
53  */
54  ~Rtcm_Printer();
55 
56  bool Print_Rtcm_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
57  bool Print_Rtcm_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
58  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);
59  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);
60 
61  /*!
62  * \brief Prints L1-Only GLONASS RTK Observables
63  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
64  * \note Code added as part of GSoC 2017 program
65  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
66  * \param obs_time Time of observation at the moment of printing
67  * \param observables Set of observables as defined by the platform
68  * \return true or false upon operation success
69  */
70  bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
71 
72  /*!
73  * \brief Prints Extended L1-Only GLONASS RTK Observables
74  * \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.
75  * \note Code added as part of GSoC 2017 program
76  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
77  * \param obs_time Time of observation at the moment of printing
78  * \param observables Set of observables as defined by the platform
79  * \return true or false upon operation success
80  */
81  bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
82 
83  /*!
84  * \brief Prints L1&L2 GLONASS RTK Observables
85  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
86  * \note Code added as part of GSoC 2017 program
87  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
88  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
89  * \param obs_time Time of observation at the moment of printing
90  * \param observables Set of observables as defined by the platform
91  * \return true or false upon operation success
92  */
93  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);
94 
95  /*!
96  * \brief Prints Extended L1&L2 GLONASS RTK Observables
97  * \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.
98  * \note Code added as part of GSoC 2017 program
99  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
100  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
101  * \param obs_time Time of observation at the moment of printing
102  * \param observables Set of observables as defined by the platform
103  * \return true or false upon operation success
104  */
105  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);
106 
107  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.
108  bool Print_Rtcm_MT1045(const Galileo_Ephemeris& gal_eph); //!< Galileo Ephemeris, should be broadcast every 2 minutes
109 
110  /*!
111  * \brief Prints GLONASS GNAV Ephemeris
112  * \details This GLONASS message should be broadcast every 2 minutes
113  * \note Code added as part of GSoC 2017 program
114  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
115  * \param utc_model GLONASS GNAV Clock Information broadcast in string 5
116  * \return true or false upon operation success
117  */
118  bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& utc_model);
119 
120  bool Print_Rtcm_MSM(uint32_t msm_number,
121  const Gps_Ephemeris& gps_eph,
122  const Gps_CNAV_Ephemeris& gps_cnav_eph,
123  const Galileo_Ephemeris& gal_eph,
124  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
125  double obs_time,
126  const std::map<int32_t, Gnss_Synchro>& observables,
127  uint32_t clock_steering_indicator,
128  uint32_t external_clock_indicator,
129  int32_t smooth_int,
130  bool divergence_free,
131  bool more_messages);
132 
133  std::string print_MT1005_test(); //!< For testing purposes
134  uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
135  uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
136  uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
137 
138  /*!
139  * \brief Locks time for logging given GLONASS GNAV Broadcast Ephemeris
140  * \note Code added as part of GSoC 2017 program
141  * \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
142  * \params obs_time Time of observation at the moment of printing
143  * \params observables Set of observables as defined by the platform
144  * \return locked time during logging process
145  */
146  uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
147 
148 private:
149  int32_t init_serial(const std::string& serial_device); // serial port control
150  void close_serial();
151  bool Print_Message(const std::string& message);
152 
153  std::unique_ptr<Rtcm> rtcm;
154  std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
155  std::string rtcm_filename; // String with the RTCM log filename
156  std::string rtcm_base_path;
157  std::string rtcm_devname;
158  int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
159  uint16_t port;
160  uint16_t station_id;
161  bool d_rtcm_file_dump;
162 };
163 
164 #endif
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
Definition: gps_ephemeris.h:36
bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables)
Prints Extended L1-Only GLONASS RTK Observables.
This class provides a implementation of a subset of the RTCM Standard 10403.2 messages.
Definition: rtcm_printer.h:43
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
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:33
This class implements the generation and reading of some Message Types defined in the RTCM 3...
Definition: rtcm.h:87
bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, const Glonass_Gnav_Utc_Model &utc_model)
Prints GLONASS GNAV Ephemeris.
bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables)
Prints L1-Only GLONASS RTK Observables.
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)
Prints Extended L1&L2 GLONASS RTK Observables.
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.
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)
Prints L1&L2 GLONASS RTK Observables.
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.
bool Print_Rtcm_MT1045(const Galileo_Ephemeris &gal_eph)
Galileo Ephemeris, should be broadcast every 2 minutes.
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.