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