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 |
|
---|
12 | class t_eph {
|
---|
13 | public:
|
---|
14 | virtual ~t_eph() {};
|
---|
15 |
|
---|
16 | bool isNewerThan(const t_eph* eph) const;
|
---|
17 | QString prn() const {return _prn;}
|
---|
18 |
|
---|
19 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
20 | ColumnVector& vv) const = 0;
|
---|
21 | virtual void read(const QStringList& lines) = 0;
|
---|
22 | virtual int IOD() const = 0;
|
---|
23 | protected:
|
---|
24 | QString _prn;
|
---|
25 | int _GPSweek;
|
---|
26 | double _GPSweeks;
|
---|
27 | };
|
---|
28 |
|
---|
29 | class t_ephGlo : public t_eph {
|
---|
30 | public:
|
---|
31 | t_ephGlo() {
|
---|
32 | _gps_utc = 0.0;
|
---|
33 | _xv.ReSize(6);
|
---|
34 | };
|
---|
35 | virtual ~t_ephGlo() {};
|
---|
36 | virtual void read(const QStringList& lines);
|
---|
37 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
38 | ColumnVector& vv) const;
|
---|
39 | virtual int IOD() const;
|
---|
40 | private:
|
---|
41 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv);
|
---|
42 | mutable double _tt; // time in seconds of GPSweek
|
---|
43 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
44 | double _gps_utc; // GPS - UTC in seconds
|
---|
45 |
|
---|
46 | double _E; // [days]
|
---|
47 | double _tau; // [s]
|
---|
48 | double _gamma; //
|
---|
49 | double _x_pos; // [km]
|
---|
50 | double _x_velocity; // [km/s]
|
---|
51 | double _x_acceleration; // [km/s^2]
|
---|
52 | double _y_pos; // [km]
|
---|
53 | double _y_velocity; // [km/s]
|
---|
54 | double _y_acceleration; // [km/s^2]
|
---|
55 | double _z_pos; // [km]
|
---|
56 | double _z_velocity; // [km/s]
|
---|
57 | double _z_acceleration; // [km/s^2]
|
---|
58 | double _health; // 0 = O.K.
|
---|
59 | double _frequency_number; // ICD-GLONASS data position
|
---|
60 | };
|
---|
61 |
|
---|
62 |
|
---|
63 | class t_ephGPS : public t_eph {
|
---|
64 | public:
|
---|
65 | t_ephGPS() {};
|
---|
66 | virtual ~t_ephGPS() {};
|
---|
67 | virtual void read(const QStringList& lines);
|
---|
68 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
69 | ColumnVector& vv) const;
|
---|
70 | virtual int IOD() const {return int(_IODE);}
|
---|
71 |
|
---|
72 | private:
|
---|
73 | double _TOW; // [s]
|
---|
74 | double _TOC; // [s]
|
---|
75 | double _TOE; // [s]
|
---|
76 | double _IODE;
|
---|
77 | double _IODC;
|
---|
78 |
|
---|
79 | double _clock_bias; // [s]
|
---|
80 | double _clock_drift; // [s/s]
|
---|
81 | double _clock_driftrate; // [s/s^2]
|
---|
82 |
|
---|
83 | double _Crs; // [m]
|
---|
84 | double _Delta_n; // [rad/s]
|
---|
85 | double _M0; // [rad]
|
---|
86 | double _Cuc; // [rad]
|
---|
87 | double _e; //
|
---|
88 | double _Cus; // [rad]
|
---|
89 | double _sqrt_A; // [m^0.5]
|
---|
90 | double _Cic; // [rad]
|
---|
91 | double _OMEGA0; // [rad]
|
---|
92 | double _Cis; // [rad]
|
---|
93 | double _i0; // [rad]
|
---|
94 | double _Crc; // [m]
|
---|
95 | double _omega; // [rad]
|
---|
96 | double _OMEGADOT; // [rad/s]
|
---|
97 | double _IDOT; // [rad/s]
|
---|
98 |
|
---|
99 | double _TGD; // [s]
|
---|
100 | };
|
---|
101 |
|
---|
102 | class t_bnseph : public QThread {
|
---|
103 | Q_OBJECT
|
---|
104 | public:
|
---|
105 | t_bnseph(QObject* parent = 0);
|
---|
106 | virtual ~t_bnseph();
|
---|
107 | virtual void run();
|
---|
108 |
|
---|
109 | signals:
|
---|
110 | void newEph(t_eph* eph, int nBytes);
|
---|
111 | void newMessage(const QByteArray msg);
|
---|
112 | void error(const QByteArray msg);
|
---|
113 |
|
---|
114 | private:
|
---|
115 | void reconnect();
|
---|
116 | void readEph();
|
---|
117 | QTcpSocket* _socket;
|
---|
118 | QFile* _echoFile;
|
---|
119 | QTextStream* _echoStream;
|
---|
120 | };
|
---|
121 | #endif
|
---|