source: ntrip/trunk/BNS/bnseph.h@ 2618

Last change on this file since 2618 was 2618, checked in by mervart, 12 years ago
File size: 3.8 KB
Line 
1#ifndef BNSEPH_H
2#define BNSEPH_H
3
4#include <math.h>
5#include <newmat.h>
6
7#include <QtCore>
8#include <QThread>
9#include <QtNetwork>
10
11#include "bnsutils.h"
12
13class t_eph {
14 public:
15 virtual ~t_eph() {};
16
17 bool isNewerThan(const t_eph* eph) const;
18 QString prn() const {return _prn;}
19
20 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
21 ColumnVector& vv) const = 0;
22 virtual t_irc read(const QStringList& lines) = 0;
23 virtual int IOD() const = 0;
24 virtual int RTCM3(unsigned char *) = 0;
25
26 protected:
27 QString _prn;
28 int _GPSweek;
29 double _GPSweeks;
30};
31
32class t_ephGlo : public t_eph {
33 public:
34 t_ephGlo() {
35 _gps_utc = 0.0;
36 _xv.ReSize(6);
37 };
38 virtual ~t_ephGlo() {};
39 virtual t_irc read(const QStringList& lines);
40 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
41 ColumnVector& vv) const;
42 virtual int IOD() const;
43 virtual int RTCM3(unsigned char *);
44 private:
45 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
46 double* acc);
47 mutable double _tt; // time in seconds of GPSweek
48 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
49 double _gps_utc; // GPS - UTC in seconds
50
51 double _E; // [days]
52 double _tau; // [s]
53 double _gamma; //
54 double _x_pos; // [km]
55 double _x_velocity; // [km/s]
56 double _x_acceleration; // [km/s^2]
57 double _y_pos; // [km]
58 double _y_velocity; // [km/s]
59 double _y_acceleration; // [km/s^2]
60 double _z_pos; // [km]
61 double _z_velocity; // [km/s]
62 double _z_acceleration; // [km/s^2]
63 double _health; // 0 = O.K.
64 double _frequency_number; // ICD-GLONASS data position
65 double _tki; // message frame time
66};
67
68
69class t_ephGPS : public t_eph {
70 public:
71 t_ephGPS() {};
72 virtual ~t_ephGPS() {};
73 virtual t_irc read(const QStringList& lines);
74 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
75 ColumnVector& vv) const;
76 virtual int IOD() const {return int(_IODE);}
77 virtual int RTCM3(unsigned char *);
78 private:
79 double _TOW; // [s]
80 double _TOC; // [s]
81 double _TOE; // [s]
82 double _IODE;
83 double _IODC;
84
85 double _clock_bias; // [s]
86 double _clock_drift; // [s/s]
87 double _clock_driftrate; // [s/s^2]
88
89 double _Crs; // [m]
90 double _Delta_n; // [rad/s]
91 double _M0; // [rad]
92 double _Cuc; // [rad]
93 double _e; //
94 double _Cus; // [rad]
95 double _sqrt_A; // [m^0.5]
96 double _Cic; // [rad]
97 double _OMEGA0; // [rad]
98 double _Cis; // [rad]
99 double _i0; // [rad]
100 double _Crc; // [m]
101 double _omega; // [rad]
102 double _OMEGADOT; // [rad/s]
103 double _IDOT; // [rad/s]
104
105 double _TGD; // [s]
106 double _health; // SV health
107 double _ura; // SV accuracy
108 double _L2PFlag; // L2 P data flag
109 double _L2Codes; // Codes on L2 channel
110};
111
112class t_bnseph : public QThread {
113 Q_OBJECT
114 public:
115 t_bnseph(QObject* parent = 0);
116 virtual ~t_bnseph();
117 virtual void run();
118
119 signals:
120 void newEph(t_eph* eph, int nBytes);
121 void newMessage(const QByteArray msg);
122 void error(const QByteArray msg);
123
124 private:
125 void reconnect();
126 void readEph();
127 QTcpSocket* _socket;
128 QFile* _echoFile;
129 QTextStream* _echoStream;
130};
131#endif
Note: See TracBrowser for help on using the repository browser.