1 | #ifndef THRIFTCLIENT_H
|
---|
2 | #define THRIFTCLIENT_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 | #include <map>
|
---|
6 | #include <QString>
|
---|
7 | #include <QThread>
|
---|
8 | #include <QMutex>
|
---|
9 |
|
---|
10 | #include <transport/TSocket.h>
|
---|
11 | #include <transport/TBufferTransports.h>
|
---|
12 | #include <protocol/TBinaryProtocol.h>
|
---|
13 |
|
---|
14 | #include "gen-cpp/RtnetData.h"
|
---|
15 |
|
---|
16 | using namespace com::gpssolutions::rtnet;
|
---|
17 |
|
---|
18 | namespace GnssCenter {
|
---|
19 | class t_monitor;
|
---|
20 | }
|
---|
21 |
|
---|
22 | namespace GnssCenter {
|
---|
23 |
|
---|
24 | class t_thriftResult {
|
---|
25 | public:
|
---|
26 | t_thriftResult() {
|
---|
27 | _nGPS = 0;
|
---|
28 | _nGLO = 0;
|
---|
29 | _x = 0.0;
|
---|
30 | _y = 0.0;
|
---|
31 | _z = 0.0;
|
---|
32 | }
|
---|
33 | ~t_thriftResult() {}
|
---|
34 | std::string _name;
|
---|
35 | int _nGPS;
|
---|
36 | int _nGLO;
|
---|
37 | double _x;
|
---|
38 | double _y;
|
---|
39 | double _z;
|
---|
40 | };
|
---|
41 |
|
---|
42 | class t_thriftSatellite {
|
---|
43 | public:
|
---|
44 | std::string _prn;
|
---|
45 | double _x;
|
---|
46 | double _y;
|
---|
47 | double _z;
|
---|
48 | };
|
---|
49 |
|
---|
50 | class t_thriftHandler : public RtnetDataIf {
|
---|
51 | public:
|
---|
52 | t_thriftHandler(t_monitor* parent);
|
---|
53 | ~t_thriftHandler();
|
---|
54 | void startDataStream() {}
|
---|
55 | void registerRtnet(const RtnetInformation&) {}
|
---|
56 | void handleZDAmb(const std::vector<ZDAmb>&) {}
|
---|
57 | void handleDDAmbresBaselines(const std::vector<DDAmbresBaseline>&) {}
|
---|
58 | void handleSatelliteXYZ(const std::vector<SatelliteXYZ>& svXYZList);
|
---|
59 | void handleStationInfo(const std::vector<StationInfo>& stationList);
|
---|
60 | void handleStationAuxInfo(const std::vector<StationAuxInfo>&) {}
|
---|
61 | void handleDGPSCorr(const std::vector<DGPSCorr>&) {}
|
---|
62 | void handleSatelliteClock(const std::vector<SatelliteClock>&) {}
|
---|
63 | void handleEpochResults(const RtnetEpoch& epoch);
|
---|
64 | private:
|
---|
65 | class t_stationCrd {
|
---|
66 | public:
|
---|
67 | double _x;
|
---|
68 | double _y;
|
---|
69 | double _z;
|
---|
70 | };
|
---|
71 | t_monitor* _parent;
|
---|
72 | std::map<std::string, t_stationCrd> _stationCrd;
|
---|
73 | };
|
---|
74 |
|
---|
75 | class t_thriftClient : public QThread {
|
---|
76 | Q_OBJECT
|
---|
77 | public:
|
---|
78 | t_thriftClient(t_monitor* parent, const QString& host, int port);
|
---|
79 | ~t_thriftClient();
|
---|
80 | virtual void run();
|
---|
81 | void stop() {
|
---|
82 | QMutexLocker locker(&_mutex);
|
---|
83 | _stop = true;
|
---|
84 | }
|
---|
85 | signals:
|
---|
86 | void message(QByteArray msg);
|
---|
87 | private:
|
---|
88 | QMutex _mutex;
|
---|
89 | std::string _host;
|
---|
90 | int _port;
|
---|
91 | t_monitor* _parent;
|
---|
92 | bool _stop;
|
---|
93 | };
|
---|
94 |
|
---|
95 | } // namespace GnssCenter
|
---|
96 |
|
---|
97 | #endif
|
---|