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

Last change on this file since 2014 was 2014, checked in by mervart, 14 years ago

* empty log message *

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