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

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