GNSS-SDR  0.0.17
An Open Source GNSS Software Defined Receiver
serdes_galileo_eph.h
Go to the documentation of this file.
1 /*!
2  * \file serdes_galileo_eph.h
3  * \brief Serialization / Deserialization of Galileo_Ephemeris objects using
4  * Protocol Buffers
5  * \author Javier Arribas, 2021. jarribas(at)cttc.es
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_SERDES_GALILEO_EPH_H
19 #define GNSS_SDR_SERDES_GALILEO_EPH_H
20 
21 #include "galileo_ephemeris.h"
22 #include "galileo_ephemeris.pb.h" // file created by Protocol Buffers at compile time
23 #include <memory>
24 #include <string>
25 #include <utility>
26 
27 /** \addtogroup PVT
28  * \{ */
29 /** \addtogroup PVT_libs
30  * \{ */
31 
32 
33 /*!
34  * \brief This class implements serialization and deserialization of
35  * Galileo_Ephemeris using Protocol Buffers.
36  */
38 {
39 public:
41  {
42  // Verify that the version of the library that we linked against is
43  // compatible with the version of the headers we compiled against.
44  GOOGLE_PROTOBUF_VERIFY_VERSION;
45  }
46 
48  {
49  // google::protobuf::ShutdownProtobufLibrary();
50  }
51 
52  inline Serdes_Galileo_Eph(const Serdes_Galileo_Eph& other) noexcept : monitor_(other.monitor_) //!< Copy constructor
53  {
54  }
55 
56  inline Serdes_Galileo_Eph& operator=(const Serdes_Galileo_Eph& rhs) noexcept //!< Copy assignment operator
57  {
58  this->monitor_ = rhs.monitor_;
59  return *this;
60  }
61 
62  inline Serdes_Galileo_Eph(Serdes_Galileo_Eph&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
63  {
64  }
65 
66  inline Serdes_Galileo_Eph& operator=(Serdes_Galileo_Eph&& other) noexcept //!< Move assignment operator
67  {
68  if (this != &other)
69  {
70  this->monitor_ = std::move(other.monitor_);
71  }
72  return *this;
73  }
74 
75  inline std::string createProtobuffer(const std::shared_ptr<Galileo_Ephemeris> monitor) //!< Serialization into a string
76  {
77  monitor_.Clear();
78 
79  std::string data;
80 
81  monitor_.set_prn(monitor->PRN);
82  monitor_.set_m_0(monitor->M_0);
83  monitor_.set_delta_n(monitor->delta_n);
84  monitor_.set_ecc(monitor->ecc);
85  monitor_.set_sqrta(monitor->sqrtA);
86  monitor_.set_omega_0(monitor->OMEGA_0);
87  monitor_.set_i_0(monitor->i_0);
88  monitor_.set_omega(monitor->omega);
89  monitor_.set_omegadot(monitor->OMEGAdot);
90  monitor_.set_idot(monitor->idot);
91  monitor_.set_cuc(monitor->Cuc);
92  monitor_.set_cus(monitor->Cus);
93  monitor_.set_crc(monitor->Crc);
94  monitor_.set_crs(monitor->Crs);
95  monitor_.set_cic(monitor->Cic);
96  monitor_.set_cis(monitor->Cis);
97  monitor_.set_toe(monitor->toe);
98  monitor_.set_toc(monitor->toc);
99  monitor_.set_af0(monitor->af0);
100  monitor_.set_af1(monitor->af1);
101  monitor_.set_af2(monitor->af2);
102  monitor_.set_satclkdrift(monitor->satClkDrift);
103  monitor_.set_dtr(monitor->dtr);
104  monitor_.set_wn(monitor->WN);
105  monitor_.set_tow(monitor->tow);
106 
107  // Galileo-specific parameters
108  monitor_.set_iod_ephemeris(monitor->IOD_ephemeris);
109  monitor_.set_iod_nav(monitor->IOD_nav);
110  monitor_.set_sisa(monitor->SISA);
111  monitor_.set_e5a_hs(monitor->E5a_HS);
112  monitor_.set_e5b_hs(monitor->E5b_HS);
113  monitor_.set_e1b_hs(monitor->E1B_HS);
114  monitor_.set_e5a_dvs(monitor->E5a_DVS);
115  monitor_.set_e5b_dvs(monitor->E5b_DVS);
116  monitor_.set_e1b_dvs(monitor->E1B_DVS);
117  monitor_.set_bgd_e1e5a(monitor->BGD_E1E5a);
118  monitor_.set_bgd_e1e5b(monitor->BGD_E1E5b);
119 
120  monitor_.SerializeToString(&data);
121  return data;
122  }
123 
124  inline Galileo_Ephemeris readProtobuffer(const gnss_sdr::GalileoEphemeris& mon) const //!< Deserialization
125  {
126  Galileo_Ephemeris monitor;
127 
128  monitor.PRN = mon.prn();
129  monitor.M_0 = mon.m_0();
130  monitor.delta_n = mon.delta_n();
131  monitor.ecc = mon.ecc();
132  monitor.sqrtA = mon.sqrta();
133  monitor.OMEGA_0 = mon.omega_0();
134  monitor.i_0 = mon.i_0();
135  monitor.omega = mon.omega();
136  monitor.OMEGAdot = mon.omegadot();
137  monitor.idot = mon.idot();
138  monitor.Cuc = mon.cuc();
139  monitor.Cus = mon.cus();
140  monitor.Crc = mon.crc();
141  monitor.Crs = mon.crs();
142  monitor.Cic = mon.cic();
143  monitor.Cis = mon.cis();
144  monitor.toe = mon.toe();
145  monitor.toc = mon.toc();
146  monitor.af0 = mon.af0();
147  monitor.af1 = mon.af1();
148  monitor.af2 = mon.af2();
149  monitor.satClkDrift = mon.satclkdrift();
150  monitor.dtr = mon.dtr();
151  monitor.WN = mon.wn();
152  monitor.tow = mon.tow();
153 
154  // Galileo-specific parameters
155  monitor.IOD_ephemeris = mon.iod_ephemeris();
156  monitor.IOD_nav = mon.iod_nav();
157  monitor.SISA = mon.sisa();
158  monitor.E5a_HS = mon.e5a_hs();
159  monitor.E5b_HS = mon.e5b_hs();
160  monitor.E1B_HS = mon.e1b_hs();
161  monitor.E5a_DVS = mon.e5a_dvs();
162  monitor.E5b_DVS = mon.e5b_dvs();
163  monitor.E1B_DVS = mon.e1b_dvs();
164  monitor.BGD_E1E5a = mon.bgd_e1e5a();
165  monitor.BGD_E1E5b = mon.bgd_e1e5b();
166 
167  return monitor;
168  }
169 
170 private:
171  gnss_sdr::GalileoEphemeris monitor_{};
172 };
173 
174 
175 /** \} */
176 /** \} */
177 #endif // GGNSS_SDR_SERDES_GALILEO_EPH_H
Serdes_Galileo_Eph & operator=(Serdes_Galileo_Eph &&other) noexcept
< Move assignment operator
int32_t E5a_HS
E5a Signal Health Status.
double i_0
Inclination angle at reference time [semi-circles].
Serdes_Galileo_Eph & operator=(const Serdes_Galileo_Eph &rhs) noexcept
< Copy assignment operator
std::string createProtobuffer(const std::shared_ptr< Galileo_Ephemeris > monitor)
double OMEGA_0
Longitude of ascending node of orbital plane at weekly epoch [semi-circles].
bool E5a_DVS
E5a Data Validity Status.
int32_t toc
Clock correction data reference Time of Week [sec].
double Crc
Amplitude of the cosine harmonic correction term to the orbit radius [meters].
Galileo_Ephemeris readProtobuffer(const gnss_sdr::GalileoEphemeris &mon) const
< Deserialization
int32_t SISA
Signal in space accuracy index.
double af2
SV clock drift rate correction coefficient [s/s^2].
double BGD_E1E5a
E1-E5a Broadcast Group Delay [s].
bool E5b_DVS
E5b Data Validity Status.
uint32_t PRN
SV ID.
double Cis
Amplitude of the sine harmonic correction term to the angle of inclination [radians].
double BGD_E1E5b
E1-E5b Broadcast Group Delay [s].
double af0
SV clock bias correction coefficient [s].
double ecc
Eccentricity.
This class implements serialization and deserialization of Galileo_Ephemeris using Protocol Buffers...
bool E1B_DVS
E1B Data Validity Status.
double M_0
Mean anomaly at reference time [semi-circles].
int32_t E1B_HS
E1B Signal Health Status.
int32_t WN
Week number.
int32_t toe
Ephemeris reference time [s].
int32_t tow
Time of Week.
double Cus
Amplitude of the sine harmonic correction term to the argument of latitude [radians].
double OMEGAdot
Rate of right ascension [semi-circles/sec].
double delta_n
Mean motion difference from computed value [semi-circles/sec].
double idot
Rate of inclination angle [semi-circles/sec].
double Cic
Amplitude of the cosine harmonic correction term to the angle of inclination [radians].
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
double Cuc
Amplitude of the cosine harmonic correction term to the argument of latitude [radians].
double omega
Argument of perigee [semi-circles].
int32_t E5b_HS
E5b Signal Health Status.
double af1
SV clock drift correction coefficient [s/s].
double Crs
Amplitude of the sine harmonic correction term to the orbit radius [meters].
double satClkDrift
SV clock drift.
Interface of a Galileo EPHEMERIS storage.
double dtr
Relativistic clock correction term.
double sqrtA
Square root of the semi-major axis [meters^1/2].