1 /* Copyright 2002-2025 CS GROUP
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.gnss.metric.messages.rtcm.ephemeris;
18
19 import org.orekit.annotation.DefaultDataContext;
20 import org.orekit.data.DataContext;
21 import org.orekit.gnss.SatelliteSystem;
22 import org.orekit.propagation.analytical.gnss.GNSSPropagator;
23 import org.orekit.propagation.analytical.gnss.data.GalileoNavigationMessage;
24 import org.orekit.time.GNSSDate;
25 import org.orekit.time.TimeScales;
26
27 /**
28 * Container for RTCM 1045 data.
29 * @author Bryan Cazabonne
30 * @since 11.0
31 */
32 public class Rtcm1045Data extends RtcmEphemerisData {
33
34 /** Galileo navigation message. */
35 private GalileoNavigationMessage galileoNavigationMessage;
36
37 /** Galileo Time of clock. */
38 private double galileoToc;
39
40 /** Galileo NAV Data Validity Status. */
41 private int galileoDataValidityStatus;
42
43 /** Constructor. */
44 public Rtcm1045Data() {
45 // Nothing to do ...
46 }
47
48 /**
49 * Get the Galileo navigation message corresponding to the current RTCM data.
50 * <p>
51 * This object can be used to initialize a {@link GNSSPropagator}
52 * <p>
53 * This method uses the {@link DataContext#getDefault()} to initialize
54 * the time scales used to configure the reference epochs of the navigation
55 * message.
56 *
57 * @return the Galileo navigation message
58 */
59 @DefaultDataContext
60 public GalileoNavigationMessage getGalileoNavigationMessage() {
61 return getGalileoNavigationMessage(DataContext.getDefault().getTimeScales());
62 }
63
64 /**
65 * Get the Galileo navigation message corresponding to the current RTCM data.
66 * <p>
67 * This object can be used to initialize a {@link GNSSPropagator}
68 * <p>
69 * When calling this method, the reference epochs of the navigation message
70 * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
71 *
72 * @param timeScales time scales to use for initializing epochs
73 * @return the Galileo navigation message
74 */
75 public GalileoNavigationMessage getGalileoNavigationMessage(final TimeScales timeScales) {
76
77 // Satellite system
78 final SatelliteSystem system = SatelliteSystem.GALILEO;
79
80 // Week number and time of ephemeris
81 final int week = galileoNavigationMessage.getWeek();
82
83 // Set the ephemeris reference data
84 galileoNavigationMessage.setEpochToc(new GNSSDate(week, galileoToc, system, timeScales).getDate());
85
86 // Return the navigation message
87 return galileoNavigationMessage;
88
89 }
90
91 /**
92 * Set the Galileo navigation message.
93 * @param galileoNavigationMessage the Galileo navigation message to set
94 */
95 public void setGalileoNavigationMessage(final GalileoNavigationMessage galileoNavigationMessage) {
96 this.galileoNavigationMessage = galileoNavigationMessage;
97 }
98
99 /**
100 * Get the Galileo time of clock.
101 * <p>
102 * The Galileo time of clock is given in seconds since
103 * the beginning of the Galileo week.
104 * </p>
105 * @return the Galileo time of clock
106 */
107 public double getGalileoToc() {
108 return galileoToc;
109 }
110
111 /**
112 * Set the Galileo time of clock.
113 * @param toc the time of clock to set
114 */
115 public void setGalileoToc(final double toc) {
116 this.galileoToc = toc;
117 }
118
119 /**
120 * Get the Galileo data validity status.
121 * @return the Galileo data validity status
122 */
123 public int getGalileoDataValidityStatus() {
124 return galileoDataValidityStatus;
125 }
126
127 /**
128 * Set the Galileo data validity status.
129 * @param galileoDataValidityStatus the validity status to set
130 */
131 public void setGalileoDataValidityStatus(final int galileoDataValidityStatus) {
132 this.galileoDataValidityStatus = galileoDataValidityStatus;
133 }
134
135 }