1 |
|
---|
2 | // Part of BNC, a utility for retrieving decoding and
|
---|
3 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
4 | //
|
---|
5 | // Copyright (C) 2007
|
---|
6 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
7 | // http://www.bkg.bund.de
|
---|
8 | // Czech Technical University Prague, Department of Geodesy
|
---|
9 | // http://www.fsv.cvut.cz
|
---|
10 | //
|
---|
11 | // Email: euref-ip@bkg.bund.de
|
---|
12 | //
|
---|
13 | // This program is free software; you can redistribute it and/or
|
---|
14 | // modify it under the terms of the GNU General Public License
|
---|
15 | // as published by the Free Software Foundation, version 2.
|
---|
16 | //
|
---|
17 | // This program is distributed in the hope that it will be useful,
|
---|
18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | // GNU General Public License for more details.
|
---|
21 | //
|
---|
22 | // You should have received a copy of the GNU General Public License
|
---|
23 | // along with this program; if not, write to the Free Software
|
---|
24 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
25 |
|
---|
26 | /* -------------------------------------------------------------------------
|
---|
27 | * BKG NTRIP Client
|
---|
28 | * -------------------------------------------------------------------------
|
---|
29 | *
|
---|
30 | * Class: t_pppClient
|
---|
31 | *
|
---|
32 | * Purpose: PPP Client processing starts here
|
---|
33 | *
|
---|
34 | * Author: L. Mervart
|
---|
35 | *
|
---|
36 | * Created: 29-Jul-2014
|
---|
37 | *
|
---|
38 | * Changes:
|
---|
39 | *
|
---|
40 | * -----------------------------------------------------------------------*/
|
---|
41 |
|
---|
42 | #include <QThreadStorage>
|
---|
43 |
|
---|
44 | #include <iostream>
|
---|
45 | #include <iomanip>
|
---|
46 | #include <stdlib.h>
|
---|
47 | #include <string.h>
|
---|
48 | #include <stdexcept>
|
---|
49 |
|
---|
50 | #include "pppClient.h"
|
---|
51 | #include "bncconst.h"
|
---|
52 | #include "bncutils.h"
|
---|
53 | #include "bncantex.h"
|
---|
54 |
|
---|
55 | using namespace BNC_PPP;
|
---|
56 | using namespace std;
|
---|
57 |
|
---|
58 | // Global variable holding thread-specific pointers
|
---|
59 | //////////////////////////////////////////////////////////////////////////////
|
---|
60 | t_pppClient* PPP_CLIENT = 0;
|
---|
61 |
|
---|
62 | // Static function returning thread-specific pointer
|
---|
63 | //////////////////////////////////////////////////////////////////////////////
|
---|
64 | t_pppClient* t_pppClient::instance() {
|
---|
65 | return PPP_CLIENT;
|
---|
66 | }
|
---|
67 |
|
---|
68 | // Constructor
|
---|
69 | //////////////////////////////////////////////////////////////////////////////
|
---|
70 | t_pppClient::t_pppClient(const t_pppOptions* opt) {
|
---|
71 | _opt = new t_pppOptions(*opt);
|
---|
72 | _log = new ostringstream();
|
---|
73 | _client = new bncPPPclient(QByteArray(_opt->_roverName.c_str()), _opt);
|
---|
74 | PPP_CLIENT = this;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // Destructor
|
---|
78 | //////////////////////////////////////////////////////////////////////////////
|
---|
79 | t_pppClient::~t_pppClient() {
|
---|
80 | delete _log;
|
---|
81 | delete _opt;
|
---|
82 | delete _client;
|
---|
83 | }
|
---|
84 |
|
---|
85 | //
|
---|
86 | //////////////////////////////////////////////////////////////////////////////
|
---|
87 | void t_pppClient::putEphemeris(const t_eph* eph) {
|
---|
88 | const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph);
|
---|
89 | const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph);
|
---|
90 | const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph);
|
---|
91 | if (ephGPS) {
|
---|
92 | _client->putNewEph(new t_ephGPS(*ephGPS));
|
---|
93 | }
|
---|
94 | else if (ephGlo) {
|
---|
95 | _client->putNewEph(new t_ephGlo(*ephGlo));
|
---|
96 | }
|
---|
97 | else if (ephGal) {
|
---|
98 | _client->putNewEph(new t_ephGal(*ephGal));
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | //
|
---|
103 | //////////////////////////////////////////////////////////////////////////////
|
---|
104 | void t_pppClient::putOrbCorrections(const vector<t_orbCorr*>& corr) {
|
---|
105 | }
|
---|
106 |
|
---|
107 | //
|
---|
108 | //////////////////////////////////////////////////////////////////////////////
|
---|
109 | void t_pppClient::putClkCorrections(const vector<t_clkCorr*>& corr) {
|
---|
110 | }
|
---|
111 |
|
---|
112 | //
|
---|
113 | //////////////////////////////////////////////////////////////////////////////
|
---|
114 | void t_pppClient::putBiases(const vector<t_satBias*>& biases) {
|
---|
115 | }
|
---|
116 |
|
---|
117 | //
|
---|
118 | //////////////////////////////////////////////////////////////////////////////
|
---|
119 | void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) {
|
---|
120 |
|
---|
121 | output->_numSat = 0;
|
---|
122 | output->_pDop = 0.0;
|
---|
123 | output->_error = false;
|
---|
124 | output->_log.clear();
|
---|
125 |
|
---|
126 | for (unsigned ii = 0; ii < satObs.size(); ii++) {
|
---|
127 | const t_satObs* obs = satObs[ii];
|
---|
128 | t_satData* satData = new t_satData();
|
---|
129 | satData->tt = obs->_time;
|
---|
130 | satData->prn = QString(obs->_prn.toString().c_str());
|
---|
131 | satData->slipFlag = false;
|
---|
132 | satData->P1 = 0.0;
|
---|
133 | satData->P2 = 0.0;
|
---|
134 | satData->P5 = 0.0;
|
---|
135 | satData->L1 = 0.0;
|
---|
136 | satData->L2 = 0.0;
|
---|
137 | satData->L5 = 0.0;
|
---|
138 | for (unsigned ifrq = 0; ifrq < obs->_obs.size(); ifrq++) {
|
---|
139 | t_frqObs* frqObs = obs->_obs[ifrq];
|
---|
140 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
141 | if (frqObs->_codeValid) satData->P1 = frqObs->_code;
|
---|
142 | if (frqObs->_phaseValid) satData->L1 = frqObs->_phase;
|
---|
143 | if (frqObs->_slip) satData->slipFlag = true;
|
---|
144 | }
|
---|
145 | else if (frqObs->_rnxType2ch[0] == '2') {
|
---|
146 | if (frqObs->_codeValid) satData->P2 = frqObs->_code;
|
---|
147 | if (frqObs->_phaseValid) satData->L2 = frqObs->_phase;
|
---|
148 | if (frqObs->_slip) satData->slipFlag = true;
|
---|
149 | }
|
---|
150 | else if (frqObs->_rnxType2ch[0] == '5') {
|
---|
151 | if (frqObs->_codeValid) satData->P5 = frqObs->_code;
|
---|
152 | if (frqObs->_phaseValid) satData->L5 = frqObs->_phase;
|
---|
153 | if (frqObs->_slip) satData->slipFlag = true;
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 | // _client->putNewObs(pp, output);
|
---|
158 | }
|
---|
159 | output->_log = _log->str();
|
---|
160 | }
|
---|
161 |
|
---|