source: ntrip/trunk/BNC/src/pppInclude.h@ 10792

Last change on this file since 10792 was 10791, checked in by mervart, 3 days ago

BNC Multifrequency and PPPAR Client (initial version)

File size: 4.2 KB
Line 
1#ifndef PPP_H
2#define PPP_H
3
4#include <string>
5#include <vector>
6#include <newmat.h>
7#include <sstream>
8
9#include "bncconst.h"
10#include "bnctime.h"
11#include "ephemeris.h"
12#include "t_prn.h"
13#include "satObs.h"
14
15namespace BNC_PPP {
16
17const double ZEROVALUE = 1e-100;
18
19class t_except {
20 public:
21 t_except(const char* msg) {
22 _msg = msg;
23 }
24 ~t_except() {}
25 std::string what() {return _msg;}
26 private:
27 std::string _msg;
28};
29
30class t_output {
31 public:
32 bncTime _epoTime;
33 double _xyzRover[3];
34 double _covMatrix[6];
35 double _neu[3];
36 double _trp0;
37 double _trp;
38 double _trpStdev;
39 int _numSat;
40 double _hDop;
41 std::string _log;
42 bool _error;
43};
44
45class t_lc {
46public:
47 enum type {dummy = 0, code, phase, codeIF, phaseIF, MW, CL, GIM, maxLc};
48
49 t_lc() : _type(dummy), _frq1(t_frequency::dummy), _frq2(t_frequency::dummy) {}
50
51 t_lc(type tt, t_frequency::type frq1, t_frequency::type frq2 = t_frequency::dummy)
52 : _type(tt), _frq1(frq1), _frq2(frq2) {
53 }
54
55 bool valid() const {
56 if (_type == dummy) {
57 return false;
58 }
59 else if (_type == GIM) {
60 return true;
61 }
62 else {
63 if (_frq1 == t_frequency::dummy) {
64 return false;
65 }
66 if (t_lc::needs2ndFrq(_type) && _frq2 == t_frequency::dummy) {
67 return false;
68 }
69 return true;
70 }
71 }
72
73 char system() const {
74 return t_frequency::toSystem(_frq1);
75 }
76
77 static bool needs2ndFrq(type tt) {
78 if (tt == codeIF || tt == phaseIF || tt == MW) {
79 return true;
80 }
81 else {
82 return false;
83 }
84 }
85
86 bool includesPhase() const {
87 if (_type == phase || _type == phaseIF || _type == MW || _type == CL) {
88 return true;
89 }
90 else {
91 return false;
92 }
93 }
94
95 bool includesCode() const {
96 if (_type == code || _type == codeIF || _type == MW || _type == CL) {
97 return true;
98 }
99 else {
100 return false;
101 }
102 }
103
104 bool isIonoFree() const {
105 if (_type == codeIF || _type == phaseIF || _type == MW || _type == CL) {
106 return true;
107 }
108 else {
109 return false;
110 }
111 }
112
113 bool isGeometryFree() const {
114 if (_type == MW || _type == CL || _type == GIM) {
115 return true;
116 }
117 else {
118 return false;
119 }
120 }
121
122 t_frequency::type toFreq() const {
123 if (_frq2 != t_frequency::dummy) {
124 return t_frequency::dummy;
125 }
126 else {
127 return _frq1;
128 }
129 }
130
131 std::string toString() const {
132 std::stringstream out;
133 if (_type == code) {
134 out << 'c' << t_frequency::toString(_frq1);
135 }
136 else if (_type == phase) {
137 out << 'l' << t_frequency::toString(_frq1);
138 }
139 else if (_type == codeIF) {
140 out << 'c' << t_frequency::toSystem(_frq1) << "IF" ;
141 }
142 else if (_type == phaseIF) {
143 out << 'l' << t_frequency::toSystem(_frq1) << "IF" ;
144 }
145 else if (_type == MW) {
146 out << t_frequency::toSystem(_frq1) << "MW" ;
147 }
148 else if (_type == CL) {
149 out << t_frequency::toSystem(_frq1) << "CL" ;
150 }
151 else if (_type == GIM) {
152 out << t_frequency::toSystem(_frq1) << "GIM" ;
153 }
154 return out.str();
155 }
156
157 bool operator==(const t_lc& other) const {
158 if (_type == other._type && _frq1 == other._frq1 && _frq2 == other._frq2) {
159 return true;
160 }
161 else {
162 return false;
163 }
164 }
165
166 bool operator!=(const t_lc& other) const {
167 return !(*this == other);
168 }
169
170 bool operator <(const t_lc& other) const {
171 if (_type != other._type) {
172 return _type < other._type;
173 }
174 else if (_frq1 != other._frq1) {
175 return _frq1 < other._frq1;
176 }
177 else {
178 return _frq2 < other._frq2;
179 }
180 }
181
182 type _type;
183 t_frequency::type _frq1;
184 t_frequency::type _frq2;
185};
186
187class interface_pppClient {
188 public:
189 virtual ~interface_pppClient() {};
190 virtual void processEpoch(const std::vector<t_satObs*>& satObs, t_output* output) = 0;
191 virtual void putEphemeris(const t_eph* eph) = 0;
192 virtual void putOrbCorrections(const std::vector<t_orbCorr*>& corr) = 0;
193 virtual void putClkCorrections(const std::vector<t_clkCorr*>& corr) = 0;
194 virtual void putCodeBiases(const std::vector<t_satCodeBias*>& satCodeBias) = 0;
195};
196
197} // namespace BNC_PPP
198
199#endif
Note: See TracBrowser for help on using the repository browser.