Changeset 1096 in ntrip


Ignore:
Timestamp:
Sep 2, 2008, 4:14:40 PM (16 years ago)
Author:
weber
Message:

* empty log message *

Location:
trunk/BNC/RTCM3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/rtcm3torinex.c

    r1037 r1096  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.14 2008/08/11 14:01:54 weber Exp $
     3  $Id: rtcm3torinex.c,v 1.32 2008/09/02 07:45:48 stoecker Exp $
    44  Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu>
    55
     
    5151
    5252/* CVS revision and version */
    53 static char revisionstr[] = "$Revision: 1.14 $";
     53static char revisionstr[] = "$Revision: 1.32 $";
    5454
    5555#ifndef COMPILEDATE
     
    283283
    284284    GETBITS(type,12)
     285#ifdef NO_RTCM3_MAIN
    285286    handle->typeList[handle->typeSize] = type;           /* RTCM message types */
    286287    if(handle->typeSize < 100) {handle->typeSize += 1;}  /* RTCM message types */
     288#endif /* NO_RTCM3_MAIN */
    287289    switch(type)
    288290    {
     
    305307        if(sv & 2)
    306308          ge->flags |= GPSEPHF_L2CACODE;
    307         GETFLOATSIGN(ge->IDOT, 14, PI/(double)(1<<30)/(double)(1<<13))
     309        GETFLOATSIGN(ge->IDOT, 14, R2R_PI/(double)(1<<30)/(double)(1<<13))
    308310        GETBITS(ge->IODE, 8)
    309311        GETBITS(ge->TOC, 16)
     
    314316        GETBITS(ge->IODC, 10)
    315317        GETFLOATSIGN(ge->Crs, 16, 1.0/(double)(1<<5))
    316         GETFLOATSIGN(ge->Delta_n, 16, PI/(double)(1<<30)/(double)(1<<13))
    317         GETFLOATSIGN(ge->M0, 32, PI/(double)(1<<30)/(double)(1<<1))
     318        GETFLOATSIGN(ge->Delta_n, 16, R2R_PI/(double)(1<<30)/(double)(1<<13))
     319        GETFLOATSIGN(ge->M0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1))
    318320        GETFLOATSIGN(ge->Cuc, 16, 1.0/(double)(1<<29))
    319321        GETFLOAT(ge->e, 32, 1.0/(double)(1<<30)/(double)(1<<3))
     
    324326
    325327        GETFLOATSIGN(ge->Cic, 16, 1.0/(double)(1<<29))
    326         GETFLOATSIGN(ge->OMEGA0, 32, PI/(double)(1<<30)/(double)(1<<1))
     328        GETFLOATSIGN(ge->OMEGA0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1))
    327329        GETFLOATSIGN(ge->Cis, 16, 1.0/(double)(1<<29))
    328         GETFLOATSIGN(ge->i0, 32, PI/(double)(1<<30)/(double)(1<<1))
     330        GETFLOATSIGN(ge->i0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1))
    329331        GETFLOATSIGN(ge->Crc, 16, 1.0/(double)(1<<5))
    330         GETFLOATSIGN(ge->omega, 32, PI/(double)(1<<30)/(double)(1<<1))
    331         GETFLOATSIGN(ge->OMEGADOT, 24, PI/(double)(1<<30)/(double)(1<<13))
     332        GETFLOATSIGN(ge->omega, 32, R2R_PI/(double)(1<<30)/(double)(1<<1))
     333        GETFLOATSIGN(ge->OMEGADOT, 24, R2R_PI/(double)(1<<30)/(double)(1<<13))
    332334        GETFLOATSIGN(ge->TGD, 8, 1.0/(double)(1<<30)/(double)(1<<1))
    333335        GETBITS(ge->SVhealth, 6)
     
    438440        GETBITS(syncf,1) /* sync */
    439441        GETBITS(i,5)
    440     //  gnss->numsats = i;
    441         gnss->numsats += i;                                    // If GLONASS observations come first, Weber
     442        gnss->numsats += i;
    442443        SKIPBITS(4) /* smind, smint */
    443444
    444     //  for(num = 0; num < gnss->numsats; ++num)
    445         for(num = gnss->numsats-i; num < gnss->numsats; ++num) // If GLONASS observations come first, Weber
     445        for(num = gnss->numsats-i; num < gnss->numsats; ++num)
    446446        {
    447447          int sv, code, l1range, c,l,s,ce,le,se,amb=0;
     
    838838  if(u) *u = user;
    839839  return 1+snprintf(buffer, buffersize,
    840   rinex3 ? 
     840  rinex3 ?
    841841  "RTCM3TORINEX %-7.7s%-20.20s%04d%02d%02d %02d%02d%02d UTC "
    842842  "PGM / RUN BY / DATE" :
     
    846846}
    847847
    848 // Inserted parts for BNC Perlt
    849848#ifdef NO_RTCM3_MAIN
    850849#define NUMSTARTSKIP 1
     
    856855{
    857856#ifdef NO_RTCM3_MAIN
    858 // Part of Handle Header for data request for BNC (independently on actually delivered data), original is commented out by ifndef NO_RTCM3_MAIN. Perlt
    859857  int i;
    860858  if(Parser->rinex3)
     
    899897    CHECKFLAGSNEW(GLO, D2C, D2C)
    900898    CHECKFLAGSNEW(GLO, S2C, S2C)
    901 
    902899  }
    903900  else
     
    938935    CHECKFLAGS(S2P,S2)
    939936  }
    940 // End Part of Handle Header for BNC Perlt
    941 #endif
    942 
    943 #ifndef NO_RTCM3_MAIN
     937#else /* NO_RTCM3_MAIN */
    944938  struct HeaderData hdata;
    945939  char thebuffer[MAXHEADERBUFFERSIZE];
     
    16281622
    16291623#ifndef NO_RTCM3_MAIN
    1630 static char datestr[]     = "$Date: 2008/08/11 14:01:54 $";
     1624static char datestr[]     = "$Date: 2008/09/02 07:45:48 $";
    16311625
    16321626/* The string, which is send as agent in HTTP request */
     
    19831977}
    19841978
     1979#ifndef WINDOWSVERSION
     1980static void WaitMicro(int mic)
     1981{
     1982  struct timeval tv;
     1983  tv.tv_sec = mic/1000000;
     1984  tv.tv_usec = mic%1000000;
     1985#ifdef DEBUG
     1986  fprintf(stderr, "Waiting %d micro seconds\n", mic);
     1987#endif
     1988  select(0, 0, 0, 0, &tv);
     1989}
     1990#else /* WINDOWSVERSION */
     1991void WaitMicro(int mic)
     1992{
     1993   Sleep(mic/1000);
     1994}
     1995#endif /* WINDOWSVERSION */
     1996
    19851997#define ALARMTIME   (2*60)
    19861998
     
    20292041  if(getargs(argc, argv, &args))
    20302042  {
    2031     int sockfd, numbytes; 
     2043    int sockfd, numbytes;
    20322044    char buf[MAXDATASIZE];
    20332045    struct sockaddr_in their_addr; /* connector's address information */
     
    21202132      /* fill structure with local address information for UDP */
    21212133      memset(&local, 0, sizeof(local));
    2122       local.sin_family = AF_INET;       
     2134      local.sin_family = AF_INET;
    21232135      local.sin_port = htons(0);
    2124       local.sin_addr.s_addr = htonl(INADDR_ANY); 
     2136      local.sin_addr.s_addr = htonl(INADDR_ANY);
    21252137      len = sizeof(local);
    2126       /* bind() in order to get a random RTP client_port */ 
     2138      /* bind() in order to get a random RTP client_port */
    21272139      if((bind(sockudp, (struct sockaddr *)&local, len)) < 0)
    21282140      {
     
    21302142        exit(1);
    21312143      }
    2132       if((getsockname(sockudp, (struct sockaddr*)&local, &len)) != -1) 
    2133       {
    2134         localport = ntohs(local.sin_port); 
     2144      if((getsockname(sockudp, (struct sockaddr*)&local, &len)) != -1)
     2145      {
     2146        localport = ntohs(local.sin_port);
    21352147      }
    21362148      else
    21372149      {
    2138         perror("local access failed"); 
     2150        perror("local access failed");
    21392151        exit(1);
    21402152      }
     
    21462158      }
    21472159      i=snprintf(buf, MAXDATASIZE-40, /* leave some space for login */
    2148       "SETUP rtsp://%s%s%s/%s RTSP/1.0\r\n"             
    2149       "CSeq: %d\r\n"           
     2160      "SETUP rtsp://%s%s%s/%s RTSP/1.0\r\n"
     2161      "CSeq: %d\r\n"
    21502162      "Ntrip-Version: Ntrip/2.0\r\n"
    21512163      "Ntrip-Component: Ntripclient\r\n"
     
    22412253
    22422254          i = snprintf(buf, MAXDATASIZE,
    2243           "PLAY rtsp://%s%s%s/%s RTSP/1.0\r\n"         
     2255          "PLAY rtsp://%s%s%s/%s RTSP/1.0\r\n"
    22442256          "CSeq: %d\r\n"
    22452257          "Session: %d\r\n"
    2246           "\r\n", 
     2258          "\r\n",
    22472259          args.server, proxyserver ? ":" : "", proxyserver ? args.port : "",
    22482260          args.data, cseq++, session);
     
    22652277              /* fill structure with caster address information for UDP */
    22662278              memset(&addrRTP, 0, sizeof(addrRTP));
    2267               addrRTP.sin_family = AF_INET; 
     2279              addrRTP.sin_family = AF_INET;
    22682280              addrRTP.sin_port   = htons(serverport);
    22692281              their_addr.sin_addr = *((struct in_addr *)he->h_addr);
     
    22882300                  if(init)
    22892301                  {
     2302                    int z;
    22902303                    if(u < -30000 && sn > 30000) sn -= 0xFFFF;
    22912304                    if(ssrc != w || ts > v)
     
    22952308                    }
    22962309                    if(u > sn) /* don't show out-of-order packets */
    2297                       fwrite(buf+12, (size_t)i-12, 1, stdout);
     2310                    for(z = 12; z < i && !stop; ++z)
     2311                      HandleByte(&Parser, (unsigned int) buf[z]);
    22982312                  }
    22992313                  sn = u; ts = v; ssrc = w; init = 1;
     
    23072321            }
    23082322            i = snprintf(buf, MAXDATASIZE,
    2309             "TEARDOWN rtsp://%s%s%s/%s RTSP/1.0\r\n"           
     2323            "TEARDOWN rtsp://%s%s%s/%s RTSP/1.0\r\n"
    23102324            "CSeq: %d\r\n"
    23112325            "Session: %d\r\n"
    2312             "\r\n", 
     2326            "\r\n",
    23132327            args.server, proxyserver ? ":" : "", proxyserver ? args.port : "",
    23142328            args.data, cseq++, session);
     
    24202434        while(!stop && (numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) != -1)
    24212435        {
    2422           alarm(ALARMTIME);
     2436          if(numbytes > 0)
     2437            alarm(ALARMTIME);
     2438          else
     2439          {
     2440            WaitMicro(100);
     2441            continue;
     2442          }
    24232443          if(!k)
    24242444          {
     
    24492469              if(i < numbytes-l)
    24502470                chunkymode = 1;
    2451             }
     2471            }
    24522472            else if(numbytes < 12 || strncmp("ICY 200 OK\r\n", buf, 12))
    24532473            {
  • trunk/BNC/RTCM3/rtcm3torinex.h

    r1030 r1096  
    44/*
    55  Converter for RTCM3 data to RINEX.
    6   $Id: rtcm3torinex.h,v 1.10 2008/01/29 14:53:15 mervart Exp $
    7   Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@alberding.eu>
     6  $Id: rtcm3torinex.h,v 1.8 2008/09/02 07:45:48 stoecker Exp $
     7  Copyright (C) 2005-2006 by Dirk Stöcker <stoecker@alberding.eu>
    88
    99  This program is free software; you can redistribute it and/or modify
     
    115115#define GPSEPHF_VALIDATED      (1<<3) /* data is completely valid */
    116116
    117 #ifndef PI
    118         #define PI          3.1415926535898
    119 #endif
     117#define R2R_PI          3.1415926535898
    120118
    121119struct gpsephemeris {
     
    196194  int    lastlockl1[64];
    197195  int    lastlockl2[64];
     196#ifdef NO_RTCM3_MAIN
    198197  int    typeSize;       /* RTCM message types */
    199198  int    typeList[101];  /* RTCM message types */
     199#endif /* NO_RTCM3_MAIN */
    200200  int    datapos[RINEXENTRY_NUMBER];
    201201  int    dataflag[RINEXENTRY_NUMBER];
Note: See TracChangeset for help on using the changeset viewer.