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.QZSSLegacyNavigationMessage;
24  import org.orekit.time.GNSSDate;
25  import org.orekit.time.TimeScales;
26  
27  /**
28   * Container for RTCM 1044 data.
29   * @author Bryan Cazabonne
30   * @since 11.0
31   */
32  public class Rtcm1044Data extends RtcmEphemerisData {
33  
34      /** QZSS navigation message. */
35      private QZSSLegacyNavigationMessage qzssNavigationMessage;
36  
37      /** QZSS Time of clock. */
38      private double qzssToc;
39  
40      /** QZSS code on L2 Channel. */
41      private int qzssCodeOnL2;
42  
43      /** QZSS fit interval. */
44      private int qzssFitInterval;
45  
46      /** Constructor. */
47      public Rtcm1044Data() {
48          // Nothing to do ...
49      }
50  
51      /**
52       * Get the QZSS navigation message corresponding to the current RTCM data.
53       * <p>
54       * This object can be used to initialize a {@link GNSSPropagator}
55       * <p>
56       * This method uses the {@link DataContext#getDefault()} to initialize
57       * the time scales used to configure the reference epochs of the navigation
58       * message.
59       *
60       * @return the QZSS navigation message
61       */
62      @DefaultDataContext
63      public QZSSLegacyNavigationMessage getQzssNavigationMessage() {
64          return getQzssNavigationMessage(DataContext.getDefault().getTimeScales());
65      }
66  
67      /**
68       * Get the QZSS navigation message corresponding to the current RTCM data.
69       * <p>
70       * This object can be used to initialize a {@link GNSSPropagator}
71       * <p>
72       * When calling this method, the reference epochs of the navigation message
73       * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
74       *
75       * @param timeScales time scales to use for initializing epochs
76       * @return the QZSS navigation message
77       */
78      public QZSSLegacyNavigationMessage getQzssNavigationMessage(final TimeScales timeScales) {
79  
80          // Satellite system
81          final SatelliteSystem system = SatelliteSystem.QZSS;
82  
83          // Week number and time of ephemeris
84          final int    week = qzssNavigationMessage.getWeek();
85  
86          // Set the ephemeris reference data
87          qzssNavigationMessage.setEpochToc(new GNSSDate(week, qzssToc, system, timeScales).getDate());
88  
89          // Return the navigation message
90          return qzssNavigationMessage;
91  
92      }
93  
94      /**
95       * Set the QZSS navigation message.
96       * @param qzssNavigationMessage the QZSS navigation message to set
97       */
98      public void setQzssNavigationMessage(final QZSSLegacyNavigationMessage qzssNavigationMessage) {
99          this.qzssNavigationMessage = qzssNavigationMessage;
100     }
101 
102     /**
103      * Get the QZSS time of clock.
104      * <p>
105      * The QZSS time of clock is given in seconds since
106      * the beginning of the QZSS week.
107      * </p>
108      * @return the QZSS time of clock
109      */
110     public double getQzssToc() {
111         return qzssToc;
112     }
113 
114     /**
115      * Set the QZSS time of clock.
116      * @param toc the time of clock to set
117      */
118     public void setQzssToc(final double toc) {
119         this.qzssToc = toc;
120     }
121 
122     /**
123      * Get the QZSS code on L2 Channel.
124      * @return the QZSS code on L2
125      */
126     public int getQzssCodeOnL2() {
127         return qzssCodeOnL2;
128     }
129 
130     /**
131      * Set the QZSS code on L2.
132      * @param qzssCodeOnL2 the code to set
133      */
134     public void setQzssCodeOnL2(final int qzssCodeOnL2) {
135         this.qzssCodeOnL2 = qzssCodeOnL2;
136     }
137 
138     /**
139      * Get the QZSS fit interval.
140      * @return the QZSS fit interval
141      */
142     public int getQzssFitInterval() {
143         return qzssFitInterval;
144     }
145 
146     /**
147      * Set the QZSS fit interval.
148      * @param qzssFitInterval the QZSS fit interval to set
149      */
150     public void setQzssFitInterval(final int qzssFitInterval) {
151         this.qzssFitInterval = qzssFitInterval;
152     }
153 
154 }