Index: trunk/rtcm3torinex/rtcm3torinex.h
===================================================================
--- trunk/rtcm3torinex/rtcm3torinex.h	(revision 365)
+++ trunk/rtcm3torinex/rtcm3torinex.h	(revision 502)
@@ -4,6 +4,6 @@
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.h,v 1.5 2007/01/11 14:10:13 stoecker Exp $
-  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
+  $Id: rtcm3torinex.h,v 1.6 2007/01/15 13:01:40 stoecker Exp $
+  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@alberding.eu>
 
   This program is free software; you can redistribute it and/or modify
@@ -110,4 +110,74 @@
 };
 
+#define GPSEPHF_L2PCODEDATA    (1<<0) /* set, if NAV data OFF on L2 P-code, s1w4b01 */
+#define GPSEPHF_L2PCODE        (1<<1) /* set, if P-code available, s1w3b12 */
+#define GPSEPHF_L2CACODE       (1<<2) /* set, if CA-code available, s1w3b11 */
+#define GPSEPHF_VALIDATED      (1<<3) /* data is completely valid */
+
+#define PI          3.1415926535898
+
+struct gpsephemeris {
+  int    flags;            /* GPSEPHF_xxx */
+  int    satellite;        /*  SV ID   ICD-GPS data position */
+  int    IODE;             /*          [s2w3b01-08]              */
+  int    URAindex;         /*  [1..15] [s1w3b13-16]              */
+  int    SVhealth;         /*          [s1w3b17-22]              */
+  int    GPSweek;          /*          [s1w3b01-10]              */
+  int    IODC;             /*          [s1w3b23-32,w8b01-08]     */
+  int    TOW;              /*  [s]     [s1w2b01-17]              */
+  int    TOC;              /*  [s]     [s1w8b09-24]              */
+  int    TOE;              /*  [s]     [s2w10b1-16]              */
+  double clock_bias;       /*  [s]     [s1w10b1-22, af0]         */
+  double clock_drift;      /*  [s/s]   [s1w9b09-24, af1]         */
+  double clock_driftrate;  /*  [s/s^2] [s1w9b01-08, af2]         */
+  double Crs;              /*  [m]     [s2w3b09-24]              */
+  double Delta_n;          /*  [rad/s] [s2w4b01-16 * Pi]         */
+  double M0;               /*  [rad]   [s2w4b17-24,w5b01-24 * Pi]*/
+  double Cuc;              /*  [rad]   [s2w6b01-16]              */
+  double e;                /*          [s2w6b17-24,w6b01-24]     */
+  double Cus;              /*  [rad]   [s2w8b01-16]              */
+  double sqrt_A;           /*  [m^0.5] [s2w8b16-24,w9b01-24]     */
+  double Cic;              /*  [rad]   [s3w3b01-16]              */
+  double OMEGA0;           /*  [rad]   [s3w3b17-24,w4b01-24 * Pi]*/
+  double Cis;              /*  [rad]   [s3w5b01-16]              */
+  double i0;               /*  [rad]   [s3w5b17-24,w6b01-24 * Pi]*/
+  double Crc;              /*  [m]     [s3w701-16]               */
+  double omega;            /*  [rad]   [s3w7b17-24,w8b01-24 * Pi]*/
+  double OMEGADOT;         /*  [rad/s] [s3w9b01-24 * Pi]         */
+  double IDOT;             /*  [rad/s] [s3w10b9-22 * Pi]         */
+  double TGD;              /*  [s]     [s1w7b17-24]              */
+};
+
+#define GLOEPHF_UNHEALTHY       (1<<0) /* set if unhealty satellite, f2b78 */
+#define GLOEPHF_ALMANACHEALTHOK (1<<1) /* set if ALM health is available */
+#define GLOEPHF_ALMANACHEALTHY  (1<<2) /* set if Cn word is true */
+#define GLOEPHF_PAVAILABLE      (1<<3) /* set if the 3 P flags are available */
+#define GLOEPHF_P10TRUE         (1<<4)
+#define GLOEPHF_P11TRUE         (1<<5)
+#define GLOEPHF_P2TRUE          (1<<6)
+#define GLOEPHF_P3TRUE          (1<<7)
+
+struct glonassephemeris {
+  int    GPSWeek;
+  int    GPSTOW;
+  int    flags;              /* GLOEPHF_xxx */
+  int    almanac_number;
+  int    frequency_number;   /* ICD-GLONASS data position */
+  int    tb;                 /* [s]     [f2b70-76] */
+  int    tk;                 /* [s]     [f1b65-76] */
+  int    E;                  /* [days]  [f4b49-53] */
+  double tau;                /* [s]     [f4b59-80] */
+  double gamma;              /*         [f3b69-79] */
+  double x_pos;              /* [km]    [f1b09-35] */
+  double x_velocity;         /* [km/s]  [f1b41-64] */
+  double x_acceleration;     /* [km/s^2][f1b36-40] */
+  double y_pos;              /* [km]    [f2b09-35] */
+  double y_velocity;         /* [km/s]  [f2b41-64] */
+  double y_acceleration;     /* [km/s^2][f2b36-40] */
+  double z_pos;              /* [km]    [f3b09-35] */
+  double z_velocity;         /* [km/s]  [f3b41-64] */
+  double z_acceleration;     /* [km/s^2][f3b36-40] */
+};
+
 struct RTCM3ParserData {
   unsigned char Message[2048]; /* input-buffer */
@@ -118,4 +188,6 @@
   int    GPSTOW;        /* in seconds */
   struct gnssdata Data;
+  struct gpsephemeris ephemerisGPS;
+  struct glonassephemeris ephemerisGLONASS;
   struct gnssdata DataNew;
   int    size;
@@ -124,11 +196,20 @@
   int    datapos[RINEXENTRY_NUMBER];
   int    dataflag[RINEXENTRY_NUMBER];
-  int    datapos2[RINEXENTRY_NUMBER];
-  int    dataflag2[RINEXENTRY_NUMBER];
-  int    numdatatypes;
+  /* for RINEX2 GPS and GLO are both handled in GPS */
+  int    dataposGPS[RINEXENTRY_NUMBER]; /* SBAS has same entries */
+  int    dataflagGPS[RINEXENTRY_NUMBER];
+  int    dataposGLO[RINEXENTRY_NUMBER]; /* only used for RINEX3 */
+  int    dataflagGLO[RINEXENTRY_NUMBER];
+  int    numdatatypesGPS;
+  int    numdatatypesGLO; /* only used for RINEX3 */
   int    validwarning;
   int    init;
   int    startflags;
+  int    rinex3;
   const char * headerfile;
+  const char * glonassephemeris;
+  const char * gpsephemeris;
+  FILE *glonassfile;
+  FILE *gpsfile;
 };
 
