1 /* Copyright 2002-2024 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.GPSLegacyNavigationMessage;
24 import org.orekit.time.GNSSDate;
25 import org.orekit.time.TimeScales;
26
27 /**
28 * Container for RTCM 1019 data.
29 * @author Bryan Cazabonne
30 * @since 11.0
31 */
32 public class Rtcm1019Data extends RtcmEphemerisData {
33
34 /** GPS navigation message. */
35 private GPSLegacyNavigationMessage gpsNavigationMessage;
36
37 /** GPS Time of clock. */
38 private double gpsToc;
39
40 /** GPS code on L2. */
41 private int gpsCodeOnL2;
42
43 /** GPS L2 P data flag. */
44 private boolean gpsL2PDataFlag;
45
46 /** GPS fit interval. */
47 private int gpsFitInterval;
48
49 /** Constructor. */
50 public Rtcm1019Data() {
51 // Nothing to do ...
52 }
53
54 /**
55 * Get the GPS navigation message corresponding to the current RTCM data.
56 * <p>
57 * This object can be used to initialize a {@link GNSSPropagator}
58 * <p>
59 * This method uses the {@link DataContext#getDefault()} to initialize
60 * the time scales used to configure the reference epochs of the navigation
61 * message.
62 *
63 * @return the GPS navigation message
64 */
65 @DefaultDataContext
66 public GPSLegacyNavigationMessage getGpsNavigationMessage() {
67 return getGpsNavigationMessage(DataContext.getDefault().getTimeScales());
68 }
69
70 /**
71 * Get the GPS navigation message corresponding to the current RTCM data.
72 * <p>
73 * This object can be used to initialize a {@link GNSSPropagator}
74 * <p>
75 * When calling this method, the reference epochs of the navigation message
76 * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
77 *
78 * @param timeScales time scales to use for initializing epochs
79 * @return the GPS navigation message
80 */
81 public GPSLegacyNavigationMessage getGpsNavigationMessage(final TimeScales timeScales) {
82
83 // Satellite system
84 final SatelliteSystem system = SatelliteSystem.GPS;
85
86 // Week number and time of ephemeris
87 final int week = gpsNavigationMessage.getWeek();
88 final double toe = gpsNavigationMessage.getTime();
89
90 // Set the ephemeris reference data
91 gpsNavigationMessage.setDate(new GNSSDate(week, toe, system, timeScales).getDate());
92 gpsNavigationMessage.setEpochToc(new GNSSDate(week, gpsToc, system, timeScales).getDate());
93
94 // Return the navigation message
95 return gpsNavigationMessage;
96
97 }
98
99 /**
100 * Set the GPS navigation message.
101 * @param gpsNavigationMessage the GPS navigation message to set
102 */
103 public void setGpsNavigationMessage(final GPSLegacyNavigationMessage gpsNavigationMessage) {
104 this.gpsNavigationMessage = gpsNavigationMessage;
105 }
106
107 /**
108 * Get the GPS time of clock.
109 * <p>
110 * The GPS time of clock is given in seconds since
111 * the beginning of the GPS week.
112 * </p>
113 * @return the GPS time of clock
114 */
115 public double getGpsToc() {
116 return gpsToc;
117 }
118
119 /**
120 * Set the GPS time of clock.
121 * @param toc the time of clock to set
122 */
123 public void setGpsToc(final double toc) {
124 this.gpsToc = toc;
125 }
126
127 /**
128 * Get the GPS code on L2.
129 * <ul>
130 * <li>0: Reserved</li>
131 * <li>1: P code on</li>
132 * <li>2: C/A code on</li>
133 * <li>3: L2C on</li>
134 * </ul>
135 * @return the GPS code on L2
136 */
137 public int getGpsCodeOnL2() {
138 return gpsCodeOnL2;
139 }
140
141 /**
142 * Set the GPS code on L2.
143 * @param gpsCodeOnL2 the code to set
144 */
145 public void setGpsCodeOnL2(final int gpsCodeOnL2) {
146 this.gpsCodeOnL2 = gpsCodeOnL2;
147 }
148
149 /**
150 * Get the GPS L2 P-Code data flag.
151 * @return true L2 P-Code NAV data ON
152 */
153 public boolean getGpsL2PDataFlag() {
154 return gpsL2PDataFlag;
155 }
156
157 /**
158 * Set the GPS L2 P-code data flag.
159 * @param gpsL2PDataFlag the flag to set
160 */
161 public void setGpsL2PDataFlag(final boolean gpsL2PDataFlag) {
162 this.gpsL2PDataFlag = gpsL2PDataFlag;
163 }
164
165 /**
166 * Get the GPS fit interval.
167 * @return the GPS fit interval
168 */
169 public int getGpsFitInterval() {
170 return gpsFitInterval;
171 }
172
173 /**
174 * Set the GPS fit interval.
175 * @param gpsFitInterval the GPS fit interval to set
176 */
177 public void setGpsFitInterval(final int gpsFitInterval) {
178 this.gpsFitInterval = gpsFitInterval;
179 }
180
181 }