GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
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 */
37class Serdes_Galileo_Eph
38{
39public:
40 Serdes_Galileo_Eph()
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
47 ~Serdes_Galileo_Eph()
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 Serdes_Galileo_Eph temp(rhs);
59 std::swap(this->monitor_, temp.monitor_);
60 return *this;
61 }
62
63 inline Serdes_Galileo_Eph(Serdes_Galileo_Eph&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
64 {
65 }
66
67 inline Serdes_Galileo_Eph& operator=(Serdes_Galileo_Eph&& other) noexcept //!< Move assignment operator
68 {
69 std::swap(this->monitor_, other.monitor_);
70 return *this;
71 }
72
73 inline std::string createProtobuffer(const std::shared_ptr<Galileo_Ephemeris> monitor) //!< Serialization into a string
74 {
75 monitor_.Clear();
76
77 std::string data;
78
79 monitor_.set_prn(monitor->PRN);
80 monitor_.set_m_0(monitor->M_0);
81 monitor_.set_delta_n(monitor->delta_n);
82 monitor_.set_ecc(monitor->ecc);
83 monitor_.set_sqrta(monitor->sqrtA);
84 monitor_.set_omega_0(monitor->OMEGA_0);
85 monitor_.set_i_0(monitor->i_0);
86 monitor_.set_omega(monitor->omega);
87 monitor_.set_omegadot(monitor->OMEGAdot);
88 monitor_.set_idot(monitor->idot);
89 monitor_.set_cuc(monitor->Cuc);
90 monitor_.set_cus(monitor->Cus);
91 monitor_.set_crc(monitor->Crc);
92 monitor_.set_crs(monitor->Crs);
93 monitor_.set_cic(monitor->Cic);
94 monitor_.set_cis(monitor->Cis);
95 monitor_.set_toe(monitor->toe);
96 monitor_.set_toc(monitor->toc);
97 monitor_.set_af0(monitor->af0);
98 monitor_.set_af1(monitor->af1);
99 monitor_.set_af2(monitor->af2);
100 monitor_.set_satclkdrift(monitor->satClkDrift);
101 monitor_.set_dtr(monitor->dtr);
102 monitor_.set_wn(monitor->WN);
103 monitor_.set_tow(monitor->tow);
104
105 // Galileo-specific parameters
106 monitor_.set_iod_ephemeris(monitor->IOD_ephemeris);
107 monitor_.set_iod_nav(monitor->IOD_nav);
108 monitor_.set_sisa(monitor->SISA);
109 monitor_.set_e5a_hs(monitor->E5a_HS);
110 monitor_.set_e5b_hs(monitor->E5b_HS);
111 monitor_.set_e1b_hs(monitor->E1B_HS);
112 monitor_.set_e5a_dvs(monitor->E5a_DVS);
113 monitor_.set_e5b_dvs(monitor->E5b_DVS);
114 monitor_.set_e1b_dvs(monitor->E1B_DVS);
115 monitor_.set_bgd_e1e5a(monitor->BGD_E1E5a);
116 monitor_.set_bgd_e1e5b(monitor->BGD_E1E5b);
117
118 monitor_.SerializeToString(&data);
119 return data;
120 }
121
122 inline Galileo_Ephemeris readProtobuffer(const gnss_sdr::GalileoEphemeris& mon) const //!< Deserialization
123 {
124 Galileo_Ephemeris monitor;
125
126 monitor.PRN = mon.prn();
127 monitor.M_0 = mon.m_0();
128 monitor.delta_n = mon.delta_n();
129 monitor.ecc = mon.ecc();
130 monitor.sqrtA = mon.sqrta();
131 monitor.OMEGA_0 = mon.omega_0();
132 monitor.i_0 = mon.i_0();
133 monitor.omega = mon.omega();
134 monitor.OMEGAdot = mon.omegadot();
135 monitor.idot = mon.idot();
136 monitor.Cuc = mon.cuc();
137 monitor.Cus = mon.cus();
138 monitor.Crc = mon.crc();
139 monitor.Crs = mon.crs();
140 monitor.Cic = mon.cic();
141 monitor.Cis = mon.cis();
142 monitor.toe = mon.toe();
143 monitor.toc = mon.toc();
144 monitor.af0 = mon.af0();
145 monitor.af1 = mon.af1();
146 monitor.af2 = mon.af2();
147 monitor.satClkDrift = mon.satclkdrift();
148 monitor.dtr = mon.dtr();
149 monitor.WN = mon.wn();
150 monitor.tow = mon.tow();
151
152 // Galileo-specific parameters
153 monitor.IOD_ephemeris = mon.iod_ephemeris();
154 monitor.IOD_nav = mon.iod_nav();
155 monitor.SISA = mon.sisa();
156 monitor.E5a_HS = mon.e5a_hs();
157 monitor.E5b_HS = mon.e5b_hs();
158 monitor.E1B_HS = mon.e1b_hs();
159 monitor.E5a_DVS = mon.e5a_dvs();
160 monitor.E5b_DVS = mon.e5b_dvs();
161 monitor.E1B_DVS = mon.e1b_dvs();
162 monitor.BGD_E1E5a = mon.bgd_e1e5a();
163 monitor.BGD_E1E5b = mon.bgd_e1e5b();
164
165 return monitor;
166 }
167
168private:
169 gnss_sdr::GalileoEphemeris monitor_{};
170};
171
172
173/** \} */
174/** \} */
175#endif // GGNSS_SDR_SERDES_GALILEO_EPH_H
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
double BGD_E1E5a
E1-E5a Broadcast Group Delay [s].
int32_t E5a_HS
E5a Signal Health Status.
int32_t E5b_HS
E5b Signal Health Status.
bool E5b_DVS
E5b Data Validity Status.
bool E1B_DVS
E1B Data Validity Status.
int32_t SISA
Signal in space accuracy index.
bool E5a_DVS
E5a Data Validity Status.
double BGD_E1E5b
E1-E5b Broadcast Group Delay [s].
int32_t E1B_HS
E1B Signal Health Status.
double OMEGA_0
Longitude of ascending node of orbital plane at weekly epoch [rad].
double sqrtA
Square root of the semi-major axis [meters^1/2].
double M_0
Mean anomaly at reference time [rad].
double af0
SV clock bias correction coefficient [s].
double Crc
Amplitude of the cosine harmonic correction term to the orbit radius [meters].
double Crs
Amplitude of the sine harmonic correction term to the orbit radius [meters].
double Cus
Amplitude of the sine harmonic correction term to the argument of latitude [rad].
double Cis
Amplitude of the sine harmonic correction term to the angle of inclination [rad].
double idot
Rate of inclination angle [rad/sec].
double i_0
Inclination angle at reference time [rad].
double OMEGAdot
Rate of right ascension [rad/sec].
double delta_n
Mean motion difference from computed value [rad/sec].
double ecc
Eccentricity.
double satClkDrift
SV clock drift.
double dtr
Relativistic clock correction term.
double af1
SV clock drift correction coefficient [s/s].
double af2
SV clock drift rate correction coefficient [s/s^2].
uint32_t PRN
SV ID.
double Cuc
Amplitude of the cosine harmonic correction term to the argument of latitude [rad].
double Cic
Amplitude of the cosine harmonic correction term to the angle of inclination [rad].
int32_t tow
Time of Week.
double omega
Argument of perigee [rad].
int32_t toe
Ephemeris reference time [s].
int32_t toc
Clock correction data reference Time of Week [sec].
int32_t WN
Week number.
This class implements serialization and deserialization of Galileo_Ephemeris using Protocol Buffers.
Galileo_Ephemeris readProtobuffer(const gnss_sdr::GalileoEphemeris &mon) const
< Deserialization
Serdes_Galileo_Eph & operator=(const Serdes_Galileo_Eph &rhs) noexcept
< Copy assignment operator
Serdes_Galileo_Eph & operator=(Serdes_Galileo_Eph &&other) noexcept
< Move assignment operator
std::string createProtobuffer(const std::shared_ptr< Galileo_Ephemeris > monitor)
Interface of a Galileo EPHEMERIS storage.