1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
8 | // http://www.fsv.cvut.cz
|
---|
9 | //
|
---|
10 | // Email: euref-ip@bkg.bund.de
|
---|
11 | //
|
---|
12 | // This program is free software; you can redistribute it and/or
|
---|
13 | // modify it under the terms of the GNU General Public License
|
---|
14 | // as published by the Free Software Foundation, version 2.
|
---|
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 |
|
---|
25 | /* -------------------------------------------------------------------------
|
---|
26 | * BKG NTRIP Client
|
---|
27 | * -------------------------------------------------------------------------
|
---|
28 | *
|
---|
29 | * Class: bncAntex
|
---|
30 | *
|
---|
31 | * Purpose: Antenna Phase Centers and Variations from ANTEX File
|
---|
32 | *
|
---|
33 | * Author: L. Mervart
|
---|
34 | *
|
---|
35 | * Created: 26-Jan-2011
|
---|
36 | *
|
---|
37 | * Changes:
|
---|
38 | *
|
---|
39 | * -----------------------------------------------------------------------*/
|
---|
40 |
|
---|
41 | #include <iostream>
|
---|
42 |
|
---|
43 | #include "bncantex.h"
|
---|
44 |
|
---|
45 | using namespace std;
|
---|
46 |
|
---|
47 | // Constructor
|
---|
48 | ////////////////////////////////////////////////////////////////////////////
|
---|
49 | bncAntex::bncAntex() {
|
---|
50 | }
|
---|
51 |
|
---|
52 | // Destructor
|
---|
53 | ////////////////////////////////////////////////////////////////////////////
|
---|
54 | bncAntex::~bncAntex() {
|
---|
55 | QMapIterator<QString, t_antMap*> it(_maps);
|
---|
56 | while (it.hasNext()) {
|
---|
57 | it.next();
|
---|
58 | delete it.value();
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | //
|
---|
63 | ////////////////////////////////////////////////////////////////////////////
|
---|
64 | void bncAntex::print() const {
|
---|
65 | QMapIterator<QString, t_antMap*> it(_maps);
|
---|
66 | while (it.hasNext()) {
|
---|
67 | it.next();
|
---|
68 | t_antMap* map = it.value();
|
---|
69 | cout << map->antName.toAscii().data() << endl;
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | //
|
---|
74 | ////////////////////////////////////////////////////////////////////////////
|
---|
75 | t_irc bncAntex::readFile(const QString& fileName) {
|
---|
76 |
|
---|
77 | QFile inFile(fileName);
|
---|
78 | inFile.open(QIODevice::ReadOnly | QIODevice::Text);
|
---|
79 |
|
---|
80 | QTextStream in(&inFile);
|
---|
81 |
|
---|
82 | t_antMap* newAntMap = 0;
|
---|
83 | t_frqMap* newFrqMap = 0;
|
---|
84 |
|
---|
85 | while ( !in.atEnd() ) {
|
---|
86 | QString line = in.readLine();
|
---|
87 |
|
---|
88 | // Start of Antenna
|
---|
89 | // ----------------
|
---|
90 | if (line.indexOf("START OF ANTENNA") == 60) {
|
---|
91 | if (newAntMap) {
|
---|
92 | delete newAntMap;
|
---|
93 | return failure;
|
---|
94 | }
|
---|
95 | else {
|
---|
96 | newAntMap = new t_antMap();
|
---|
97 | }
|
---|
98 | }
|
---|
99 |
|
---|
100 | // End of Antenna
|
---|
101 | // --------------
|
---|
102 | else if (line.indexOf("END OF ANTENNA") == 60) {
|
---|
103 | if (newAntMap) {
|
---|
104 | _maps[newAntMap->antName] = newAntMap;
|
---|
105 | newAntMap = 0;
|
---|
106 | }
|
---|
107 | else {
|
---|
108 | return failure;
|
---|
109 | }
|
---|
110 | }
|
---|
111 |
|
---|
112 | // Antenna Reading in Progress
|
---|
113 | // ---------------------------
|
---|
114 | else if (newAntMap) {
|
---|
115 | if (line.indexOf("TYPE / SERIAL NO") == 60) {
|
---|
116 | if (line.indexOf("BLACK I") == 0 ||
|
---|
117 | line.indexOf("GLONASS") == 0) {
|
---|
118 | newAntMap->antName = line.mid(20,3);
|
---|
119 | }
|
---|
120 | else {
|
---|
121 | newAntMap->antName = line.mid(0,20);
|
---|
122 | }
|
---|
123 | }
|
---|
124 | else if (line.indexOf("ZEN1 / ZEN2 / DZEN") == 60) {
|
---|
125 | QTextStream inLine(&line, QIODevice::ReadOnly);
|
---|
126 | inLine >> newAntMap->zen1 >> newAntMap->zen2 >> newAntMap->dZen;
|
---|
127 | }
|
---|
128 |
|
---|
129 | // Start of Frequency
|
---|
130 | // ------------------
|
---|
131 | else if (line.indexOf("START OF FREQUENCY") == 60) {
|
---|
132 | if (newFrqMap) {
|
---|
133 | delete newFrqMap;
|
---|
134 | delete newAntMap;
|
---|
135 | return failure;
|
---|
136 | }
|
---|
137 | else {
|
---|
138 | newFrqMap = new t_frqMap();
|
---|
139 | }
|
---|
140 | }
|
---|
141 |
|
---|
142 | // End of Frequency
|
---|
143 | // ----------------
|
---|
144 | else if (line.indexOf("END OF FREQUENCY") == 60) {
|
---|
145 | if (newFrqMap) {
|
---|
146 | if (line.indexOf("G01") == 3) {
|
---|
147 | newAntMap->frqMapL1 = newFrqMap;
|
---|
148 | }
|
---|
149 | else if (line.indexOf("G02") == 3) {
|
---|
150 | newAntMap->frqMapL2 = newFrqMap;
|
---|
151 | }
|
---|
152 | else {
|
---|
153 | delete newFrqMap;
|
---|
154 | }
|
---|
155 | newFrqMap = 0;
|
---|
156 | }
|
---|
157 | else {
|
---|
158 | delete newAntMap;
|
---|
159 | return failure;
|
---|
160 | }
|
---|
161 | }
|
---|
162 |
|
---|
163 | // Frequency Reading in Progress
|
---|
164 | // -----------------------------
|
---|
165 | else if (newFrqMap) {
|
---|
166 | if (line.indexOf("NORTH / EAST / UP") == 3) {
|
---|
167 | QTextStream inLine(&line, QIODevice::ReadOnly);
|
---|
168 | inLine >> newFrqMap->neu[0] >> newFrqMap->neu[1] >> newFrqMap->neu[2];
|
---|
169 | }
|
---|
170 | else if (line.indexOf("NOAZI") == 3) {
|
---|
171 | QTextStream inLine(&line, QIODevice::ReadOnly);
|
---|
172 | int nPat = int((newAntMap->zen2-newAntMap->zen1)/newAntMap->dZen) + 1;
|
---|
173 | newFrqMap->pattern.ReSize(nPat);
|
---|
174 | QString dummy;
|
---|
175 | inLine >> dummy;
|
---|
176 | for (int ii = 0; ii < nPat; ii++) {
|
---|
177 | inLine >> newFrqMap->pattern[ii];
|
---|
178 | }
|
---|
179 | }
|
---|
180 | }
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | return success;
|
---|
185 | }
|
---|