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.RinexNavigationParser;
21  import org.orekit.files.rinex.navigation.parsers.ParseInfo;
22  import org.orekit.propagation.analytical.gnss.data.NavICL1NvNavigationMessage;
23  import org.orekit.propagation.analytical.gnss.data.NavICL1NvNavigationMessageFactory;
24  import org.orekit.time.GNSSDate;
25  import org.orekit.utils.units.Unit;
26  
27  /** Parser for NavIC L1NV.
28   * @author Bryan Cazabonne
29   * @author Luc Maisonobe
30   * @since 14.0
31   */
32  public class NavICL1NvParser
33      extends CivilianLevel1NavigationParser<NavICL1NvNavigationMessage, NavICL1NvNavigationMessageFactory> {
34  
35      /** Simple constructor.
36       * @param parseInfo container for parsing data
37       * @param factory factory for navigation message
38       */
39      public NavICL1NvParser(final ParseInfo parseInfo, final NavICL1NvNavigationMessageFactory factory) {
40          super(parseInfo, factory);
41      }
42  
43      /** {@inheritDoc} */
44      @Override
45      public void parseLine05() {
46          final ParseInfo parseInfo = getParseInfo();
47          final NavICL1NvNavigationMessageFactory factory = getFactory();
48          factory.getIDotDriver().setValue(parseInfo.parseDouble1(RinexNavigationParser.RAD_PER_S));
49          factory.getDeltaN0DotDriver().setValue(parseInfo.parseDouble2(RinexNavigationParser.RAD_PER_S2));
50          factory.setReferenceSignalFlag(parseInfo.parseInt4());
51      }
52  
53      /** {@inheritDoc} */
54      @Override
55      public void parseLine06() {
56          final ParseInfo parseInfo = getParseInfo();
57          final NavICL1NvNavigationMessageFactory factory = getFactory();
58          factory.setUrai(parseInfo.parseInt1());
59          factory.setL1SpsHealth(parseInfo.parseInt2());
60          factory.setTgd(parseInfo.parseDouble3(Unit.SECOND));
61          factory.setTgdSL5(parseInfo.parseDouble4(Unit.SECOND));
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      public void parseLine07() {
67          final ParseInfo parseInfo = getParseInfo();
68          final NavICL1NvNavigationMessageFactory factory = getFactory();
69          factory.setIscSL1P(parseInfo.parseDouble1(Unit.SECOND));
70          factory.setIscL1DL1P(parseInfo.parseDouble2(Unit.SECOND));
71          factory.setIscL1PS(parseInfo.parseDouble3(Unit.SECOND));
72          factory.setIscL1DS(parseInfo.parseDouble4(Unit.SECOND));
73      }
74  
75      /** {@inheritDoc} */
76      @Override
77      public void parseLine08() {
78          final ParseInfo parseInfo = getParseInfo();
79          final NavICL1NvNavigationMessageFactory factory = getFactory();
80          factory.setTransmissionTime(new GNSSDate(factory.getTimeOfEphemeris().getWeekNumber(),
81                                                   parseInfo.parseDouble1(Unit.SECOND),
82                                                   factory.getSystem()));
83          parseInfo.closePendingRecord();
84      }
85  
86      /** {@inheritDoc} */
87      @Override
88      public void closeRecord(final RinexNavigation file) {
89          file.addNavICL1NVNavigationMessage(getMessage());
90      }
91  
92  }