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