Changeset 6604 in ntrip for trunk/rtcm3torinex


Ignore:
Timestamp:
Feb 20, 2015, 12:28:49 PM (5 years ago)
Author:
stoecker
Message:

some cleanups, still untested

Location:
trunk/rtcm3torinex/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/rtcm3torinex/lib/rtcm3torinex.c

    r6599 r6604  
    26262626    while((r = RTCM3Parser(Parser)))
    26272627    {
     2628      double ver = Parser->rinex3 ? 3.02 : 2.11;
    26282629      if(r == 1020 || r == RTCM3ID_BDS || r == 1019 || r == 1044 || r == 1043)
    26292630      {
    26302631        FILE *file = 0;
    26312632
    2632         if(Parser->rinex3 && !(file = Parser->gpsfile))
    2633         {
    2634           const char *n = Parser->gpsephemeris ? Parser->gpsephemeris
    2635           : Parser->qzssephemeris ? Parser->qzssephemeris : Parser->glonassephemeris;
    2636           if(n)
    2637           {
    2638             if(!(Parser->gpsfile = fopen(n, "w")))
     2633        if(Parser->mixedephemeris)
     2634        {
     2635          if(Parser->mixedephemeris != (const char *)1)
     2636          {
     2637            if(!(Parser->mixedfile = fopen(Parser->mixedephemeris, "w")))
    26392638            {
    26402639              RTCM3Error("Could not open ephemeris output file.\n");
     
    26432642            {
    26442643              char buffer[100];
    2645               fprintf(Parser->gpsfile,
    2646               "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n", 3.0, "", "");
     2644              fprintf(Parser->mixedfile,
     2645              "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n", ver, "", "");
    26472646              HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    2648               fprintf(Parser->gpsfile, "%s\n%60sEND OF HEADER\n", buffer, "");
    2649             }
    2650             Parser->qzssephemeris = 0;
    2651             Parser->gpsephemeris = 0;
    2652             Parser->glonassephemeris = 0;
    2653             Parser->sbasephemeris = 0;
    2654             file = Parser->gpsfile;
    2655           }
     2647              fprintf(Parser->mixedfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     2648            }
     2649            Parser->mixedephemeris = (const char *)1;
     2650          }
     2651          file = Parser->mixedfile;
    26562652        }
    26572653        else
     
    26692665                char buffer[100];
    26702666                fprintf(Parser->glonassfile,
    2671                 "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n", 2.1, "", "");
     2667                "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n", ver, "", "");
    26722668                HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    26732669                fprintf(Parser->glonassfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     
    26892685                char buffer[100];
    26902686                fprintf(Parser->gpsfile,
    2691                 "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.1, "", "");
     2687                "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", ver, "", "");
    26922688                HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    26932689                fprintf(Parser->gpsfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     
    27092705                char buffer[100];
    27102706                fprintf(Parser->sbasfile,
    2711                 "%9.2f%11sN: SBAS NAV DATA%24sRINEX VERSION / TYPE\n", 2.1, "", "");
     2707                "%9.2f%11sN: SBAS NAV DATA%24sRINEX VERSION / TYPE\n", ver, "", "");
    27122708                HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    27132709                fprintf(Parser->sbasfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     
    27292725                char buffer[100];
    27302726                fprintf(Parser->qzssfile,
    2731                 "%9.2f%11sN: QZSS NAV DATA%24sRINEX VERSION / TYPE\n", 2.1, "", "");
     2727                "%9.2f%11sN: QZSS NAV DATA%24sRINEX VERSION / TYPE\n", ver, "", "");
    27322728                HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    27332729                fprintf(Parser->qzssfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     
    27492745                char buffer[100];
    27502746                fprintf(Parser->bdsfile,
    2751                 "%9.2f%11sN: BDS NAV DATA%25sRINEX VERSION / TYPE\n", 2.1, "", "");
     2747                "%9.2f%11sN: BDS NAV DATA%25sRINEX VERSION / TYPE\n", ver, "", "");
    27522748                HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3);
    27532749                fprintf(Parser->bdsfile, "%s\n%60sEND OF HEADER\n", buffer, "");
     
    28372833              sep = "    ";
    28382834            }
    2839             else
     2835            else /* actually this is never used, as BDS is undefined for 2.x */
    28402836            {
    28412837              ConvLine(file,
     
    35243520  const char *glonassephemeris;
    35253521  const char *bdsephemeris;
     3522  const char *mixedephemeris;
    35263523};
    35273524
     
    35443541{ "glonassephemeris", required_argument, 0, 'G'},
    35453542{ "sbasephemeris",    required_argument, 0, 'B'},
     3543{ "mixedephemeris",   required_argument, 0, 'P'},
    35463544{ "rinex3",           no_argument,       0, '3'},
    35473545{ "changeobs",        no_argument,       0, 'O'},
     
    35533551{0,0,0,0}};
    35543552#endif
    3555 #define ARGOPT "-d:s:p:r:t:f:u:E:C:G:B:Q:M:S:R:n:h3O"
     3553#define ARGOPT "-d:s:p:r:t:f:u:E:C:G:B:P:Q:M:S:R:n:h3O"
    35563554
    35573555enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END };
     
    36873685  args->glonassephemeris = 0;
    36883686  args->bdsephemeris = 0;
     3687  args->mixedephemeris = 0;
    36893688  args->rinex3 = 0;
    36903689  args->nmea = 0;
     
    37143713    case 'G': args->glonassephemeris = optarg; break;
    37153714    case 'Q': args->qzssephemeris = optarg; break;
     3715    case 'P': args->mixedephemeris = optarg; break;
    37163716    case 'r': args->port = optarg; break;
    37173717    case '3': args->rinex3 = 1; break;
     
    37693769  datestr[10] = 0;
    37703770
    3771   if(args->gpsephemeris && args->glonassephemeris && args->rinex3)
     3771  if(args->mixedephemeris && !args->rinex3)
    37723772  {
    3773     RTCM3Error("RINEX3 produces a combined ephemeris file, but 2 files were specified.\n"
     3773    RTCM3Error("RINEX2 cannot created combined ephemeris file.\n");
     3774    res = 0;
     3775  }
     3776  else if(args->mixedephemeris && (args->gpsephemeris || args->glonassephemeris
     3777  || args->bdsephemeris || args->qzssephemeris || args->sbasephemeris))
     3778  {
     3779    RTCM3Error("Combined ephemeris file specified with another one.\n"
    37743780    "Please specify only one navigation file.\n");
     3781    res = 0;
     3782  }
     3783  else if(args->bdsephemeris && !args->rinex3)
     3784  {
     3785    RTCM3Error("RINEX2 cannot produce BDS ephemeris.\n");
    37753786    res = 0;
    37763787  }
     
    37913802    " -Q " LONG_OPT("--qzssephemeris    ") "output file for QZSS ephemeris data\n"
    37923803    " -B " LONG_OPT("--sbasephemeris    ") "output file for SBAS ephemeris data\n"
     3804    " -P " LONG_OPT("--mixedephemeris   ") "output file for all ephemeris data\n"
    37933805    " -3 " LONG_OPT("--rinex3           ") "output RINEX type 3 data\n"
    37943806    " -S " LONG_OPT("--proxyhost        ") "proxy name or address\n"
     
    38983910    Parser.qzssephemeris = args.qzssephemeris;
    38993911    Parser.sbasephemeris = args.sbasephemeris;
     3912    Parser.mixedephemeris = args.mixedephemeris;
    39003913    Parser.rinex3 = args.rinex3;
    39013914    Parser.changeobs = args.changeobs;
  • trunk/rtcm3torinex/lib/rtcm3torinex.h

    r6599 r6604  
    552552  const char * sbasephemeris;
    553553  const char * bdsephemeris;
     554  const char * mixedephemeris;
    554555  FILE *       glonassfile;
    555556  FILE *       gpsfile;
     
    557558  FILE *       sbasfile;
    558559  FILE *       bdsfile;
     560  FILE *       mixedfile;
    559561};
    560562
Note: See TracChangeset for help on using the changeset viewer.