Stellarium 0.15.2
TelescopeClientDirectLx200.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_LX200_
28 #define _TELESCOPE_CLIENT_DIRECT_LX200_
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 
39 class Lx200Connection;
40 
44 {
45  Q_OBJECT
46 public:
47  TelescopeClientDirectLx200(const QString &name, const QString &parameters, Equinox eq = EquinoxJ2000);
49  {
50  //hangup();
51  }
52 
53  //======================================================================
54  // Methods inherited from TelescopeClient
55  bool isConnected(void) const;
56 
57  //======================================================================
58  // Methods inherited from Server
59  virtual void step(long long int timeout_micros);
60  void communicationResetReceived(void);
61  void longFormatUsedReceived(bool long_format);
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 inherited from ServerLx200
94  Lx200Connection *lx200;
95  bool long_format_used;
96  bool answers_received;
97 
98  unsigned int last_ra;
99  bool queue_get_position;
100  long long int next_pos_time;
101 };
102 
103 #endif //_TELESCOPE_CLIENT_DIRECT_LX200_
Base class for telescope server classes.
Definition: Server.hpp:45
Telescope client that connects directly to a Meade LX200 through a serial port.
An abstract base class that should never be used directly, only inherited.
Serial port connection to a Meade LX200 or a compatible telescope.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48