Rtcm1019Data.java

  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. import org.orekit.annotation.DefaultDataContext;
  19. import org.orekit.data.DataContext;
  20. import org.orekit.gnss.SatelliteSystem;
  21. import org.orekit.propagation.analytical.gnss.GNSSPropagator;
  22. import org.orekit.propagation.analytical.gnss.data.GPSLegacyNavigationMessage;
  23. import org.orekit.time.GNSSDate;
  24. import org.orekit.time.TimeScales;

  25. /**
  26.  * Container for RTCM 1019 data.
  27.  * @author Bryan Cazabonne
  28.  * @since 11.0
  29.  */
  30. public class Rtcm1019Data extends RtcmEphemerisData {

  31.     /** GPS navigation message. */
  32.     private GPSLegacyNavigationMessage gpsNavigationMessage;

  33.     /** GPS Time of clock. */
  34.     private double gpsToc;

  35.     /** GPS code on L2. */
  36.     private int gpsCodeOnL2;

  37.     /** GPS L2 P data flag. */
  38.     private boolean gpsL2PDataFlag;

  39.     /** GPS fit interval. */
  40.     private int gpsFitInterval;

  41.     /** Constructor. */
  42.     public Rtcm1019Data() {
  43.         // Nothing to do ...
  44.     }

  45.     /**
  46.      * Get the GPS navigation message corresponding to the current RTCM data.
  47.      * <p>
  48.      * This object can be used to initialize a {@link GNSSPropagator}
  49.      * <p>
  50.      * This method uses the {@link DataContext#getDefault()} to initialize
  51.      * the time scales used to configure the reference epochs of the navigation
  52.      * message.
  53.      *
  54.      * @return the GPS navigation message
  55.      */
  56.     @DefaultDataContext
  57.     public GPSLegacyNavigationMessage getGpsNavigationMessage() {
  58.         return getGpsNavigationMessage(DataContext.getDefault().getTimeScales());
  59.     }

  60.     /**
  61.      * Get the GPS navigation message corresponding to the current RTCM data.
  62.      * <p>
  63.      * This object can be used to initialize a {@link GNSSPropagator}
  64.      * <p>
  65.      * When calling this method, the reference epochs of the navigation message
  66.      * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
  67.      *
  68.      * @param timeScales time scales to use for initializing epochs
  69.      * @return the GPS navigation message
  70.      */
  71.     public GPSLegacyNavigationMessage getGpsNavigationMessage(final TimeScales timeScales) {

  72.         // Satellite system
  73.         final SatelliteSystem system = SatelliteSystem.GPS;

  74.         // Week number and time of ephemeris
  75.         final int    week = gpsNavigationMessage.getWeek();

  76.         // Set the ephemeris reference data
  77.         gpsNavigationMessage.setEpochToc(new GNSSDate(week, gpsToc, system, timeScales).getDate());

  78.         // Return the navigation message
  79.         return gpsNavigationMessage;

  80.     }

  81.     /**
  82.      * Set the GPS navigation message.
  83.      * @param gpsNavigationMessage the GPS navigation message to set
  84.      */
  85.     public void setGpsNavigationMessage(final GPSLegacyNavigationMessage gpsNavigationMessage) {
  86.         this.gpsNavigationMessage = gpsNavigationMessage;
  87.     }

  88.     /**
  89.      * Get the GPS time of clock.
  90.      * <p>
  91.      * The GPS time of clock is given in seconds since
  92.      * the beginning of the GPS week.
  93.      * </p>
  94.      * @return the GPS time of clock
  95.      */
  96.     public double getGpsToc() {
  97.         return gpsToc;
  98.     }

  99.     /**
  100.      * Set the GPS time of clock.
  101.      * @param toc the time of clock to set
  102.      */
  103.     public void setGpsToc(final double toc) {
  104.         this.gpsToc = toc;
  105.     }

  106.     /**
  107.      * Get the GPS code on L2.
  108.      * <ul>
  109.      *   <li>0: Reserved</li>
  110.      *   <li>1: P code on</li>
  111.      *   <li>2: C/A code on</li>
  112.      *   <li>3: L2C on</li>
  113.      * </ul>
  114.      * @return the GPS code on L2
  115.      */
  116.     public int getGpsCodeOnL2() {
  117.         return gpsCodeOnL2;
  118.     }

  119.     /**
  120.      * Set the GPS code on L2.
  121.      * @param gpsCodeOnL2 the code to set
  122.      */
  123.     public void setGpsCodeOnL2(final int gpsCodeOnL2) {
  124.         this.gpsCodeOnL2 = gpsCodeOnL2;
  125.     }

  126.     /**
  127.      * Get the GPS L2 P-Code data flag.
  128.      * @return true L2 P-Code NAV data ON
  129.      */
  130.     public boolean getGpsL2PDataFlag() {
  131.         return gpsL2PDataFlag;
  132.     }

  133.     /**
  134.      * Set the GPS L2 P-code data flag.
  135.      * @param gpsL2PDataFlag the flag to set
  136.      */
  137.     public void setGpsL2PDataFlag(final boolean gpsL2PDataFlag) {
  138.         this.gpsL2PDataFlag = gpsL2PDataFlag;
  139.     }

  140.     /**
  141.      * Get the GPS fit interval.
  142.      * @return the GPS fit interval
  143.      */
  144.     public int getGpsFitInterval() {
  145.         return gpsFitInterval;
  146.     }

  147.     /**
  148.      * Set the GPS fit interval.
  149.      * @param gpsFitInterval the GPS fit interval to set
  150.      */
  151.     public void setGpsFitInterval(final int gpsFitInterval) {
  152.         this.gpsFitInterval = gpsFitInterval;
  153.     }

  154. }