Changeset 745 in ntrip for trunk/BNC


Ignore:
Timestamp:
Mar 26, 2008, 11:33:11 AM (17 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

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

    r689 r745  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.8 2007/10/28 08:50:37 mervart Exp $
    4   Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@alberding.eu>
     3  $Id: rtcm3torinex.c,v 1.27 2008/03/25 15:10:48 stoecker Exp $
     4  Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu>
    55
    66  This software is a complete NTRIP-RTCM3 to RINEX converter as well as
     
    5151
    5252/* CVS revision and version */
    53 static char revisionstr[] = "$Revision: 1.8 $";
     53static char revisionstr[] = "$Revision: 1.27 $";
    5454
    5555#ifndef COMPILEDATE
     
    110110  if(e-m < 3)
    111111    handle->NeedBytes = 3;
    112  
     112
    113113  /* copy buffer to front */
    114114  i = m - handle->Message;
     
    182182  int year;
    183183  int taicount;
    184 }; 
     184};
    185185static const int months[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
    186186static const struct leapseconds leap[] = {
     
    459459          }
    460460          GETBITS(l1range, 24);
    461           if((l1range&((1<<24)-1)) != 0x80000)
    462           {
    463             gnss->dataflags[num] |= c;
    464             gnss->measdata[num][ce] = l1range*0.02;
    465           }
    466461          GETBITSSIGN(i, 20);
    467462          if((i&((1<<20)-1)) != 0x80000)
    468463          {
    469             gnss->dataflags[num] |= l;
     464            gnss->dataflags[num] |= (c|l);
     465            gnss->measdata[num][ce] = l1range*0.02;
    470466            gnss->measdata[num][le] = l1range*0.02+i*0.0005;
    471467          }
     
    622618          }
    623619          GETBITS(l1range, 25)
    624           if((l1range&((1<<25)-1)) != 0x80000)
    625           {
    626             gnss->dataflags[num] |= c;
    627             gnss->measdata[num][ce] = l1range*0.02;
    628           }
    629620          GETBITSSIGN(i, 20)
    630621          if((i&((1<<20)-1)) != 0x80000)
    631622          {
    632             gnss->dataflags[num] |= l;
     623            /* Handle this like GPS. Actually for GLONASS L1 range is always
     624               valid. To be on the save side, we handle it as invalid like we
     625               do for GPS and also remove range in case of 0x80000. */
     626            gnss->dataflags[num] |= (c|l);
     627            gnss->measdata[num][ce] = l1range*0.02;
    633628            gnss->measdata[num][le] = l1range*0.02+i*0.0005;
    634629          }
     
    814809}
    815810
    816 int HandleRunBy(char *buffer, int buffersize, const char **u,
     811static int HandleRunBy(char *buffer, int buffersize, const char **u,
    817812int rinex3)
    818813{
     
    846841}
    847842
    848 // Inserted parts for BNC Perlt
    849 #ifdef NO_RTCM3_MAIN
    850 #define NUMSTARTSKIP 1
    851 #else
    852843#define NUMSTARTSKIP 3
    853 #endif
    854 
    855844void HandleHeader(struct RTCM3ParserData *Parser)
    856845{
    857 #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
    859   int i;
    860   if(Parser->rinex3)
    861   {
    862 #define CHECKFLAGSNEW(a, b, c) \
    863     { \
    864       Parser->dataflag##a[Parser->numdatatypes##a] = GNSSDF_##b##DATA; \
    865       Parser->datapos##a[Parser->numdatatypes##a] = GNSSENTRY_##b##DATA; \
    866       ++Parser->numdatatypes##a; \
    867     }
    868 
    869     CHECKFLAGSNEW(GPS, C1,  C1C)
    870     CHECKFLAGSNEW(GPS, L1C, L1C)
    871     CHECKFLAGSNEW(GPS, D1C, D1C)
    872     CHECKFLAGSNEW(GPS, S1C, S1C)
    873     CHECKFLAGSNEW(GPS, P1,  C1P)
    874     CHECKFLAGSNEW(GPS, L1P, L1P)
    875     CHECKFLAGSNEW(GPS, D1P, D1P)
    876     CHECKFLAGSNEW(GPS, S1P, S1P)
    877     CHECKFLAGSNEW(GPS, P2,  C2P)
    878     CHECKFLAGSNEW(GPS, L2P, L2P)
    879     CHECKFLAGSNEW(GPS, D2P, D2P)
    880     CHECKFLAGSNEW(GPS, S2P, S2P)
    881     CHECKFLAGSNEW(GPS, C2,  C2X)
    882     CHECKFLAGSNEW(GPS, L2C, L2X)
    883     CHECKFLAGSNEW(GPS, D2C, D2X)
    884     CHECKFLAGSNEW(GPS, S2C, S2X)
    885     CHECKFLAGSNEW(GLO, C1,  C1C)
    886     CHECKFLAGSNEW(GLO, L1C, L1C)
    887     CHECKFLAGSNEW(GLO, D1C, D1C)
    888     CHECKFLAGSNEW(GLO, S1C, S1C)
    889     CHECKFLAGSNEW(GLO, P1,  C1P)
    890     CHECKFLAGSNEW(GLO, L1P, L1P)
    891     CHECKFLAGSNEW(GLO, D1P, D1P)
    892     CHECKFLAGSNEW(GLO, S1P, S1P)
    893     CHECKFLAGSNEW(GLO, P2,  C2P)
    894     CHECKFLAGSNEW(GLO, L2P, L2P)
    895     CHECKFLAGSNEW(GLO, D2P, D2P)
    896     CHECKFLAGSNEW(GLO, S2P, S2P)
    897     CHECKFLAGSNEW(GLO, C2,  C2C)
    898     CHECKFLAGSNEW(GLO, L2C, L2C)
    899     CHECKFLAGSNEW(GLO, D2C, D2C)
    900     CHECKFLAGSNEW(GLO, S2C, S2C)
    901 
    902   }
    903   else
    904   {
    905 #define CHECKFLAGS(a, b) \
    906     { \
    907       if(data[RINEXENTRY_##b##DATA]) \
    908       { \
    909         Parser->dataflagGPS[data[RINEXENTRY_##b##DATA]-1] = GNSSDF_##a##DATA; \
    910         Parser->dataposGPS[data[RINEXENTRY_##b##DATA]-1] = GNSSENTRY_##a##DATA; \
    911       } \
    912       else \
    913       { \
    914         Parser->dataflag[Parser->numdatatypesGPS] = GNSSDF_##a##DATA; \
    915         Parser->datapos[Parser->numdatatypesGPS] = GNSSENTRY_##a##DATA; \
    916         data[RINEXENTRY_##b##DATA] = ++Parser->numdatatypesGPS; \
    917       } \
    918     }
    919 
    920     int data[RINEXENTRY_NUMBER];
    921     for(i = 0; i < RINEXENTRY_NUMBER; ++i) data[i] = 0;
    922 
    923     CHECKFLAGS(C1,C1)
    924     CHECKFLAGS(C2,C2)
    925     CHECKFLAGS(P1,P1)
    926     CHECKFLAGS(P2,P2)
    927     CHECKFLAGS(L1C,L1)
    928     CHECKFLAGS(L1P,L1)
    929     CHECKFLAGS(L2C,L2)
    930     CHECKFLAGS(L2P,L2)
    931     CHECKFLAGS(D1C,D1)
    932     CHECKFLAGS(D1P,D1)
    933     CHECKFLAGS(D2C,D2)
    934     CHECKFLAGS(D2P,D2)
    935     CHECKFLAGS(S1C,S1)
    936     CHECKFLAGS(S1P,S1)
    937     CHECKFLAGS(S2C,S2)
    938     CHECKFLAGS(S2P,S2)
    939   }
    940 // End Part of Handle Header for BNC Perlt
    941 #endif
    942 
    943 #ifndef NO_RTCM3_MAIN
    944846  struct HeaderData hdata;
    945847  char thebuffer[MAXHEADERBUFFERSIZE];
     
    991893  "         .0000         .0000         .0000                  "
    992894  "ANTENNA: DELTA H/E/N";
    993  
     895
    994896  hdata.data.named.wavelength = Parser->rinex3 ? 0 :
    995897  "     1     1                                                "
     
    12321134  }
    12331135
     1136#ifndef NO_RTCM3_MAIN
    12341137  for(i = 0; i < hdata.numheaders; ++i)
    12351138  {
     
    16281531
    16291532#ifndef NO_RTCM3_MAIN
    1630 static char datestr[]     = "$Date: 2007/10/28 08:50:37 $";
     1533static char datestr[]     = "$Date: 2008/03/25 15:10:48 $";
    16311534
    16321535/* The string, which is send as agent in HTTP request */
     
    21892092      {
    21902093        if(numbytes >= 17 && !strncmp(buf, "RTSP/1.0 200 OK\r\n", 17))
    2191         {
     2094        {
    21922095          int serverport = 0, session = 0;
    21932096          const char *portcheck = "server_port=";
     
    23572260        "Host: %s\r\n%s"
    23582261        "User-Agent: %s/%s\r\n"
     2262        "Connection: close\r\n"
    23592263        "\r\n"
    23602264        , proxyserver ? "http://" : "", proxyserver ? proxyserver : "",
     
    23692273        "Host: %s\r\n%s"
    23702274        "User-Agent: %s/%s\r\n"
     2275        "Connection: close\r\n"
    23712276        "Authorization: Basic "
    23722277        , proxyserver ? "http://" : "", proxyserver ? proxyserver : "",
     
    24232328            if(numbytes > 17 && (!strncmp(buf, "HTTP/1.1 200 OK\r\n", 17)
    24242329            || !strncmp(buf, "HTTP/1.0 200 OK\r\n", 17)))
    2425             {
     2330            {
    24262331              const char *datacheck = "Content-Type: gnss/data\r\n";
    24272332              const char *chunkycheck = "Transfer-Encoding: chunked\r\n";
     
    24892394                  else if(i >= 'A' && i <= 'F') chunksize = chunksize*16+i-'A'+10;
    24902395                  else if(i == '\r') ++chunkymode;
     2396                  else if(i == ';') chunkymode = 5;
    24912397                  else stop = 1;
    24922398                  break;
     
    25092415                    chunkymode = 1;
    25102416                  break;
     2417                case 5:
     2418                  if(i == '\r') chunkymode = 3;
     2419                  break;
    25112420                }
    25122421              }
Note: See TracChangeset for help on using the changeset viewer.