GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
rtcm.h
Go to the documentation of this file.
1 /*!
2  * \file rtcm.h
3  * \brief Interface for the RTCM 3.2 Standard
4  * \author Carles Fernandez-Prades, 2015. cfernandez(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 
18 #ifndef GNSS_SDR_RTCM_H
19 #define GNSS_SDR_RTCM_H
20 
21 
22 #include "concurrent_queue.h"
23 #include "galileo_ephemeris.h"
24 #include "galileo_has_data.h"
25 #include "glonass_gnav_ephemeris.h"
26 #include "glonass_gnav_utc_model.h"
27 #include "gnss_synchro.h"
28 #include "gps_cnav_ephemeris.h"
29 #include "gps_ephemeris.h"
30 #include <boost/asio.hpp>
31 #include <boost/date_time/posix_time/posix_time.hpp>
32 #include <algorithm> // for std::max, std::min, std::copy_n
33 #include <array>
34 #include <bitset>
35 #include <cstddef> // for size_t
36 #include <cstdint>
37 #include <deque>
38 #include <iomanip> // for std::setw
39 #include <list>
40 #include <map>
41 #include <memory>
42 #include <set>
43 #include <sstream> // for std::stringstream
44 #include <string>
45 #include <thread>
46 #include <utility>
47 #include <vector>
48 
49 #if USE_GLOG_AND_GFLAGS
50 #include <glog/logging.h>
51 #else
52 #include <absl/log/log.h>
53 #endif
54 
55 /** \addtogroup PVT
56  * \{ */
57 /** \addtogroup PVT_libs
58  * \{ */
59 
60 
61 #if USE_BOOST_ASIO_IO_CONTEXT
62 using b_io_context = boost::asio::io_context;
63 #else
64 using b_io_context = boost::asio::io_service;
65 #endif
66 
67 
68 /*!
69  * \brief This class implements the generation and reading of some Message Types
70  * defined in the RTCM 3.2 Standard, plus some utilities to handle messages.
71  *
72  * Generation of the following Message Types:
73  * 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1019, 1020, 1029, 1045
74  *
75  * Decoding of the following Message Types:
76  * 1019, 1045
77  *
78  * Generation of the following Multiple Signal Messages:
79  * MSM1 (message types 1071, 1091)
80  * MSM2 (message types 1072, 1092)
81  * MSM3 (message types 1073, 1093)
82  * MSM4 (message types 1074, 1094)
83  * MSM5 (message types 1075, 1095)
84  * MSM6 (message types 1076, 1096)
85  * MSM7 (message types 1077, 1097)
86  *
87  * RTCM 3 message format (size in bits):
88  * +----------+--------+-----------+--------------------+----------+
89  * | preamble | 000000 | length | data message | parity |
90  * +----------+--------+-----------+--------------------+----------+
91  * |<-- 8 --->|<- 6 -->|<-- 10 --->|<--- length x 8 --->|<-- 24 -->|
92  * +----------+--------+-----------+--------------------+----------+
93  *
94  *
95  * (C) Carles Fernandez-Prades, 2015. cfernandez(at)cttc.es
96  */
97 class Rtcm
98 {
99 public:
100  explicit Rtcm(uint16_t port = 2101); //!< Default constructor that sets TCP port of the RTCM message server and RTCM Station ID. 2101 is the standard RTCM port according to the Internet Assigned Numbers Authority (IANA). See https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
101  ~Rtcm();
102 
103  /*!
104  * \brief Prints message type 1001 (L1-Only GPS RTK Observables)
105  */
106  std::string print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
107 
108  /*!
109  * \brief Prints message type 1002 (Extended L1-Only GPS RTK Observables)
110  */
111  std::string print_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
112 
113  /*!
114  * \brief Prints message type 1003 (L1 & L2 GPS RTK Observables)
115  */
116  std::string print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
117 
118  /*!
119  * \brief Prints message type 1004 (Extended L1 & L2 GPS RTK Observables)
120  */
121  std::string print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
122 
123  /*!
124  * \brief Prints message type 1005 (Stationary Antenna Reference Point)
125  */
126  std::string print_MT1005(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator);
127 
128  /*!
129  * \brief Verifies and reads messages of type 1005 (Stationary Antenna Reference Point). Returns 1 if anything goes wrong, 0 otherwise.
130  */
131  int32_t read_MT1005(const std::string& message, uint32_t& ref_id, double& ecef_x, double& ecef_y, double& ecef_z, bool& gps, bool& glonass, bool& galileo);
132 
133  /*!
134  * \brief Prints message type 1006 (Stationary Antenna Reference Point, with Height Information)
135  */
136  std::string print_MT1006(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator, double height);
137 
138  std::string print_MT1005_test(); //!< For testing purposes
139 
140  /*!
141  * \brief Prints message type 1008 (Antenna Descriptor & Serial Number)
142  */
143  std::string print_MT1008(uint32_t ref_id, const std::string& antenna_descriptor, uint32_t antenna_setup_id, const std::string& antenna_serial_number);
144 
145  /*!
146  * \brief Prints L1-Only GLONASS RTK Observables
147  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
148  * \note Code added as part of GSoC 2017 program
149  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
150  * \param obs_time Time of observation at the moment of printing
151  * \param observables Set of observables as defined by the platform
152  * \return string with message contents
153  */
154  std::string print_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
155 
156  /*!
157  * \brief Prints Extended L1-Only GLONASS RTK Observables
158  * \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.
159  * \note Code added as part of GSoC 2017 program
160  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
161  * \param obs_time Time of observation at the moment of printing
162  * \param observables Set of observables as defined by the platform
163  * \return string with message contents
164  */
165  std::string print_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
166 
167  /*!
168  * \brief Prints L1&L2 GLONASS RTK Observables
169  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
170  * \note Code added as part of GSoC 2017 program
171  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
172  * \param obs_time Time of observation at the moment of printing
173  * \param observables Set of observables as defined by the platform
174  * \return string with message contents
175  */
176  std::string print_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, uint16_t station_id);
177 
178  /*!
179  * \brief Prints Extended L1&L2 GLONASS RTK Observables
180  * \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.
181  * \note Code added as part of GSoC 2017 program
182  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
183  * \param obs_time Time of observation at the moment of printing
184  * \param observables Set of observables as defined by the platform
185  * \return string with message contents
186  */
187  std::string print_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, uint16_t station_id);
188 
189  /*!
190  * \brief Prints message type 1019 (GPS Ephemeris), should be broadcast in the event that
191  * the IODC does not match the IODE, and every 2 minutes.
192  */
193  std::string print_MT1019(const Gps_Ephemeris& gps_eph);
194 
195  /*!
196  * \brief Verifies and reads messages of type 1019 (GPS Ephemeris). Returns 1 if anything goes wrong, 0 otherwise.
197  */
198  int32_t read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) const;
199 
200  /*!
201  * \brief Prints message type 1020 (GLONASS Ephemeris).
202  * \note Code added as part of GSoC 2017 program
203  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
204  * \param glonass_gnav_utc_model GLONASS GNAV Clock Information
205  * \return Returns message type as a string type
206  */
207  std::string print_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
208 
209  /*!
210  * \brief Verifies and reads messages of type 1020 (GLONASS Ephemeris).
211  * \note Code added as part of GSoC 2017 program
212  * \param message Message to read as a string type
213  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
214  * \param glonass_gnav_utc_model GLONASS GNAV Clock Information
215  * \return Returns 1 if anything goes wrong, 0 otherwise.
216  */
217  int32_t read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& glonass_gnav_eph, Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) const;
218 
219  /*!
220  * \brief Prints message type 1029 (Unicode Text String)
221  */
222  std::string print_MT1029(uint32_t ref_id, const Gps_Ephemeris& gps_eph, double obs_time, const std::string& message);
223 
224  /*!
225  * \brief Prints message type 1045 (Galileo Ephemeris), should be broadcast every 2 minutes
226  */
227  std::string print_MT1045(const Galileo_Ephemeris& gal_eph);
228 
229  /*!
230  * \brief Verifies and reads messages of type 1045 (Galileo Ephemeris). Returns 1 if anything goes wrong, 0 otherwise.
231  */
232  int32_t read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph) const;
233 
234  /*!
235  * \brief Prints messages of type MSM1 (Compact GNSS observables)
236  */
237  std::string print_MSM_1(const Gps_Ephemeris& gps_eph,
238  const Gps_CNAV_Ephemeris& gps_cnav_eph,
239  const Galileo_Ephemeris& gal_eph,
240  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
241  double obs_time,
242  const std::map<int32_t, Gnss_Synchro>& observables,
243  uint32_t ref_id,
244  uint32_t clock_steering_indicator,
245  uint32_t external_clock_indicator,
246  int32_t smooth_int,
247  bool divergence_free,
248  bool more_messages);
249 
250  /*!
251  * \brief Prints messages of type MSM2 (Compact GNSS phaseranges)
252  */
253  std::string print_MSM_2(const Gps_Ephemeris& gps_eph,
254  const Gps_CNAV_Ephemeris& gps_cnav_eph,
255  const Galileo_Ephemeris& gal_eph,
256  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
257  double obs_time,
258  const std::map<int32_t, Gnss_Synchro>& observables,
259  uint32_t ref_id,
260  uint32_t clock_steering_indicator,
261  uint32_t external_clock_indicator,
262  int32_t smooth_int,
263  bool divergence_free,
264  bool more_messages);
265 
266  /*!
267  * \brief Prints messages of type MSM3 (Compact GNSS pseudoranges and phaseranges)
268  */
269  std::string print_MSM_3(const Gps_Ephemeris& gps_eph,
270  const Gps_CNAV_Ephemeris& gps_cnav_eph,
271  const Galileo_Ephemeris& gal_eph,
272  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
273  double obs_time,
274  const std::map<int32_t, Gnss_Synchro>& observables,
275  uint32_t ref_id,
276  uint32_t clock_steering_indicator,
277  uint32_t external_clock_indicator,
278  int32_t smooth_int,
279  bool divergence_free,
280  bool more_messages);
281 
282  /*!
283  * \brief Prints messages of type MSM4 (Full GNSS pseudoranges and phaseranges plus CNR)
284  */
285  std::string print_MSM_4(const Gps_Ephemeris& gps_eph,
286  const Gps_CNAV_Ephemeris& gps_cnav_eph,
287  const Galileo_Ephemeris& gal_eph,
288  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
289  double obs_time,
290  const std::map<int32_t, Gnss_Synchro>& observables,
291  uint32_t ref_id,
292  uint32_t clock_steering_indicator,
293  uint32_t external_clock_indicator,
294  int32_t smooth_int,
295  bool divergence_free,
296  bool more_messages);
297 
298  /*!
299  * \brief Prints messages of type MSM5 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR)
300  */
301  std::string print_MSM_5(const Gps_Ephemeris& gps_eph,
302  const Gps_CNAV_Ephemeris& gps_cnav_eph,
303  const Galileo_Ephemeris& gal_eph,
304  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
305  double obs_time,
306  const std::map<int32_t, Gnss_Synchro>& observables,
307  uint32_t ref_id,
308  uint32_t clock_steering_indicator,
309  uint32_t external_clock_indicator,
310  int32_t smooth_int,
311  bool divergence_free,
312  bool more_messages);
313 
314  /*!
315  * \brief Prints messages of type MSM6 (Full GNSS pseudoranges and phaseranges plus CNR, high resolution)
316  */
317  std::string print_MSM_6(const Gps_Ephemeris& gps_eph,
318  const Gps_CNAV_Ephemeris& gps_cnav_eph,
319  const Galileo_Ephemeris& gal_eph,
320  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
321  double obs_time,
322  const std::map<int32_t, Gnss_Synchro>& observables,
323  uint32_t ref_id,
324  uint32_t clock_steering_indicator,
325  uint32_t external_clock_indicator,
326  int32_t smooth_int,
327  bool divergence_free,
328  bool more_messages);
329 
330  /*!
331  * \brief Prints messages of type MSM7 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR, high resolution)
332  */
333  std::string print_MSM_7(const Gps_Ephemeris& gps_eph,
334  const Gps_CNAV_Ephemeris& gps_cnav_eph,
335  const Galileo_Ephemeris& gal_eph,
336  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
337  double obs_time,
338  const std::map<int32_t, Gnss_Synchro>& observables,
339  uint32_t ref_id,
340  uint32_t clock_steering_indicator,
341  uint32_t external_clock_indicator,
342  int32_t smooth_int,
343  bool divergence_free,
344  bool more_messages);
345 
346  /*!
347  * \brief Prints messages of type IGM01 (SSR Orbit Correction)
348  */
349  std::vector<std::string> print_IGM01(const Galileo_HAS_data& has_data);
350 
351  /*!
352  * \brief Prints messages of type IGM02 (SSR Clock Correction)
353  */
354  std::vector<std::string> print_IGM02(const Galileo_HAS_data& has_data);
355 
356  /*!
357  * \brief Prints messages of type IGM03 (SSR Combined Orbit and Clock Correction)
358  */
359  std::vector<std::string> print_IGM03(const Galileo_HAS_data& has_data);
360 
361  /*!
362  * \brief Prints messages of type IGM05 (SSR Bias Correction)
363  */
364  std::vector<std::string> print_IGM05(const Galileo_HAS_data& has_data);
365 
366  uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which GPS L1 signals have been continually tracked.
367  uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which GPS L2 signals have been continually tracked.
368  uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which Galileo signals have been continually tracked.
369 
370  /*!
371  * \brief Locks time period in which GLONASS signals have been continually tracked.
372  * \note Code added as part of GSoC 2017 program
373  * \param eph GLONASS GNAV Broadcast Ephemeris
374  * \param obs_time Time of observation at the moment of printing
375  * \param observables Set of observables as defined by the platform
376  * \return Returns the time period in which GLONASS signals have been continually tracked.
377  */
378  uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
379 
380  std::string bin_to_hex(const std::string& s) const; //!< Returns a string of hexadecimal symbols from a string of binary symbols
381  std::string hex_to_bin(const std::string& s) const; //!< Returns a string of binary symbols from a string of hexadecimal symbols
382 
383  std::string bin_to_binary_data(const std::string& s) const; //!< Returns a string of binary data from a string of binary symbols
384  std::string binary_data_to_bin(const std::string& s) const; //!< Returns a string of binary symbols from a string of binary data
385 
386  uint32_t bin_to_uint(const std::string& s) const; //!< Returns an uint32_t from a string of binary symbols
387  int32_t bin_to_int(const std::string& s) const;
388  double bin_to_double(const std::string& s) const; //!< Returns double from a string of binary symbols
389  int32_t bin_to_sint(const std::string& s) const;
390  uint64_t hex_to_uint(const std::string& s) const; //!< Returns an uint64_t from a string of hexadecimal symbols
391  int64_t hex_to_int(const std::string& s) const; //!< Returns a int64_t from a string of hexadecimal symbols
392 
393  bool check_CRC(const std::string& message) const; //!< Checks that the CRC of a RTCM package is correct
394 
395  void run_server(); //!< Starts running the server
396  void stop_server(); //!< Stops the server
397 
398  void send_message(const std::string& msg); //!< Sends a message through the server to all connected clients
399  bool is_server_running() const; //!< Returns true if the server is running, false otherwise
400 
401 private:
402  //
403  // Generation of messages content
404  //
405  std::bitset<64> get_MT1001_4_header(uint32_t msg_number,
406  double obs_time,
407  const std::map<int32_t, Gnss_Synchro>& observables,
408  uint32_t ref_id,
409  uint32_t smooth_int,
410  bool sync_flag,
411  bool divergence_free);
412 
413  std::bitset<58> get_MT1001_sat_content(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
414  std::bitset<74> get_MT1002_sat_content(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
415  std::bitset<101> get_MT1003_sat_content(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
416  std::bitset<125> get_MT1004_sat_content(const Gps_Ephemeris& ephL1, const Gps_CNAV_Ephemeris& ephL2, double obs_time, const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
417 
418  std::bitset<152> get_MT1005_test();
419 
420  /*!
421  * \brief Generates contents of message header for types 1009, 1010, 1011 and 1012. GLONASS RTK Message
422  * \note Code added as part of GSoC 2017 program
423  * \param msg_number Message type number, acceptable options include 1009 to 1012
424  * \param obs_time Time of observation at the moment of printing
425  * \param observables Set of observables as defined by the platform
426  * \param ref_id
427  * \param smooth_int
428  * \param divergence_free
429  * \return Returns the message header content as set of bits
430  */
431  std::bitset<61> get_MT1009_12_header(uint32_t msg_number,
432  double obs_time,
433  const std::map<int32_t, Gnss_Synchro>& observables,
434  uint32_t ref_id,
435  uint32_t smooth_int,
436  bool sync_flag,
437  bool divergence_free);
438 
439  /*!
440  * \brief Get the contents of the satellite specific portion of a type 1009 Message (GLONASS Basic RTK, L1 Only)
441  * \details Contents generated for each satellite. See table 3.5-11
442  * \note Code added as part of GSoC 2017 program
443  * \param ephGNAV Ephemeris for GLONASS GNAV in L1 satellites
444  * \param obs_time Time of observation at the moment of printing
445  * \param gnss_synchro Information generated by channels while processing the satellite
446  * \return Returns the message content as set of bits
447  */
448  std::bitset<64> get_MT1009_sat_content(const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const Gnss_Synchro& gnss_synchro);
449  /*!
450  * \brief Get the contents of the satellite specific portion of a type 1010 Message (GLONASS Extended RTK, L1 Only)
451  * \details Contents generated for each satellite. See table 3.5-12
452  * \note Code added as part of GSoC 2017 program
453  * \param ephGNAV Ephemeris for GLONASS GNAV in L1 satellites
454  * \param obs_time Time of observation at the moment of printing
455  * \param gnss_synchro Information generated by channels while processing the satellite
456  * \return Returns the message content as set of bits
457  */
458  std::bitset<79> get_MT1010_sat_content(const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const Gnss_Synchro& gnss_synchro);
459  /*!
460  * \brief Get the contents of the satellite specific portion of a type 1011 Message (GLONASS Basic RTK, L1 & L2)
461  * \details Contents generated for each satellite. See table 3.5-13
462  * \note Code added as part of GSoC 2017 program
463  * \param ephGNAVL1 Ephemeris for GLONASS GNAV in L1 satellites
464  * \param ephGNAVL2 Ephemeris for GLONASS GNAV in L2 satellites
465  * \param obs_time Time of observation at the moment of printing
466  * \param gnss_synchroL1 Information generated by channels while processing the GLONASS GNAV L1 satellite
467  * \param gnss_synchroL2 Information generated by channels while processing the GLONASS GNAV L2 satellite
468  * \return Returns the message content as set of bits
469  */
470  std::bitset<107> get_MT1011_sat_content(const Glonass_Gnav_Ephemeris& ephL1, const Glonass_Gnav_Ephemeris& ephL2, double obs_time, const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
471  /*!
472  * \brief Get the contents of the satellite specific portion of a type 1012 Message (GLONASS Extended RTK, L1 & L2)
473  * \details Contents generated for each satellite. See table 3.5-14
474  * \note Code added as part of GSoC 2017 program
475  * \param ephGNAVL1 Ephemeris for GLONASS GNAV in L1 satellites
476  * \param ephGNAVL2 Ephemeris for GLONASS GNAV in L2 satellites
477  * \param obs_time Time of observation at the moment of printing
478  * \param gnss_synchroL1 Information generated by channels while processing the GLONASS GNAV L1 satellite
479  * \param gnss_synchroL2 Information generated by channels while processing the GLONASS GNAV L2 satellite
480  * \return Returns the message content as set of bits
481  */
482  std::bitset<130> get_MT1012_sat_content(const Glonass_Gnav_Ephemeris& ephL1, const Glonass_Gnav_Ephemeris& ephL2, double obs_time, const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
483 
484  std::string get_MSM_header(uint32_t msg_number,
485  double obs_time,
486  const std::map<int32_t, Gnss_Synchro>& observables,
487  uint32_t ref_id,
488  uint32_t clock_steering_indicator,
489  uint32_t external_clock_indicator,
490  int32_t smooth_int,
491  bool divergence_free,
492  bool more_messages);
493 
494  std::string get_MSM_1_content_sat_data(const std::map<int32_t, Gnss_Synchro>& observables);
495  std::string get_MSM_4_content_sat_data(const std::map<int32_t, Gnss_Synchro>& observables);
496  std::string get_MSM_5_content_sat_data(const std::map<int32_t, Gnss_Synchro>& observables);
497 
498  std::string get_MSM_1_content_signal_data(const std::map<int32_t, Gnss_Synchro>& observables);
499  std::string get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
500  std::string get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
501  std::string get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
502  std::string get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
503  std::string get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
504  std::string get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
505 
506  std::string get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator);
507  std::string get_IGM01_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index);
508  std::string get_IGM02_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator);
509  std::string get_IGM02_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index);
510  std::string get_IGM03_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator);
511  std::string get_IGM03_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index);
512  std::string get_IGM05_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator);
513  std::string get_IGM05_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index);
514 
515  //
516  // Utilities
517  //
518  static std::map<std::string, int> galileo_signal_map;
519  static std::map<std::string, int> gps_signal_map;
520  std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_signal(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const;
521  std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_PRN_mask(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const;
522  boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const;
523  boost::posix_time::ptime compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const;
524  boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const;
525  boost::posix_time::ptime compute_GLONASS_time(const Glonass_Gnav_Ephemeris& eph, double obs_time) const;
526  boost::posix_time::ptime gps_L1_last_lock_time[64];
527  boost::posix_time::ptime gps_L2_last_lock_time[64];
528  boost::posix_time::ptime gal_E1_last_lock_time[64];
529  boost::posix_time::ptime gal_E5_last_lock_time[64];
530  boost::posix_time::ptime glo_L1_last_lock_time[64];
531  boost::posix_time::ptime glo_L2_last_lock_time[64];
532  uint32_t lock_time_indicator(uint32_t lock_time_period_s);
533  uint32_t msm_lock_time_indicator(uint32_t lock_time_period_s);
534  uint32_t msm_extended_lock_time_indicator(uint32_t lock_time_period_s);
535  // SSR utilities
536  uint8_t ssr_update_interval(uint16_t validity_seconds) const;
537 
538  //
539  // Classes for TCP communication
540  //
541  uint16_t RTCM_port;
542  // uint16_t RTCM_Station_ID;
543  class Rtcm_Message
544  {
545  public:
546  static const std::size_t header_length = 6;
547  static const std::size_t max_body_length = 1029;
548 
549  Rtcm_Message()
550  : body_length_(0)
551  {
552  }
553 
554  const char* data() const
555  {
556  return data_.data();
557  }
558 
559  char* data()
560  {
561  return data_.data();
562  }
563 
564  inline std::size_t length() const
565  {
566  return header_length + body_length_;
567  }
568 
569  const char* body() const
570  {
571  return data_.data() + header_length;
572  }
573 
574  char* body()
575  {
576  return data_.data() + header_length;
577  }
578 
579  std::size_t body_length() const
580  {
581  return body_length_;
582  }
583 
584  void body_length(std::size_t new_length)
585  {
586  body_length_ = new_length;
587  if (body_length_ > max_body_length)
588  {
589  body_length_ = max_body_length;
590  }
591  }
592 
593  inline bool decode_header()
594  {
595  std::string header(data_.data(), header_length);
596  if (header[0] != 'G' || header[1] != 'S')
597  {
598  return false;
599  }
600 
601  auto header2 = header.substr(2);
602  try
603  {
604  body_length_ = std::stoi(header2);
605  }
606  catch (const std::exception& e)
607  {
608  // invalid stoi conversion
609  body_length_ = 0;
610  return false;
611  }
612 
613  if (body_length_ == 0)
614  {
615  return false;
616  }
617 
618  if (body_length_ > max_body_length)
619  {
620  body_length_ = 0;
621  return false;
622  }
623  return true;
624  }
625 
626  inline void encode_header()
627  {
628  std::stringstream ss;
629  ss << "GS" << std::setw(4) << std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0);
630  std::string header = ss.str();
631  header.resize(header_length, ' ');
632  std::copy(header.begin(), header.end(), data_.begin());
633  }
634 
635  private:
636  std::array<char, header_length + max_body_length> data_{};
637  std::size_t body_length_;
638  };
639 
640 
641  class RtcmListener
642  {
643  public:
644  virtual ~RtcmListener() = default;
645  virtual void deliver(const Rtcm_Message& msg) = 0;
646  };
647 
648 
649  class Rtcm_Listener_Room
650  {
651  public:
652  inline void join(const std::shared_ptr<RtcmListener>& participant)
653  {
654  participants_.insert(participant);
655  for (const auto& msg : recent_msgs_)
656  {
657  participant->deliver(msg);
658  }
659  }
660 
661  inline void leave(const std::shared_ptr<RtcmListener>& participant)
662  {
663  participants_.erase(participant);
664  }
665 
666  inline void deliver(const Rtcm_Message& msg)
667  {
668  recent_msgs_.push_back(msg);
669  while (recent_msgs_.size() > max_recent_msgs)
670  {
671  recent_msgs_.pop_front();
672  }
673 
674  for (const auto& participant : participants_)
675  {
676  participant->deliver(msg);
677  }
678  }
679 
680  private:
681  std::set<std::shared_ptr<RtcmListener>> participants_;
682  enum
683  {
684  max_recent_msgs = 1
685  };
686  std::deque<Rtcm_Message> recent_msgs_;
687  };
688 
689 
690  class Rtcm_Session
691  : public RtcmListener,
692  public std::enable_shared_from_this<Rtcm_Session>
693  {
694  public:
695  Rtcm_Session(boost::asio::ip::tcp::socket socket, Rtcm_Listener_Room& room) : socket_(std::move(socket)), room_(room) {}
696  inline void start()
697  {
698  room_.join(shared_from_this());
699  do_read_message_header();
700  }
701 
702  inline void deliver(const Rtcm_Message& msg)
703  {
704  bool write_in_progress = !write_msgs_.empty();
705  write_msgs_.push_back(msg);
706  if (!write_in_progress)
707  {
708  do_write();
709  }
710  }
711 
712  private:
713  inline void do_read_message_header()
714  {
715  auto self(shared_from_this());
716  boost::asio::async_read(socket_,
717  boost::asio::buffer(read_msg_.data(), Rtcm_Message::header_length),
718  [this, self](boost::system::error_code ec, std::size_t /*length*/) {
719  if (!ec and read_msg_.decode_header())
720  {
721  do_read_message_body();
722  }
723  else if (!ec and !read_msg_.decode_header())
724  {
725  client_says += read_msg_.data();
726  bool first = true;
727  while (client_says.length() >= 80)
728  {
729  if (first == true)
730  {
731  DLOG(INFO) << "Client says:";
732  first = false;
733  }
734  DLOG(INFO) << client_says;
735  client_says = client_says.substr(80, client_says.length() - 80);
736  }
737  do_read_message_header();
738  }
739  else
740  {
741  std::cout << "Closing connection with RTCM client\n";
742  room_.leave(shared_from_this());
743  }
744  });
745  }
746 
747  inline void do_read_message_body()
748  {
749  auto self(shared_from_this());
750  boost::asio::async_read(socket_,
751  boost::asio::buffer(read_msg_.body(), read_msg_.body_length()),
752  [this, self](boost::system::error_code ec, std::size_t /*length*/) {
753  if (!ec)
754  {
755  room_.deliver(read_msg_);
756  // std::cout << "Delivered message (session): ";
757  // std::cout.write(read_msg_.body(), read_msg_.body_length());
758  // std::cout << '\n';
759  do_read_message_header();
760  }
761  else
762  {
763  std::cout << "Closing connection with RTCM client\n";
764  room_.leave(shared_from_this());
765  }
766  });
767  }
768 
769  inline void do_write()
770  {
771  auto self(shared_from_this());
772  boost::asio::async_write(socket_,
773  boost::asio::buffer(write_msgs_.front().body(), write_msgs_.front().body_length()),
774  [this, self](boost::system::error_code ec, std::size_t /*length*/) {
775  if (!ec)
776  {
777  write_msgs_.pop_front();
778  if (!write_msgs_.empty())
779  {
780  do_write();
781  }
782  }
783  else
784  {
785  std::cout << "Closing connection with RTCM client\n";
786  room_.leave(shared_from_this());
787  }
788  });
789  }
790 
791  boost::asio::ip::tcp::socket socket_;
792  Rtcm_Listener_Room& room_;
793  Rtcm_Message read_msg_;
794  std::deque<Rtcm_Message> write_msgs_;
795  std::string client_says;
796  };
797 
798 
799  class Tcp_Internal_Client
800  : public std::enable_shared_from_this<Tcp_Internal_Client>
801  {
802  public:
803  Tcp_Internal_Client(b_io_context& io_context,
804 #if BOOST_ASIO_USE_RESOLVER_ITERATOR
805  boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
806  : io_context_(io_context), socket_(io_context)
807  {
808  do_connect(std::move(endpoint_iterator));
809  }
810 #else
811  boost::asio::ip::tcp::resolver::results_type endpoints)
812  : io_context_(io_context), socket_(io_context)
813  {
814  do_connect(std::move(endpoints));
815  }
816 #endif
817 
818  inline void close()
819  {
820 #if BOOST_ASIO_USE_IOCONTEXT_POST
821  io_context_.post([this]() { socket_.close(); });
822 #else
823  boost::asio::post(io_context_, [this]() { socket_.close(); });
824 #endif
825  }
826 
827  inline void write(const Rtcm_Message& msg)
828  {
829 #if BOOST_ASIO_USE_IOCONTEXT_POST
830  io_context_.post(
831  [this, &msg]() {
832 #else
833  boost::asio::post(io_context_,
834  [this, &msg]() {
835 #endif
836  bool write_in_progress = !write_msgs_.empty();
837  write_msgs_.push_back(msg);
838  if (!write_in_progress)
839  {
840  do_write();
841  }
842  });
843  }
844 
845  private:
846 #if BOOST_ASIO_USE_RESOLVER_ITERATOR
847  inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
848  {
849  boost::asio::async_connect(socket_, std::move(endpoint_iterator),
850  [this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) {
851 #else
852  inline void do_connect(boost::asio::ip::tcp::resolver::results_type endpoints)
853  {
854  boost::asio::async_connect(socket_, std::move(endpoints),
855  [this](boost::system::error_code ec, boost::asio::ip::tcp::endpoint) {
856 #endif
857  if (!ec)
858  {
859  do_read_message();
860  }
861  else
862  {
863  std::cout << "Server is down.\n";
864  }
865  });
866  }
867 
868  inline void do_read_message()
869  {
870  boost::asio::async_read(socket_,
871  boost::asio::buffer(read_msg_.data(), 1029),
872  [this](boost::system::error_code ec, std::size_t /*length*/) {
873  if (!ec)
874  {
875  do_read_message();
876  }
877  else
878  {
879  std::cout << "Error in client\n";
880  socket_.close();
881  }
882  });
883  }
884 
885  inline void do_write()
886  {
887  boost::asio::async_write(socket_,
888  boost::asio::buffer(write_msgs_.front().data(), write_msgs_.front().length()),
889  [this](boost::system::error_code ec, std::size_t /*length*/) {
890  if (!ec)
891  {
892  write_msgs_.pop_front();
893  if (!write_msgs_.empty())
894  {
895  do_write();
896  }
897  }
898  else
899  {
900  socket_.close();
901  }
902  });
903  }
904 
905  b_io_context& io_context_;
906  boost::asio::ip::tcp::socket socket_;
907  Rtcm_Message read_msg_;
908  std::deque<Rtcm_Message> write_msgs_;
909  };
910 
911 
912  class Queue_Reader
913  {
914  public:
915  Queue_Reader(b_io_context& io_context, std::shared_ptr<Concurrent_Queue<std::string>>& queue, int32_t port) : queue_(queue)
916  {
917  boost::asio::ip::tcp::resolver resolver(io_context);
918  std::string host("localhost");
919  std::string port_str = std::to_string(port);
920 #if BOOST_ASIO_USE_RESOLVER_ITERATOR
921  auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
922  c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
923 #else
924  auto endpoints = resolver.resolve(host, port_str);
925  c = std::make_shared<Tcp_Internal_Client>(io_context, endpoints);
926 #endif
927  }
928 
929  inline void do_read_queue()
930  {
931  for (;;)
932  {
933  std::string message;
934  Rtcm_Message msg;
935  queue_->wait_and_pop(message); // message += '\n';
936  if (message == "Goodbye")
937  {
938  break;
939  }
940 
941  const char* char_msg = message.c_str();
942  msg.body_length(message.length());
943  std::copy_n(char_msg, msg.body_length(), msg.body());
944  msg.encode_header();
945  c->write(msg);
946  }
947  }
948 
949  private:
950  std::shared_ptr<Tcp_Internal_Client> c;
951  std::shared_ptr<Concurrent_Queue<std::string>>& queue_;
952  };
953 
954 
955  class Tcp_Server
956  {
957  public:
958  Tcp_Server(b_io_context& io_context, const boost::asio::ip::tcp::endpoint& endpoint)
959  : acceptor_(io_context), socket_(io_context)
960  {
961  acceptor_.open(endpoint.protocol());
962  acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
963  acceptor_.bind(endpoint);
964  acceptor_.listen();
965  do_accept();
966  }
967 
968  inline void close_server()
969  {
970  socket_.close();
971  acceptor_.close();
972  }
973 
974  private:
975  inline void do_accept()
976  {
977  acceptor_.async_accept(socket_, [this](boost::system::error_code ec) {
978  if (!ec)
979  {
980  if (first_client)
981  {
982  std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
983  first_client = false;
984  }
985  else
986  {
987  std::cout << "Starting RTCM TCP/IP server session...\n";
988  boost::system::error_code ec2;
989  boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
990  if (ec2)
991  {
992  // Error creating remote_endpoint
993  std::cout << "Error getting remote IP address, closing session.\n";
994  LOG(INFO) << "Error getting remote IP address";
995  start_session = false;
996  }
997  else
998  {
999  std::string remote_addr = endpoint.address().to_string();
1000  std::cout << "Serving client from " << remote_addr << '\n';
1001  LOG(INFO) << "Serving client from " << remote_addr;
1002  }
1003  }
1004  if (start_session)
1005  {
1006  std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
1007  }
1008  }
1009  else
1010  {
1011  std::cout << "Error when invoking a RTCM session. " << ec << '\n';
1012  }
1013  start_session = true;
1014  do_accept();
1015  });
1016  }
1017 
1018  boost::asio::ip::tcp::acceptor acceptor_;
1019  boost::asio::ip::tcp::socket socket_;
1020  Rtcm_Listener_Room room_;
1021  bool first_client = true;
1022  bool start_session = true;
1023  };
1024 
1025  b_io_context io_context;
1026  std::shared_ptr<Concurrent_Queue<std::string>> rtcm_message_queue;
1027  std::thread t;
1028  std::thread tq;
1029  std::list<Rtcm::Tcp_Server> servers;
1030  bool server_is_running;
1031  void stop_service();
1032 
1033  //
1034  // Transport Layer
1035  //
1036  std::bitset<8> preamble;
1037  std::bitset<6> reserved_field;
1038  std::string add_CRC(const std::string& m) const;
1039  std::string build_message(const std::string& data) const; // adds 0s to complete a byte and adds the CRC
1040 
1041  //
1042  // Data Fields
1043  //
1044  std::bitset<12> DF002;
1045  int32_t set_DF002(uint32_t message_number);
1046 
1047  std::bitset<12> DF003;
1048  int32_t set_DF003(uint32_t ref_station_ID);
1049 
1050  std::bitset<30> DF004;
1051  int32_t set_DF004(double obs_time);
1052 
1053  std::bitset<1> DF005;
1054  int32_t set_DF005(bool sync_flag);
1055 
1056  std::bitset<5> DF006;
1057  int32_t set_DF006(const std::map<int32_t, Gnss_Synchro>& observables);
1058 
1059  std::bitset<1> DF007;
1060  int32_t set_DF007(bool divergence_free_smoothing_indicator); // 0 - Divergence-free smoothing not used 1 - Divergence-free smoothing used
1061 
1062  std::bitset<3> DF008;
1063  int32_t set_DF008(int16_t smoothing_interval);
1064 
1065  std::bitset<6> DF009;
1066  int32_t set_DF009(const Gnss_Synchro& gnss_synchro);
1067  int32_t set_DF009(const Gps_Ephemeris& gps_eph);
1068 
1069  std::bitset<1> DF010;
1070  int32_t set_DF010(bool code_indicator);
1071 
1072  std::bitset<24> DF011;
1073  int32_t set_DF011(const Gnss_Synchro& gnss_synchro);
1074 
1075  std::bitset<20> DF012;
1076  int32_t set_DF012(const Gnss_Synchro& gnss_synchro);
1077 
1078  std::bitset<7> DF013;
1079  int32_t set_DF013(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
1080 
1081  std::bitset<8> DF014;
1082  int32_t set_DF014(const Gnss_Synchro& gnss_synchro);
1083 
1084  std::bitset<8> DF015;
1085  int32_t set_DF015(const Gnss_Synchro& gnss_synchro);
1086 
1087  std::bitset<14> DF017;
1088  int32_t set_DF017(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
1089 
1090  std::bitset<20> DF018;
1091  int32_t set_DF018(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
1092 
1093  std::bitset<7> DF019;
1094  int32_t set_DF019(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
1095 
1096  std::bitset<8> DF020;
1097  int32_t set_DF020(const Gnss_Synchro& gnss_synchro);
1098 
1099  std::bitset<6> DF021;
1100  int32_t set_DF021();
1101 
1102  std::bitset<1> DF022;
1103  int32_t set_DF022(bool gps_indicator);
1104 
1105  std::bitset<1> DF023;
1106  int32_t set_DF023(bool glonass_indicator);
1107 
1108  std::bitset<1> DF024;
1109  int32_t set_DF024(bool galileo_indicator);
1110 
1111  std::bitset<38> DF025;
1112  int32_t set_DF025(double antenna_ECEF_X_m);
1113 
1114  std::bitset<38> DF026;
1115  int32_t set_DF026(double antenna_ECEF_Y_m);
1116 
1117  std::bitset<38> DF027;
1118  int32_t set_DF027(double antenna_ECEF_Z_m);
1119 
1120  std::bitset<16> DF028;
1121  int32_t set_DF028(double height);
1122 
1123  std::bitset<8> DF029;
1124 
1125  std::bitset<8> DF031;
1126  int32_t set_DF031(uint32_t antenna_setup_id);
1127 
1128  std::bitset<8> DF032;
1129 
1130  /*!
1131  * \brief Sets the Data Field value
1132  * \note Code added as part of GSoC 2017 program
1133  * \param obs_time Time of observation at the moment of printing
1134  * \return returns 0 upon success
1135  */
1136  int32_t set_DF034(double obs_time);
1137  std::bitset<27> DF034; //!< GLONASS Epoch Time (tk)
1138 
1139  std::bitset<5> DF035; //!< No. of GLONASS Satellite Signals Processed
1140  int32_t set_DF035(const std::map<int32_t, Gnss_Synchro>& observables);
1141 
1142  std::bitset<1> DF036; //!< GLONASS Divergence-free Smoothing Indicator
1143  int32_t set_DF036(bool divergence_free_smoothing_indicator);
1144 
1145  std::bitset<3> DF037; //!< GLONASS Smoothing Interval
1146  int32_t set_DF037(int16_t smoothing_interval);
1147 
1148  std::bitset<6> DF038; //!< GLONASS Satellite ID (Satellite Slot Number)
1149  int32_t set_DF038(const Gnss_Synchro& gnss_synchro);
1150  int32_t set_DF038(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1151 
1152  std::bitset<1> DF039; //!< GLONASS L1 Code Indicator
1153  int32_t set_DF039(bool code_indicator);
1154 
1155  std::bitset<5> DF040; //!< GLONASS Satellite Frequency Number
1156  int32_t set_DF040(int32_t frequency_channel_number);
1157  int32_t set_DF040(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1158 
1159  std::bitset<25> DF041; //!< GLONASS L1 Pseudorange
1160  int32_t set_DF041(const Gnss_Synchro& gnss_synchro);
1161 
1162  std::bitset<20> DF042; //!< GLONASS L1 PhaseRange - L1 Pseudorange
1163  int32_t set_DF042(const Gnss_Synchro& gnss_synchro);
1164 
1165  std::bitset<7> DF043; //!< GLONASS L1 Lock Time Indicator
1166  int32_t set_DF043(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
1167 
1168  std::bitset<7> DF044; //!< GLONASS Integer L1 Pseudorange Modulus Ambiguity
1169  int32_t set_DF044(const Gnss_Synchro& gnss_synchro);
1170 
1171  std::bitset<8> DF045; //!< GLONASS L1 CNR
1172  int32_t set_DF045(const Gnss_Synchro& gnss_synchro);
1173 
1174  std::bitset<2> DF046; //!< GLONASS L2 code indicator
1175  int32_t set_DF046(uint16_t code_indicator);
1176 
1177  std::bitset<14> DF047; //!< GLONASS L2 - L1 Pseudorange Difference
1178  int32_t set_DF047(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
1179 
1180  std::bitset<20> DF048; //!< GLONASS L2 PhaseRange - L1 Pseudorange
1181  int32_t set_DF048(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2);
1182 
1183  std::bitset<7> DF049; //!< GLONASS L2 Lock Time Indicator
1184  int32_t set_DF049(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
1185 
1186  std::bitset<8> DF050; //!< GLONASS L2 CNR
1187  int32_t set_DF050(const Gnss_Synchro& gnss_synchro);
1188 
1189  std::bitset<16> DF051;
1190  int32_t set_DF051(const Gps_Ephemeris& gps_eph, double obs_time);
1191 
1192  std::bitset<17> DF052;
1193  int32_t set_DF052(const Gps_Ephemeris& gps_eph, double obs_time);
1194 
1195  // Contents of GPS Satellite Ephemeris Data, Message Type 1019
1196  std::bitset<8> DF071;
1197  int32_t set_DF071(const Gps_Ephemeris& gps_eph);
1198 
1199  std::bitset<10> DF076;
1200  int32_t set_DF076(const Gps_Ephemeris& gps_eph);
1201 
1202  std::bitset<4> DF077;
1203  int32_t set_DF077(const Gps_Ephemeris& gps_eph);
1204 
1205  std::bitset<2> DF078;
1206  int32_t set_DF078(const Gps_Ephemeris& gps_eph);
1207 
1208  std::bitset<14> DF079;
1209  int32_t set_DF079(const Gps_Ephemeris& gps_eph);
1210 
1211  std::bitset<8> DF080;
1212  int32_t set_DF080(const Gps_Ephemeris& gps_eph);
1213 
1214  std::bitset<16> DF081;
1215  int32_t set_DF081(const Gps_Ephemeris& gps_eph);
1216 
1217  std::bitset<8> DF082;
1218  int32_t set_DF082(const Gps_Ephemeris& gps_eph);
1219 
1220  std::bitset<16> DF083;
1221  int32_t set_DF083(const Gps_Ephemeris& gps_eph);
1222 
1223  std::bitset<22> DF084;
1224  int32_t set_DF084(const Gps_Ephemeris& gps_eph);
1225 
1226  std::bitset<10> DF085;
1227  int32_t set_DF085(const Gps_Ephemeris& gps_eph);
1228 
1229  std::bitset<16> DF086;
1230  int32_t set_DF086(const Gps_Ephemeris& gps_eph);
1231 
1232  std::bitset<16> DF087;
1233  int32_t set_DF087(const Gps_Ephemeris& gps_eph);
1234 
1235  std::bitset<32> DF088;
1236  int32_t set_DF088(const Gps_Ephemeris& gps_eph);
1237 
1238  std::bitset<16> DF089;
1239  int32_t set_DF089(const Gps_Ephemeris& gps_eph);
1240 
1241  std::bitset<32> DF090;
1242  int32_t set_DF090(const Gps_Ephemeris& gps_eph);
1243 
1244  std::bitset<16> DF091;
1245  int32_t set_DF091(const Gps_Ephemeris& gps_eph);
1246 
1247  std::bitset<32> DF092;
1248  int32_t set_DF092(const Gps_Ephemeris& gps_eph);
1249 
1250  std::bitset<16> DF093;
1251  int32_t set_DF093(const Gps_Ephemeris& gps_eph);
1252 
1253  std::bitset<16> DF094;
1254  int32_t set_DF094(const Gps_Ephemeris& gps_eph);
1255 
1256  std::bitset<32> DF095;
1257  int32_t set_DF095(const Gps_Ephemeris& gps_eph);
1258 
1259  std::bitset<16> DF096;
1260  int32_t set_DF096(const Gps_Ephemeris& gps_eph);
1261 
1262  std::bitset<32> DF097;
1263  int32_t set_DF097(const Gps_Ephemeris& gps_eph);
1264 
1265  std::bitset<16> DF098;
1266  int32_t set_DF098(const Gps_Ephemeris& gps_eph);
1267 
1268  std::bitset<32> DF099;
1269  int32_t set_DF099(const Gps_Ephemeris& gps_eph);
1270 
1271  std::bitset<24> DF100;
1272  int32_t set_DF100(const Gps_Ephemeris& gps_eph);
1273 
1274  std::bitset<8> DF101;
1275  int32_t set_DF101(const Gps_Ephemeris& gps_eph);
1276 
1277  std::bitset<6> DF102;
1278  int32_t set_DF102(const Gps_Ephemeris& gps_eph);
1279 
1280  std::bitset<1> DF103;
1281  int32_t set_DF103(const Gps_Ephemeris& gps_eph);
1282 
1283  std::bitset<1> DF104; //!< GLONASS Almanac Health
1284  int32_t set_DF104(uint32_t glonass_gnav_alm_health);
1285 
1286  std::bitset<1> DF105; //!< GLONASS Almanac Health Availability Indicator
1287  int32_t set_DF105(uint32_t glonass_gnav_alm_health_ind);
1288 
1289  std::bitset<2> DF106; //!< GLONASS P1 Word
1290  int32_t set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1291 
1292  std::bitset<12> DF107; //!< GLONASS Epoch (tk)
1293  int32_t set_DF107(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1294 
1295  std::bitset<1> DF108; //!< GLONASS MSB of Bn Word
1296  int32_t set_DF108(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1297 
1298  std::bitset<1> DF109; //!< GLONASS P2 Word
1299  int32_t set_DF109(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1300 
1301  std::bitset<7> DF110; //!< GLONASS Ephmeris Epoch (tb)
1302  int32_t set_DF110(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1303 
1304  std::bitset<24> DF111; //!< GLONASS Xn first derivative
1305  int32_t set_DF111(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1306 
1307  std::bitset<27> DF112; //!< GLONASS Xn
1308  int32_t set_DF112(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1309 
1310  std::bitset<5> DF113; //!< GLONASS Xn second derivative
1311  int32_t set_DF113(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1312 
1313  std::bitset<24> DF114; //!< GLONASS Yn first derivative
1314  int32_t set_DF114(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1315 
1316  std::bitset<27> DF115; //!< GLONASS Yn
1317  int32_t set_DF115(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1318 
1319  std::bitset<5> DF116; //!< GLONASS Yn second derivative
1320  int32_t set_DF116(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1321 
1322  std::bitset<24> DF117; //!< GLONASS Zn first derivative
1323  int32_t set_DF117(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1324 
1325  std::bitset<27> DF118; //!< GLONASS Zn
1326  int32_t set_DF118(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1327 
1328  std::bitset<5> DF119; //!< GLONASS Zn second derivative
1329  int32_t set_DF119(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1330 
1331  std::bitset<1> DF120; //!< GLONASS P3
1332  int32_t set_DF120(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1333 
1334  std::bitset<11> DF121; //!< GLONASS GAMMA_N
1335  int32_t set_DF121(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1336 
1337  std::bitset<2> DF122; //!< GLONASS P
1338  int32_t set_DF122(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1339 
1340  std::bitset<1> DF123; //!< GLONASS ln (third string)
1341  int32_t set_DF123(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1342 
1343  std::bitset<22> DF124; //!< GLONASS TAU_N
1344  int32_t set_DF124(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1345 
1346  std::bitset<5> DF125; //!< GLONASS DELTA_TAU_N
1347  int32_t set_DF125(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1348 
1349  std::bitset<5> DF126; //!< GLONASS Eccentricity
1350  int32_t set_DF126(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1351 
1352  std::bitset<1> DF127; //!< GLONASS P4
1353  int32_t set_DF127(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1354 
1355  std::bitset<4> DF128; //!< GLONASS F_T
1356  int32_t set_DF128(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1357 
1358  std::bitset<11> DF129; //!< GLONASS N_T
1359  int32_t set_DF129(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1360 
1361  std::bitset<2> DF130; //!< GLONASS M
1362  int32_t set_DF130(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1363 
1364  std::bitset<1> DF131; //!< GLONASS Availability of additional data
1365  int32_t set_DF131(uint32_t fifth_str_additional_data_ind);
1366 
1367  std::bitset<11> DF132; //!< GLONASS N_A
1368  int32_t set_DF132(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
1369 
1370  std::bitset<32> DF133; //!< GLONASS TAU_C
1371  int32_t set_DF133(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
1372 
1373  std::bitset<5> DF134; //!< GLONASS N_4
1374  int32_t set_DF134(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
1375 
1376  std::bitset<22> DF135; //!< GLONASS TAU_GPS
1377  int32_t set_DF135(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
1378 
1379  std::bitset<1> DF136; //!< GLONASS L_N (FIFTH STRING)
1380  int32_t set_DF136(const Glonass_Gnav_Ephemeris& glonass_gnav_eph);
1381 
1382  std::bitset<1> DF137;
1383  int32_t set_DF137(const Gps_Ephemeris& gps_eph);
1384 
1385 
1386  std::bitset<1> DF141;
1387  int32_t set_DF141(const Gps_Ephemeris& gps_eph);
1388 
1389  std::bitset<1> DF142;
1390  int32_t set_DF142(const Gps_Ephemeris& gps_eph);
1391 
1392  std::bitset<30> DF248;
1393  int32_t set_DF248(double obs_time);
1394 
1395  // Contents of Galileo F/NAV Satellite Ephemeris Data, Message Type 1045
1396  std::bitset<6> DF252;
1397  int32_t set_DF252(const Galileo_Ephemeris& gal_eph);
1398 
1399  std::bitset<12> DF289;
1400  int32_t set_DF289(const Galileo_Ephemeris& gal_eph);
1401 
1402  std::bitset<10> DF290;
1403  int32_t set_DF290(const Galileo_Ephemeris& gal_eph);
1404 
1405  std::bitset<8> DF291;
1406  int32_t set_DF291(const Galileo_Ephemeris& gal_eph);
1407 
1408  std::bitset<14> DF292;
1409  int32_t set_DF292(const Galileo_Ephemeris& gal_eph);
1410 
1411  std::bitset<14> DF293;
1412  int32_t set_DF293(const Galileo_Ephemeris& gal_eph);
1413 
1414  std::bitset<6> DF294;
1415  int32_t set_DF294(const Galileo_Ephemeris& gal_eph);
1416 
1417  std::bitset<21> DF295;
1418  int32_t set_DF295(const Galileo_Ephemeris& gal_eph);
1419 
1420  std::bitset<31> DF296;
1421  int32_t set_DF296(const Galileo_Ephemeris& gal_eph);
1422 
1423  std::bitset<16> DF297;
1424  int32_t set_DF297(const Galileo_Ephemeris& gal_eph);
1425 
1426  std::bitset<16> DF298;
1427  int32_t set_DF298(const Galileo_Ephemeris& gal_eph);
1428 
1429  std::bitset<32> DF299;
1430  int32_t set_DF299(const Galileo_Ephemeris& gal_eph);
1431 
1432  std::bitset<16> DF300;
1433  int32_t set_DF300(const Galileo_Ephemeris& gal_eph);
1434 
1435  std::bitset<32> DF301;
1436  int32_t set_DF301(const Galileo_Ephemeris& gal_eph);
1437 
1438  std::bitset<16> DF302;
1439  int32_t set_DF302(const Galileo_Ephemeris& gal_eph);
1440 
1441  std::bitset<32> DF303;
1442  int32_t set_DF303(const Galileo_Ephemeris& gal_eph);
1443 
1444  std::bitset<14> DF304;
1445  int32_t set_DF304(const Galileo_Ephemeris& gal_eph);
1446 
1447  std::bitset<16> DF305;
1448  int32_t set_DF305(const Galileo_Ephemeris& gal_eph);
1449 
1450  std::bitset<32> DF306;
1451  int32_t set_DF306(const Galileo_Ephemeris& gal_eph);
1452 
1453  std::bitset<16> DF307;
1454  int32_t set_DF307(const Galileo_Ephemeris& gal_eph);
1455 
1456  std::bitset<32> DF308;
1457  int32_t set_DF308(const Galileo_Ephemeris& gal_eph);
1458 
1459  std::bitset<16> DF309;
1460  int32_t set_DF309(const Galileo_Ephemeris& gal_eph);
1461 
1462  std::bitset<32> DF310;
1463  int32_t set_DF310(const Galileo_Ephemeris& gal_eph);
1464 
1465  std::bitset<24> DF311;
1466  int32_t set_DF311(const Galileo_Ephemeris& gal_eph);
1467 
1468  std::bitset<10> DF312;
1469  int32_t set_DF312(const Galileo_Ephemeris& gal_eph);
1470 
1471  std::bitset<10> DF313;
1472  int32_t set_DF313(const Galileo_Ephemeris& gal_eph);
1473 
1474  std::bitset<2> DF314;
1475  int32_t set_DF314(const Galileo_Ephemeris& gal_eph);
1476 
1477  std::bitset<1> DF315;
1478  int32_t set_DF315(const Galileo_Ephemeris& gal_eph);
1479 
1480  std::bitset<2> DF364;
1481 
1482  // Content of message header for MSM1, MSM2, MSM3, MSM4, MSM5, MSM6 and MSM7
1483  std::bitset<1> DF393;
1484  int32_t set_DF393(bool more_messages); // 1 indicates that more MSMs follow for given physical time and reference station ID
1485 
1486  std::bitset<64> DF394;
1487  int32_t set_DF394(const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1488 
1489  std::bitset<32> DF395;
1490  int32_t set_DF395(const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1491 
1492  std::string set_DF396(const std::map<int32_t, Gnss_Synchro>& observables);
1493 
1494  std::bitset<8> DF397;
1495  int32_t set_DF397(const Gnss_Synchro& gnss_synchro);
1496 
1497  std::bitset<10> DF398;
1498  int32_t set_DF398(const Gnss_Synchro& gnss_synchro);
1499 
1500  std::bitset<14> DF399;
1501  int32_t set_DF399(const Gnss_Synchro& gnss_synchro);
1502 
1503  std::bitset<15> DF400;
1504  int32_t set_DF400(const Gnss_Synchro& gnss_synchro);
1505 
1506  std::bitset<22> DF401;
1507  int32_t set_DF401(const Gnss_Synchro& gnss_synchro);
1508 
1509  std::bitset<4> DF402;
1510  int32_t set_DF402(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const Gnss_Synchro& gnss_synchro);
1511 
1512  std::bitset<6> DF403;
1513  int32_t set_DF403(const Gnss_Synchro& gnss_synchro);
1514 
1515  std::bitset<15> DF404;
1516  int32_t set_DF404(const Gnss_Synchro& gnss_synchro);
1517 
1518  std::bitset<20> DF405;
1519  int32_t set_DF405(const Gnss_Synchro& gnss_synchro);
1520 
1521  std::bitset<24> DF406;
1522  int32_t set_DF406(const Gnss_Synchro& gnss_synchro);
1523 
1524  std::bitset<10> DF407;
1525  int32_t set_DF407(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const Gnss_Synchro& gnss_synchro);
1526 
1527  std::bitset<10> DF408;
1528  int32_t set_DF408(const Gnss_Synchro& gnss_synchro);
1529 
1530  std::bitset<3> DF409;
1531  int32_t set_DF409(uint32_t iods);
1532 
1533  std::bitset<2> DF411;
1534  int32_t set_DF411(uint32_t clock_steering_indicator);
1535 
1536  std::bitset<2> DF412;
1537  int32_t set_DF412(uint32_t external_clock_indicator);
1538 
1539  std::bitset<1> DF417;
1540  int32_t set_DF417(bool using_divergence_free_smoothing);
1541 
1542  std::bitset<3> DF418;
1543  int32_t set_DF418(int32_t carrier_smoothing_interval_s);
1544 
1545  std::bitset<1> DF420;
1546  int32_t set_DF420(const Gnss_Synchro& gnss_synchro);
1547 
1548  // IGS State Space Representation (SSR) data fields
1549  // see https://files.igs.org/pub/data/format/igs_ssr_v1.pdf
1550  std::bitset<3> IDF001;
1551  void set_IDF001(uint8_t version);
1552 
1553  std::bitset<8> IDF002;
1554  void set_IDF002(uint8_t igs_message_number);
1555 
1556  std::bitset<20> IDF003;
1557  void set_IDF003(uint32_t tow);
1558 
1559  std::bitset<4> IDF004;
1560  void set_IDF004(uint8_t ssr_update_interval);
1561 
1562  std::bitset<1> IDF005;
1563  void set_IDF005(bool ssr_multiple_message_indicator);
1564 
1565  std::bitset<1> IDF006;
1566  void set_IDF006(bool regional_indicator);
1567 
1568  std::bitset<4> IDF007;
1569  void set_IDF007(uint8_t ssr_iod);
1570 
1571  std::bitset<16> IDF008;
1572  void set_IDF008(uint16_t ssr_provider_id);
1573 
1574  std::bitset<4> IDF009;
1575  void set_IDF009(uint8_t ssr_solution_id);
1576 
1577  std::bitset<6> IDF010;
1578  void set_IDF010(uint8_t num_satellites);
1579 
1580  std::bitset<6> IDF011;
1581  void set_IDF011(uint8_t gnss_satellite_id);
1582 
1583  std::bitset<8> IDF012;
1584  void set_IDF012(uint8_t gnss_iod);
1585 
1586  std::bitset<22> IDF013;
1587  void set_IDF013(float delta_orbit_radial_m);
1588 
1589  std::bitset<20> IDF014;
1590  void set_IDF014(float delta_orbit_in_track_m);
1591 
1592  std::bitset<20> IDF015;
1593  void set_IDF015(float delta_orbit_cross_track_m);
1594 
1595  std::bitset<21> IDF016;
1596  void set_IDF016(float dot_orbit_delta_track_m_s);
1597 
1598  std::bitset<19> IDF017;
1599  void set_IDF017(float dot_orbit_delta_in_track_m_s);
1600 
1601  std::bitset<19> IDF018;
1602  void set_IDF018(float dot_orbit_delta_cross_track_m_s);
1603 
1604  std::bitset<22> IDF019;
1605  void set_IDF019(float delta_clock_c0_m);
1606 
1607  std::bitset<21> IDF020;
1608  void set_IDF020(float delta_clock_c1_m_s);
1609 
1610  std::bitset<27> IDF021;
1611  void set_IDF021(float delta_clock_c2_m_s2);
1612 
1613  std::bitset<5> IDF023;
1614  void set_IDF023(uint8_t num_bias_processed);
1615 
1616  std::bitset<5> IDF024;
1617  void set_IDF024(uint8_t gnss_signal_tracking_mode_id);
1618 
1619  std::bitset<14> IDF025;
1620  void set_IDF025(float code_bias_m);
1621 };
1622 
1623 
1624 /** \} */
1625 /** \} */
1626 #endif // GNSS_SDR_RTCM_H
uint32_t bin_to_uint(const std::string &s) const
Returns an uint32_t from a string of binary symbols.
This is a storage class for the GPS CNAV ephemeris data as described in IS-GPS-200M.
Interface of a thread-safe std::queue.
std::string print_MT1005(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator)
Prints message type 1005 (Stationary Antenna Reference Point)
std::string print_MT1001(const Gps_Ephemeris &gps_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1001 (L1-Only GPS RTK Observables)
Interface of a GLONASS EPHEMERIS storage.
Interface of a GLONASS GNAV UTC MODEL storage.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
Definition: gps_ephemeris.h:40
std::string print_MT1045(const Galileo_Ephemeris &gal_eph)
Prints message type 1045 (Galileo Ephemeris), should be broadcast every 2 minutes.
std::string print_MT1004(const Gps_Ephemeris &ephL1, const Gps_CNAV_Ephemeris &ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1004 (Extended L1 & L2 GPS RTK Observables)
uint64_t hex_to_uint(const std::string &s) const
Returns an uint64_t from a string of hexadecimal symbols.
std::vector< std::string > print_IGM05(const Galileo_HAS_data &has_data)
Prints messages of type IGM05 (SSR Bias Correction)
std::string bin_to_binary_data(const std::string &s) const
Returns a string of binary data from a string of binary symbols.
std::string print_MSM_5(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM5 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR) ...
std::string print_MSM_6(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM6 (Full GNSS pseudoranges and phaseranges plus CNR, high resolution) ...
std::string print_MT1019(const Gps_Ephemeris &gps_eph)
Prints message type 1019 (GPS Ephemeris), should be broadcast in the event that the IODC does not mat...
bool check_CRC(const std::string &message) const
Checks that the CRC of a RTCM package is correct.
std::string print_MSM_1(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM1 (Compact GNSS observables)
std::vector< std::string > print_IGM02(const Galileo_HAS_data &has_data)
Prints messages of type IGM02 (SSR Clock Correction)
std::string print_MT1029(uint32_t ref_id, const Gps_Ephemeris &gps_eph, double obs_time, const std::string &message)
Prints message type 1029 (Unicode Text String)
std::string print_MT1005_test()
For testing purposes.
std::string print_MT1010(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints Extended L1-Only GLONASS RTK Observables.
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
int32_t read_MT1019(const std::string &message, Gps_Ephemeris &gps_eph) const
Verifies and reads messages of type 1019 (GPS Ephemeris). Returns 1 if anything goes wrong...
std::string print_MT1002(const Gps_Ephemeris &gps_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1002 (Extended L1-Only GPS RTK Observables)
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
std::vector< std::string > print_IGM03(const Galileo_HAS_data &has_data)
Prints messages of type IGM03 (SSR Combined Orbit and Clock Correction)
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
std::string print_MSM_4(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM4 (Full GNSS pseudoranges and phaseranges plus CNR)
This class implements the generation and reading of some Message Types defined in the RTCM 3...
Definition: rtcm.h:97
std::string print_MT1008(uint32_t ref_id, const std::string &antenna_descriptor, uint32_t antenna_setup_id, const std::string &antenna_serial_number)
Prints message type 1008 (Antenna Descriptor & Serial Number)
std::string print_MT1003(const Gps_Ephemeris &ephL1, const Gps_CNAV_Ephemeris &ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1003 (L1 & L2 GPS RTK Observables)
std::string print_MSM_2(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM2 (Compact GNSS phaseranges)
std::string print_MT1009(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints L1-Only GLONASS RTK Observables.
Rtcm(uint16_t port=2101)
Default constructor that sets TCP port of the RTCM message server and RTCM Station ID...
std::string binary_data_to_bin(const std::string &s) const
Returns a string of binary symbols from a string of binary data.
std::string print_MSM_7(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM7 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR...
std::string hex_to_bin(const std::string &s) const
Returns a string of binary symbols from a string of hexadecimal symbols.
std::string bin_to_hex(const std::string &s) const
Returns a string of hexadecimal symbols from a string of binary symbols.
int32_t read_MT1045(const std::string &message, Galileo_Ephemeris &gal_eph) const
Verifies and reads messages of type 1045 (Galileo Ephemeris). Returns 1 if anything goes wrong...
void send_message(const std::string &msg)
Sends a message through the server to all connected clients.
uint32_t lock_time(const Gps_Ephemeris &eph, double obs_time, const Gnss_Synchro &gnss_synchro)
Returns the time period in which GPS L1 signals have been continually tracked.
Interface of a GPS EPHEMERIS storage.
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
std::string print_MT1020(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, const Glonass_Gnav_Utc_Model &glonass_gnav_utc_model)
Prints message type 1020 (GLONASS Ephemeris).
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
std::string print_MSM_3(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 ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM3 (Compact GNSS pseudoranges and phaseranges)
std::string print_MT1006(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator, double height)
Prints message type 1006 (Stationary Antenna Reference Point, with Height Information) ...
void stop_server()
Stops the server.
This class implements a thread-safe std::queue.
double bin_to_double(const std::string &s) const
Returns double from a string of binary symbols.
bool is_server_running() const
Returns true if the server is running, false otherwise.
Interface of a GPS CNAV EPHEMERIS storage.
std::string print_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, uint16_t station_id)
Prints L1&L2 GLONASS RTK Observables.
int32_t read_MT1005(const std::string &message, uint32_t &ref_id, double &ecef_x, double &ecef_y, double &ecef_z, bool &gps, bool &glonass, bool &galileo)
Verifies and reads messages of type 1005 (Stationary Antenna Reference Point). Returns 1 if anything ...
Interface of a Galileo EPHEMERIS storage.
void run_server()
Starts running the server.
Class for Galileo HAS message type 1 data storage.
std::vector< std::string > print_IGM01(const Galileo_HAS_data &has_data)
Prints messages of type IGM01 (SSR Orbit Correction)
int64_t hex_to_int(const std::string &s) const
Returns a int64_t from a string of hexadecimal symbols.
std::string print_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, uint16_t station_id)
Prints Extended L1&L2 GLONASS RTK Observables.
int32_t read_MT1020(const std::string &message, Glonass_Gnav_Ephemeris &glonass_gnav_eph, Glonass_Gnav_Utc_Model &glonass_gnav_utc_model) const
Verifies and reads messages of type 1020 (GLONASS Ephemeris).
Interface of the Gnss_Synchro class.