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