Rtcm1045Data.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.GalileoNavigationMessage;
  23. import org.orekit.time.GNSSDate;
  24. import org.orekit.time.TimeScales;

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

  31.     /** Galileo navigation message. */
  32.     private GalileoNavigationMessage galileoNavigationMessage;

  33.     /** Galileo Time of clock. */
  34.     private double galileoToc;

  35.     /** Galileo NAV Data Validity Status. */
  36.     private int galileoDataValidityStatus;

  37.     /** Constructor. */
  38.     public Rtcm1045Data() {
  39.         // Nothing to do ...
  40.     }

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

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

  68.         // Satellite system
  69.         final SatelliteSystem system = SatelliteSystem.GALILEO;

  70.         // Week number and time of ephemeris
  71.         final int    week = galileoNavigationMessage.getWeek();

  72.         // Set the ephemeris reference data
  73.         galileoNavigationMessage.setEpochToc(new GNSSDate(week, galileoToc, system, timeScales).getDate());

  74.         // Return the navigation message
  75.         return galileoNavigationMessage;

  76.     }

  77.     /**
  78.      * Set the Galileo navigation message.
  79.      * @param galileoNavigationMessage the Galileo navigation message to set
  80.      */
  81.     public void setGalileoNavigationMessage(final GalileoNavigationMessage galileoNavigationMessage) {
  82.         this.galileoNavigationMessage = galileoNavigationMessage;
  83.     }

  84.     /**
  85.      * Get the Galileo time of clock.
  86.      * <p>
  87.      * The Galileo time of clock is given in seconds since
  88.      * the beginning of the Galileo week.
  89.      * </p>
  90.      * @return the Galileo time of clock
  91.      */
  92.     public double getGalileoToc() {
  93.         return galileoToc;
  94.     }

  95.     /**
  96.      * Set the Galileo time of clock.
  97.      * @param toc the time of clock to set
  98.      */
  99.     public void setGalileoToc(final double toc) {
  100.         this.galileoToc = toc;
  101.     }

  102.     /**
  103.      * Get the Galileo data validity status.
  104.      * @return the Galileo data validity status
  105.      */
  106.     public int getGalileoDataValidityStatus() {
  107.         return galileoDataValidityStatus;
  108.     }

  109.     /**
  110.      * Set the Galileo data validity status.
  111.      * @param galileoDataValidityStatus the validity status to set
  112.      */
  113.     public void setGalileoDataValidityStatus(final int galileoDataValidityStatus) {
  114.         this.galileoDataValidityStatus = galileoDataValidityStatus;
  115.     }

  116. }