1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
8 | // http://www.fsv.cvut.cz
|
---|
9 | //
|
---|
10 | // Email: euref-ip@bkg.bund.de
|
---|
11 | //
|
---|
12 | // This program is free software; you can redistribute it and/or
|
---|
13 | // modify it under the terms of the GNU General Public License
|
---|
14 | // as published by the Free Software Foundation, version 2.
|
---|
15 | //
|
---|
16 | // This program is distributed in the hope that it will be useful,
|
---|
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | // GNU General Public License for more details.
|
---|
20 | //
|
---|
21 | // You should have received a copy of the GNU General Public License
|
---|
22 | // along with this program; if not, write to the Free Software
|
---|
23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
24 |
|
---|
25 | #ifndef BNCGETTHREAD_H
|
---|
26 | #define BNCGETTHREAD_H
|
---|
27 |
|
---|
28 | #include <QThread>
|
---|
29 | #include <QtNetwork>
|
---|
30 | #include <QDateTime>
|
---|
31 | #include <QFile>
|
---|
32 |
|
---|
33 | #include "bncconst.h"
|
---|
34 | #include "bncnetquery.h"
|
---|
35 | #include "bnctime.h"
|
---|
36 | #include "bncrawfile.h"
|
---|
37 | #include "satObs.h"
|
---|
38 | #include "rinex/rnxobsfile.h"
|
---|
39 |
|
---|
40 | class GPSDecoder;
|
---|
41 | class QextSerialPort;
|
---|
42 | class latencyChecker;
|
---|
43 |
|
---|
44 | class bncGetThread : public QThread {
|
---|
45 | Q_OBJECT
|
---|
46 |
|
---|
47 | public:
|
---|
48 | bncGetThread(bncRawFile* rawFile);
|
---|
49 | bncGetThread(const QUrl& mountPoint,
|
---|
50 | const QByteArray& format,
|
---|
51 | const QByteArray& latitude,
|
---|
52 | const QByteArray& longitude,
|
---|
53 | const QByteArray& nmea,
|
---|
54 | const QByteArray& ntripVersion);
|
---|
55 |
|
---|
56 | bncNetQuery::queryStatus queryStatus() {
|
---|
57 | if (_query) {
|
---|
58 | return _query->status();
|
---|
59 | }
|
---|
60 | else {
|
---|
61 | return bncNetQuery::init;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | protected:
|
---|
66 | ~bncGetThread();
|
---|
67 |
|
---|
68 | public:
|
---|
69 | void terminate();
|
---|
70 |
|
---|
71 | QByteArray staID() const {return _staID;}
|
---|
72 | QUrl mountPoint() const {return _mountPoint;}
|
---|
73 | QByteArray latitude() const {return _latitude;}
|
---|
74 | QByteArray longitude() const {return _longitude;}
|
---|
75 | QByteArray ntripVersion() const {return _ntripVersion;}
|
---|
76 |
|
---|
77 | signals:
|
---|
78 | void newBytes(QByteArray staID, double nbyte);
|
---|
79 | void newRawData(QByteArray staID, QByteArray data);
|
---|
80 | void newLatency(QByteArray staID, double clate);
|
---|
81 | void newObs(QByteArray staID, QList<t_satObs> obsList);
|
---|
82 | void newAntCrd(QByteArray staID, double xx, double yy, double zz,
|
---|
83 | double hh, QByteArray antType);
|
---|
84 | void newMessage(QByteArray msg, bool showOnScreen);
|
---|
85 | void newRTCMMessage(QByteArray staID, int msgID);
|
---|
86 | void getThreadFinished(QByteArray staID);
|
---|
87 |
|
---|
88 | public:
|
---|
89 | virtual void run();
|
---|
90 |
|
---|
91 | public slots:
|
---|
92 | void slotNewNMEAstr(QByteArray staID, QByteArray str);
|
---|
93 |
|
---|
94 | private slots:
|
---|
95 | void slotSerialReadyRead();
|
---|
96 | void slotNewNMEAConnection();
|
---|
97 |
|
---|
98 | private:
|
---|
99 | enum t_serialNMEA {NO_NMEA, MANUAL_NMEA, AUTO_NMEA};
|
---|
100 | t_irc initDecoder();
|
---|
101 | GPSDecoder* decoder();
|
---|
102 |
|
---|
103 | void initialize();
|
---|
104 | t_irc tryReconnect();
|
---|
105 | void scanRTCM();
|
---|
106 |
|
---|
107 | QMap<QString, GPSDecoder*> _decodersRaw;
|
---|
108 | GPSDecoder* _decoder;
|
---|
109 | bncNetQuery* _query;
|
---|
110 | QUrl _mountPoint;
|
---|
111 | QByteArray _staID;
|
---|
112 | QByteArray _format;
|
---|
113 | QByteArray _latitude;
|
---|
114 | QByteArray _longitude;
|
---|
115 | QByteArray _height;
|
---|
116 | QByteArray _nmea;
|
---|
117 | QByteArray _ntripVersion;
|
---|
118 | QByteArray _manualNMEAString;
|
---|
119 | QDateTime _lastManualNMEA;
|
---|
120 | int _manualNMEASampl;
|
---|
121 | int _nextSleep;
|
---|
122 | int _iMount;
|
---|
123 | bncRawFile* _rawFile;
|
---|
124 | QextSerialPort* _serialPort;
|
---|
125 | bool _isToBeDeleted;
|
---|
126 | latencyChecker* _latencyChecker;
|
---|
127 | QString _miscMount;
|
---|
128 | QFile* _serialOutFile;
|
---|
129 | t_serialNMEA _serialNMEA;
|
---|
130 | bool _rawOutput;
|
---|
131 | QMap<QString, long> _prnLastEpo;
|
---|
132 | QMap<char, QVector<QString> > _rnxTypes;
|
---|
133 | QStringList _gloSlots;
|
---|
134 | QList<QTcpSocket*>* _nmeaSockets;
|
---|
135 | QMap<QByteArray, int> _nmeaPortsMap;
|
---|
136 | QTcpServer* _nmeaServer;
|
---|
137 | };
|
---|
138 |
|
---|
139 | #endif
|
---|