Changeset 1096 in ntrip
- Timestamp:
- Sep 2, 2008, 4:14:40 PM (16 years ago)
- Location:
- trunk/BNC/RTCM3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/rtcm3torinex.c
r1037 r1096 1 1 /* 2 2 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 $ 4 4 Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu> 5 5 … … 51 51 52 52 /* CVS revision and version */ 53 static char revisionstr[] = "$Revision: 1. 14$";53 static char revisionstr[] = "$Revision: 1.32 $"; 54 54 55 55 #ifndef COMPILEDATE … … 283 283 284 284 GETBITS(type,12) 285 #ifdef NO_RTCM3_MAIN 285 286 handle->typeList[handle->typeSize] = type; /* RTCM message types */ 286 287 if(handle->typeSize < 100) {handle->typeSize += 1;} /* RTCM message types */ 288 #endif /* NO_RTCM3_MAIN */ 287 289 switch(type) 288 290 { … … 305 307 if(sv & 2) 306 308 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)) 308 310 GETBITS(ge->IODE, 8) 309 311 GETBITS(ge->TOC, 16) … … 314 316 GETBITS(ge->IODC, 10) 315 317 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)) 318 320 GETFLOATSIGN(ge->Cuc, 16, 1.0/(double)(1<<29)) 319 321 GETFLOAT(ge->e, 32, 1.0/(double)(1<<30)/(double)(1<<3)) … … 324 326 325 327 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)) 327 329 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)) 329 331 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)) 332 334 GETFLOATSIGN(ge->TGD, 8, 1.0/(double)(1<<30)/(double)(1<<1)) 333 335 GETBITS(ge->SVhealth, 6) … … 438 440 GETBITS(syncf,1) /* sync */ 439 441 GETBITS(i,5) 440 // gnss->numsats = i; 441 gnss->numsats += i; // If GLONASS observations come first, Weber 442 gnss->numsats += i; 442 443 SKIPBITS(4) /* smind, smint */ 443 444 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) 446 446 { 447 447 int sv, code, l1range, c,l,s,ce,le,se,amb=0; … … 838 838 if(u) *u = user; 839 839 return 1+snprintf(buffer, buffersize, 840 rinex3 ? 840 rinex3 ? 841 841 "RTCM3TORINEX %-7.7s%-20.20s%04d%02d%02d %02d%02d%02d UTC " 842 842 "PGM / RUN BY / DATE" : … … 846 846 } 847 847 848 // Inserted parts for BNC Perlt849 848 #ifdef NO_RTCM3_MAIN 850 849 #define NUMSTARTSKIP 1 … … 856 855 { 857 856 #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. Perlt859 857 int i; 860 858 if(Parser->rinex3) … … 899 897 CHECKFLAGSNEW(GLO, D2C, D2C) 900 898 CHECKFLAGSNEW(GLO, S2C, S2C) 901 902 899 } 903 900 else … … 938 935 CHECKFLAGS(S2P,S2) 939 936 } 940 // End Part of Handle Header for BNC Perlt 941 #endif 942 943 #ifndef NO_RTCM3_MAIN 937 #else /* NO_RTCM3_MAIN */ 944 938 struct HeaderData hdata; 945 939 char thebuffer[MAXHEADERBUFFERSIZE]; … … 1628 1622 1629 1623 #ifndef NO_RTCM3_MAIN 1630 static char datestr[] = "$Date: 2008/0 8/11 14:01:54$";1624 static char datestr[] = "$Date: 2008/09/02 07:45:48 $"; 1631 1625 1632 1626 /* The string, which is send as agent in HTTP request */ … … 1983 1977 } 1984 1978 1979 #ifndef WINDOWSVERSION 1980 static 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 */ 1991 void WaitMicro(int mic) 1992 { 1993 Sleep(mic/1000); 1994 } 1995 #endif /* WINDOWSVERSION */ 1996 1985 1997 #define ALARMTIME (2*60) 1986 1998 … … 2029 2041 if(getargs(argc, argv, &args)) 2030 2042 { 2031 int sockfd, numbytes; 2043 int sockfd, numbytes; 2032 2044 char buf[MAXDATASIZE]; 2033 2045 struct sockaddr_in their_addr; /* connector's address information */ … … 2120 2132 /* fill structure with local address information for UDP */ 2121 2133 memset(&local, 0, sizeof(local)); 2122 local.sin_family = AF_INET; 2134 local.sin_family = AF_INET; 2123 2135 local.sin_port = htons(0); 2124 local.sin_addr.s_addr = htonl(INADDR_ANY); 2136 local.sin_addr.s_addr = htonl(INADDR_ANY); 2125 2137 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 */ 2127 2139 if((bind(sockudp, (struct sockaddr *)&local, len)) < 0) 2128 2140 { … … 2130 2142 exit(1); 2131 2143 } 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); 2135 2147 } 2136 2148 else 2137 2149 { 2138 perror("local access failed"); 2150 perror("local access failed"); 2139 2151 exit(1); 2140 2152 } … … 2146 2158 } 2147 2159 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" 2150 2162 "Ntrip-Version: Ntrip/2.0\r\n" 2151 2163 "Ntrip-Component: Ntripclient\r\n" … … 2241 2253 2242 2254 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" 2244 2256 "CSeq: %d\r\n" 2245 2257 "Session: %d\r\n" 2246 "\r\n", 2258 "\r\n", 2247 2259 args.server, proxyserver ? ":" : "", proxyserver ? args.port : "", 2248 2260 args.data, cseq++, session); … … 2265 2277 /* fill structure with caster address information for UDP */ 2266 2278 memset(&addrRTP, 0, sizeof(addrRTP)); 2267 addrRTP.sin_family = AF_INET; 2279 addrRTP.sin_family = AF_INET; 2268 2280 addrRTP.sin_port = htons(serverport); 2269 2281 their_addr.sin_addr = *((struct in_addr *)he->h_addr); … … 2288 2300 if(init) 2289 2301 { 2302 int z; 2290 2303 if(u < -30000 && sn > 30000) sn -= 0xFFFF; 2291 2304 if(ssrc != w || ts > v) … … 2295 2308 } 2296 2309 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]); 2298 2312 } 2299 2313 sn = u; ts = v; ssrc = w; init = 1; … … 2307 2321 } 2308 2322 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" 2310 2324 "CSeq: %d\r\n" 2311 2325 "Session: %d\r\n" 2312 "\r\n", 2326 "\r\n", 2313 2327 args.server, proxyserver ? ":" : "", proxyserver ? args.port : "", 2314 2328 args.data, cseq++, session); … … 2420 2434 while(!stop && (numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) != -1) 2421 2435 { 2422 alarm(ALARMTIME); 2436 if(numbytes > 0) 2437 alarm(ALARMTIME); 2438 else 2439 { 2440 WaitMicro(100); 2441 continue; 2442 } 2423 2443 if(!k) 2424 2444 { … … 2449 2469 if(i < numbytes-l) 2450 2470 chunkymode = 1; 2451 2471 } 2452 2472 else if(numbytes < 12 || strncmp("ICY 200 OK\r\n", buf, 12)) 2453 2473 { -
trunk/BNC/RTCM3/rtcm3torinex.h
r1030 r1096 4 4 /* 5 5 Converter for RTCM3 data to RINEX. 6 $Id: rtcm3torinex.h,v 1. 10 2008/01/29 14:53:15 mervartExp $7 Copyright (C) 2005-2006 by Dirk St oecker <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> 8 8 9 9 This program is free software; you can redistribute it and/or modify … … 115 115 #define GPSEPHF_VALIDATED (1<<3) /* data is completely valid */ 116 116 117 #ifndef PI 118 #define PI 3.1415926535898 119 #endif 117 #define R2R_PI 3.1415926535898 120 118 121 119 struct gpsephemeris { … … 196 194 int lastlockl1[64]; 197 195 int lastlockl2[64]; 196 #ifdef NO_RTCM3_MAIN 198 197 int typeSize; /* RTCM message types */ 199 198 int typeList[101]; /* RTCM message types */ 199 #endif /* NO_RTCM3_MAIN */ 200 200 int datapos[RINEXENTRY_NUMBER]; 201 201 int dataflag[RINEXENTRY_NUMBER];
Note:
See TracChangeset
for help on using the changeset viewer.