1   /* Copyright 2002-2026 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.files.rinex.navigation.parsers.ephemeris;
18  
19  import org.orekit.files.rinex.navigation.RinexNavigation;
20  import org.orekit.files.rinex.navigation.parsers.ParseInfo;
21  import org.orekit.propagation.analytical.gnss.data.GalileoNavigationMessage;
22  import org.orekit.propagation.analytical.gnss.data.GalileoNavigationMessageFactory;
23  import org.orekit.time.GNSSDate;
24  import org.orekit.utils.units.Unit;
25  
26  /** Parser for Galileo.
27   * @author Bryan Cazabonne
28   * @author Luc Maisonobe
29   * @since 14.0
30   */
31  public class GalileoParser
32          extends AbstractNavigationParser<GalileoNavigationMessage, GalileoNavigationMessageFactory> {
33  
34      /** Simple constructor.
35       * @param parseInfo container for parsing data
36       * @param factory factory for navigation message
37       */
38      public GalileoParser(final ParseInfo parseInfo, final GalileoNavigationMessageFactory factory) {
39          super(parseInfo, factory);
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public void parseLine00() {
45          final ParseInfo parseInfo = getParseInfo();
46          final GalileoNavigationMessageFactory factory = getFactory();
47          parseSvEpochSvClockLine(parseInfo.getTimeScales().getGPS(), parseInfo, factory);
48      }
49  
50      /** {@inheritDoc} */
51      @Override
52      public void parseLine01() {
53          super.parseLine01();
54          final GalileoNavigationMessageFactory factory = getFactory();
55          factory.setIodNav(getParseInfo().parseInt1());
56      }
57  
58      /** {@inheritDoc} */
59      @Override
60      public void parseLine05() {
61          super.parseLine05();
62          final GalileoNavigationMessageFactory factory = getFactory();
63          factory.setDataSource(getParseInfo().parseInt2());
64      }
65  
66      /** {@inheritDoc} */
67      @Override
68      public void parseLine06() {
69          final ParseInfo parseInfo = getParseInfo();
70          final GalileoNavigationMessageFactory factory = getFactory();
71          factory.setSisa(parseInfo.parseDouble1(Unit.METRE));
72          factory.setSvHealth(parseInfo.parseDouble2(Unit.NONE));
73          factory.setBGDE1E5a(parseInfo.parseDouble3(Unit.SECOND));
74          factory.setBGDE5bE1(parseInfo.parseDouble4(Unit.SECOND));
75      }
76  
77      /** {@inheritDoc} */
78      @Override
79      public void parseLine07() {
80          final ParseInfo parseInfo = getParseInfo();
81          final GalileoNavigationMessageFactory factory = getFactory();
82          factory.setTransmissionTime(new GNSSDate(factory.getTimeOfEphemeris().getWeekNumber(),
83                                                   parseInfo.parseDouble1(Unit.SECOND),
84                                                   factory.getSystem()));
85          parseInfo.closePendingRecord();
86      }
87  
88      /** {@inheritDoc} */
89      @Override
90      public void closeRecord(final RinexNavigation file) {
91          file.addGalileoNavigationMessage(getMessage());
92      }
93  
94  }