Stellarium  0.90.0
TelescopeClientJsonRts2.hpp
1 /*
2  * RTS2 Json stellarium plugin
3  *
4  * Copyright (C) 2014-2016 Petr Kubanek
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
20 
21 #ifndef _TELESCOPE_CLIENT_JSON_RTS2_HPP_
22 #define _TELESCOPE_CLIENT_JSON_RTS2_HPP_
23 
24 #include "QNetworkAccessManager"
25 #include "QNetworkRequest"
26 #include "QNetworkReply"
27 #include "QUrl"
28 
29 #include "TelescopeClient.hpp"
30 #include "TelescopeControl.hpp"
31 
32 #include "StelCore.hpp"
33 
36 {
37  Q_OBJECT
38 public:
39  TelescopeClientJsonRts2(const QString &name, const QString &params, Equinox eq = EquinoxJ2000);
41  virtual bool isConnected(void) const;
42 
43  Vec3d getJ2000EquatorialPos(const StelCore* core=Q_NULLPTR) const;
44 
45  void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
46  bool hasKnownPosition(void) const;
47 
48 protected:
49  void timerEvent(QTimerEvent *event);
50  virtual QString getTelescopeInfoString(const StelCore* core, const InfoStringGroup& flags) const;
51 
52 private:
53  QNetworkAccessManager networkManager;
54  QNetworkRequest cfgRequest;
55  Equinox equinox;
56  QUrl baseurl;
57  QString telName;
58  bool telReadonly;
59  double telLatitude;
60  double telLongitude;
61  double telAltitude;
62  double telTargetDist;
63  QNetworkRequest request;
64  Vec3d lastPos;
65  InterpolatedPosition interpolatedPosition;
66  int time_delay;
67  int reconnectTimer;
68  int refresh_delay;
69  qint64 server_micros;
70 
71  TelescopeControl *telescopeManager;
72 
73  void getReadOnly();
74  void setReadOnly(bool readonly);
75 
76 private slots:
77  void refreshTimer();
78  void replyFinished(QNetworkReply *reply);
79 };
80 
81 #endif // _TELESCOPE_CLIENT_JSON_RTS2_HPP_
An abstract base class that should never be used directly, only inherited.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
This class manages the controlling of one or more telescopes by one instance of the stellarium progra...
Vec3d getJ2000EquatorialPos(const StelCore *core=Q_NULLPTR) const
Get observer-centered equatorial coordinates at equinox J2000.