-
Notifications
You must be signed in to change notification settings - Fork 697
Expand file tree
/
Copy pathrtcm_printer.h
More file actions
211 lines (186 loc) · 9.09 KB
/
rtcm_printer.h
File metadata and controls
211 lines (186 loc) · 9.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*!
* \file rtcm_printer.h
* \brief Interface of a RTCM 3.2 printer for GNSS-SDR
* This class provides a implementation of a subset of the RTCM Standard 10403.2
* for Differential GNSS Services
*
* \author Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTCM_PRINTER_H
#define GNSS_SDR_RTCM_PRINTER_H
#include "signal_enabled_flags.h"
#include <cstdint> // for int32_t
#include <fstream> // for std::ofstream
#include <map> // for std::map
#include <memory> // std::shared_ptr
#include <string>
/** \addtogroup PVT
* \{ */
/** \addtogroup PVT_libs
* \{ */
class Galileo_Ephemeris;
class Glonass_Gnav_Ephemeris;
class Glonass_Gnav_Utc_Model;
class Gnss_Synchro;
class Gps_CNAV_Ephemeris;
class Gps_Ephemeris;
class Rtcm;
class Rtklib_Solver;
class Galileo_HAS_data;
/*!
* \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages
*/
class Rtcm_Printer
{
public:
/*!
* \brief Default constructor.
*/
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 = ".");
/*!
* \brief Default destructor.
*/
~Rtcm_Printer();
/*!
* \brief Print RTCM messages.
*/
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);
uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
/*!
* \brief Locks time for logging given GLONASS GNAV Broadcast Ephemeris
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \params obs_time Time of observation at the moment of printing
* \params observables Set of observables as defined by the platform
* \return locked time during logging process
*/
uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
void Print_IGM_Messages(const Galileo_HAS_data& has_data);
std::string print_MT1005_test(); //!< For testing purposes
private:
bool Print_Rtcm_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
bool Print_Rtcm_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
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);
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);
/*
* \brief Prints L1-Only GLONASS RTK Observables
* \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
* \note Code added as part of GSoC 2017 program
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
/*
* \brief Prints Extended L1-Only GLONASS RTK Observables
* \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.
* \note Code added as part of GSoC 2017 program
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
/*
* \brief Prints L1&L2 GLONASS RTK Observables
* \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
* \note Code added as part of GSoC 2017 program
* \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
* \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
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);
/*
* \brief Prints Extended L1&L2 GLONASS RTK Observables
* \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.
* \note Code added as part of GSoC 2017 program
* \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
* \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
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);
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
/*
* \brief Prints GLONASS GNAV Ephemeris
* \details This GLONASS message should be broadcast every 2 minutes
* \note Code added as part of GSoC 2017 program
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param utc_model GLONASS GNAV Clock Information broadcast in string 5
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& utc_model);
bool Print_Rtcm_MSM(uint32_t msm_number,
const Gps_Ephemeris& gps_eph,
const Gps_CNAV_Ephemeris& gps_cnav_eph,
const Galileo_Ephemeris& gal_eph,
const Glonass_Gnav_Ephemeris& glo_gnav_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables,
uint32_t clock_steering_indicator,
uint32_t external_clock_indicator,
int32_t smooth_int,
bool divergence_free,
bool more_messages);
bool Print_IGM01(const Galileo_HAS_data& has_data); // SSR Orbit Corrections
bool Print_IGM02(const Galileo_HAS_data& has_data); // SSR Clock Corrections
bool Print_IGM03(const Galileo_HAS_data& has_data); // SSR Combined Orbit & Clock Corrections
bool Print_IGM05(const Galileo_HAS_data& has_data); // SSR Bias Corrections
int32_t init_serial(const std::string& serial_device); // serial port control
void close_serial() const;
bool Print_Message(const std::string& message);
std::unique_ptr<Rtcm> rtcm;
std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
std::string rtcm_filename; // String with the RTCM log filename
std::string rtcm_base_path;
std::string rtcm_devname;
int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
uint16_t port;
uint16_t station_id;
bool d_rtcm_has_written_once;
bool d_rtcm_file_dump;
const Signal_Enabled_Flags d_flags;
};
/** \} */
/** \} */
#endif // GNSS_SDR_RTCM_PRINTER_H