Stellarium 0.12.3
TelescopeClientDirectNexStar.hpp
1 /*
2  * Stellarium Telescope Control Plug-in
3  *
4  * Copyright (C) 2009 Bogdan Marinov (this file,
5  * reusing code written by Johannes Gajdosik in 2006)
6  *
7  * Johannes Gajdosik wrote in 2006 the original telescope control feature
8  * as a core module of Stellarium. In 2009 it was significantly extended with
9  * GUI features and later split as an external plug-in module by Bogdan Marinov.
10  *
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; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
25  */
26 
27 #ifndef _TELESCOPE_CLIENT_DIRECT_NEXSTAR_
28 #define _TELESCOPE_CLIENT_DIRECT_NEXSTAR_
29 
30 #include <QObject>
31 #include <QString>
32 
33 #include "StelApp.hpp"
34 #include "StelObject.hpp"
35 
36 #include "Server.hpp" //from the telescope server source tree
37 #include "TelescopeClient.hpp" //from the plug-in's source tree
38 #include "InterpolatedPosition.hpp"
39 
40 class NexStarConnection;
41 
45 {
46  Q_OBJECT
47 public:
48  TelescopeClientDirectNexStar(const QString &name, const QString &parameters, Equinox eq = EquinoxJ2000);
50  {
51  //hangup();
52  }
53 
54  //======================================================================
55  // Methods inherited from TelescopeClient
56  bool isConnected(void) const;
57 
58  //======================================================================
59  // Methods inherited from Server
60  virtual void step(long long int timeout_micros);
61  void communicationResetReceived(void);
62  void raReceived(unsigned int ra_int);
63  void decReceived(unsigned int dec_int);
64 
65 private:
66  //======================================================================
67  // Methods inherited from TelescopeClient
68  Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
69  bool prepareCommunication();
70  void performCommunication();
71  void telescopeGoto(const Vec3d &j2000Pos);
72  bool isInitialized(void) const;
73 
74  //======================================================================
75  // Methods inherited from Server
76  void sendPosition(unsigned int ra_int, int dec_int, int status);
77  //TODO: Find out if this method is needed. It's called by Connection.
78  void gotoReceived(unsigned int ra_int, int dec_int);
79 
80 private:
81  void hangup(void);
82  int time_delay;
83 
84  InterpolatedPosition interpolatedPosition;
85  virtual bool hasKnownPosition(void) const
86  {
87  return interpolatedPosition.isKnown();
88  }
89 
90  Equinox equinox;
91 
92  //======================================================================
93  // Members taken from ServerNexStar
94  NexStarConnection *nexstar;
95 
96  unsigned int last_ra;
97  bool queue_get_position;
98  long long int next_pos_time;
99 };
100 
101 #endif //_TELESCOPE_CLIENT_DIRECT_LX200_