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