source: ntrip/trunk/rtcm3torinex/lib/rtcm3torinexsupport.cpp@ 4432

Last change on this file since 4432 was 4432, checked in by mervart, 12 years ago
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1/*
2 Converter for RTCM3 data to RINEX.
3 $Id: rtcm3torinexsupport.cpp 4432 2012-07-24 15:47:50Z mervart $
4 Copyright (C) 2005-2012 by Dirk Stöcker <stoecker@alberding.eu>
5
6 This software is a complete NTRIP-RTCM3 to RINEX converter as well as
7 a module of the BNC tool for multiformat conversion. Contact Dirk
8 Stöcker for suggestions and bug reports related to the RTCM3 to RINEX
9 conversion problems and the author of BNC for all the other problems.
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 or read http://www.gnu.org/licenses/gpl.txt
25*/
26
27#include <string>
28extern "C" {
29#include "rtcm3torinex.h"
30}
31
32int rrinex3codetoentry(const char *code)
33{
34 int res = 0;
35 switch(code[0])
36 {
37 case 'C': res += GNSSENTRY_CODE; break;
38 case 'L': res += GNSSENTRY_PHASE; break;
39 case 'D': res += GNSSENTRY_DOPPLER; break;
40 case 'S': res += GNSSENTRY_SNR; break;
41 default:
42 return -1;
43 }
44 switch(code[1])
45 {
46 case '1':
47 switch(code[2])
48 {
49 default:
50 case 'C': res += GNSSENTRY_TYPEC1; break;
51 case 'P': case'W': case 'Y': res += GNSSENTRY_TYPEP1; break;
52 case 'A': case'B':
53 case 'S': case'L': case 'X': res += GNSSENTRY_TYPEC1N; break;
54 case 'Z': res += GNSSENTRY_TYPECSAIF; break;
55 }
56 break;
57 case '2':
58 switch(code[2])
59 {
60 default:
61 case 'P': case 'W': case 'Y': res += GNSSENTRY_TYPEP2; break;
62 case 'C': case 'S': case 'L': case 'X': res += GNSSENTRY_TYPEC2; break;
63 }
64 break;
65 case '5':
66 res += GNSSENTRY_TYPEC5;
67 break;
68 case '6':
69 res += GNSSENTRY_TYPEC6;
70 break;
71 case '7':
72 res += GNSSENTRY_TYPEC5B;
73 break;
74 case '8':
75 res += GNSSENTRY_TYPEC5AB;
76 break;
77 }
78 return res;
79}
80
81std::string entry2rinexcode(const char* codetype[GNSS_MAXSATS][GNSSENTRY_NUMBER],
82 int iSat, int iEntry) {
83 char str[3];
84 switch(iEntry&3) {
85 case GNSSENTRY_CODE: str[0] = 'C'; break;
86 case GNSSENTRY_PHASE: str[0] = 'L'; break;
87 case GNSSENTRY_DOPPLER: str[0] = 'D'; break;
88 case GNSSENTRY_SNR: str[0] = 'S'; break;
89 }
90 str[1] = codetype[iSat][iEntry][0];
91 str[2] = codetype[iSat][iEntry][1];
92 return std::string(str);
93}
Note: See TracBrowser for help on using the repository browser.