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

Last change on this file since 10804 was 10791, checked in by mervart, 5 months ago

BNC Multifrequency and PPPAR Client (initial version)

File size: 4.2 KB
RevLine 
[5678]1#ifndef PPP_H
2#define PPP_H
3
4#include <string>
[5747]5#include <vector>
[5839]6#include <newmat.h>
[10791]7#include <sstream>
[5742]8
9#include "bncconst.h"
[5708]10#include "bnctime.h"
[6101]11#include "ephemeris.h"
[5742]12#include "t_prn.h"
[6135]13#include "satObs.h"
[5678]14
[5814]15namespace BNC_PPP {
[5678]16
[10791]17const double ZEROVALUE = 1e-100;
18
[5825]19class t_except {
[5763]20 public:
[5825]21 t_except(const char* msg) {
[5763]22 _msg = msg;
23 }
[5825]24 ~t_except() {}
[5763]25 std::string what() {return _msg;}
26 private:
27 std::string _msg;
28};
29
[5743]30class t_output {
[5678]31 public:
[7926]32 bncTime _epoTime;
33 double _xyzRover[3];
34 double _covMatrix[6];
35 double _neu[3];
[6653]36 double _trp0;
37 double _trp;
38 double _trpStdev;
[7926]39 int _numSat;
40 double _hDop;
41 std::string _log;
42 bool _error;
[5678]43};
44
[10791]45class t_lc {
46public:
47 enum type {dummy = 0, code, phase, codeIF, phaseIF, MW, CL, GIM, maxLc};
[10251]48
[10791]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;
[10251]58 }
[10791]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 }
[10251]71 }
72
[10791]73 char system() const {
74 return t_frequency::toSystem(_frq1);
75 }
[5678]76
[10791]77 static bool needs2ndFrq(type tt) {
78 if (tt == codeIF || tt == phaseIF || tt == MW) {
[6021]79 return true;
[10791]80 }
81 else {
[6021]82 return false;
[10791]83 }
84 }
85
86 bool includesPhase() const {
87 if (_type == phase || _type == phaseIF || _type == MW || _type == CL) {
88 return true;
89 }
90 else {
[8905]91 return false;
[6021]92 }
[5678]93 }
94
[10791]95 bool includesCode() const {
96 if (_type == code || _type == codeIF || _type == MW || _type == CL) {
[6021]97 return true;
[10791]98 }
99 else {
[6021]100 return false;
[10791]101 }
102 }
103
104 bool isIonoFree() const {
105 if (_type == codeIF || _type == phaseIF || _type == MW || _type == CL) {
106 return true;
107 }
108 else {
[8905]109 return false;
[6021]110 }
[5678]111 }
[10791]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) {
[6021]124 return t_frequency::dummy;
125 }
[10791]126 else {
127 return _frq1;
128 }
[6021]129 }
130
[10791]131 std::string toString() const {
132 std::stringstream out;
133 if (_type == code) {
134 out << 'c' << t_frequency::toString(_frq1);
[6021]135 }
[10791]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();
[5678]155 }
[10791]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;
[5678]185};
186
[6101]187class interface_pppClient {
188 public:
[6103]189 virtual ~interface_pppClient() {};
[6101]190 virtual void processEpoch(const std::vector<t_satObs*>& satObs, t_output* output) = 0;
[7926]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;
[6465]194 virtual void putCodeBiases(const std::vector<t_satCodeBias*>& satCodeBias) = 0;
[7926]195};
[6101]196
[5814]197} // namespace BNC_PPP
[5678]198
199#endif
Note: See TracBrowser for help on using the repository browser.