// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2018-2021 Carles Fernandez-Prades <carles.fernandez@cttc.es>
syntax = "proto3";

package gnss_sdr;

message GpsEphemeris {
  int32 PRN = 1;        // SV ID
  double M_0 = 2;       // Mean anomaly at reference time [rad]
  double delta_n = 3;   // Mean motion difference from computed value [rad/sec]
  double ecc = 4;       // Eccentricity
  double sqrtA = 5;     // Square root of the semi-major axis [meters^1/2]
  double OMEGA_0 = 6;   // Longitude of ascending node of orbital plane at weekly epoch [rad]
  double i_0 = 7;       // Inclination angle at reference time [rad]
  double omega = 8;     // Argument of perigee [rad]
  double OMEGAdot = 9;  // Rate of right ascension [rad/sec]
  double idot = 10;     // Rate of inclination angle [rad/sec]
  double Cuc = 11;      // Amplitude of the cosine harmonic correction term to the argument of latitude [rad]
  double Cus = 12;      // Amplitude of the sine harmonic correction term to the argument of latitude [rad]
  double Crc = 13;      // Amplitude of the cosine harmonic correction term to the orbit radius [meters]
  double Crs = 14;      // Amplitude of the sine harmonic correction term to the orbit radius [meters]
  double Cic = 15;      // Amplitude of the cosine harmonic correction term to the angle of inclination [rad]
  double Cis = 16;      // Amplitude of the sine harmonic correction term to the angle of inclination [rad]
  int32 toe = 17;       // Ephemeris reference time [s]

  // Clock correction parameters
  int32 toc = 18;    // Clock correction data reference Time of Week [sec]
  double af0 = 19;   // SV clock bias correction coefficient [s]
  double af1 = 20;   // SV clock drift correction coefficient [s/s]
  double af2 = 21;   // SV clock drift rate correction coefficient [s/s^2]

  double satClkDrift = 22;  // SV clock drift
  double dtr = 23;          // Relativistic clock correction term

  // Time
  int32 WN = 24;   // Week number
  int32 tow = 25;  // Time of Week

  // GPS-specific parameters
  int32 code_on_L2 = 26;     // If 1, P code ON in L2;  if 2, C/A code ON in L2;
  bool L2_P_data_flag = 27;  // When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel
  int32 SV_accuracy = 28;    // User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200M)
  int32 SV_health = 29;      // Satellite heath status
  double TGD = 30;           // Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
  int32 IODC = 31;           // Issue of Data, Clock
  int32 IODE_SF2 = 32;       // Issue of Data, Ephemeris (IODE), subframe 2
  int32 IODE_SF3 = 33;       // Issue of Data, Ephemeris (IODE), subframe 3
  int32 AODO = 34;           // Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]

  bool fit_interval_flag = 35;  // indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
  double spare1 = 36;
  double spare2 = 37;

  bool integrity_status_flag = 38;
  bool alert_flag = 39;         // If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
  bool antispoofing_flag = 40;  // If true, the AntiSpoofing mode is ON in that SV
}