26 #ifndef _TELESCOPE_HPP_
27 #define _TELESCOPE_HPP_
29 #include <QHostAddress>
36 #include "StelApp.hpp"
37 #include "StelObject.hpp"
38 #include "InterpolatedPosition.hpp"
61 QString getEnglishName(
void)
const {
return name;}
62 QString getNameI18n(
void)
const {
return nameI18n;}
63 Vec3f getInfoColor(
void)
const
65 return Vec3f(1, 1, 1);
76 QString getType(
void)
const {
return "Telescope";}
77 virtual double getAngularSize(
const StelCore*)
const {Q_ASSERT(0);
return 0;}
80 virtual void telescopeGoto(
const Vec3d &j2000Pos) = 0;
81 virtual bool isConnected(
void)
const = 0;
82 virtual bool hasKnownPosition(
void)
const = 0;
83 void addOcular(
double fov) {
if (fov>=0.0) oculars.push_back(fov);}
84 const QList<double> &getOculars(
void)
const {
return oculars;}
86 virtual bool prepareCommunication() {
return false;}
87 virtual void performCommunication() {}
94 virtual bool isInitialized(
void)
const {
return true;}
95 float getSelectPriority(
const StelCore* core)
const {Q_UNUSED(core);
return -10.f;}
97 QList<double> oculars;
111 desired_pos[0] = XYZ[0] = 1.0;
112 desired_pos[1] = XYZ[1] = 0.0;
113 desired_pos[2] = XYZ[2] = 0.0;
116 bool isConnected(
void)
const
120 bool prepareCommunication(
void)
122 XYZ = XYZ * 31.0 + desired_pos;
123 const double lq = XYZ.lengthSquared();
125 XYZ *= (1.0/std::sqrt(lq));
130 void telescopeGoto(
const Vec3d &j2000Pos)
132 desired_pos = j2000Pos;
133 desired_pos.normalize();
135 bool hasKnownPosition(
void)
const
139 Vec3d getJ2000EquatorialPos(
const StelCore*)
const
158 TelescopeTCP(
const QString &name,
const QString ¶ms, Equinox eq = EquinoxJ2000);
163 bool isConnected(
void)
const
166 return (tcpSocket->state() == QAbstractSocket::ConnectedState);
170 Vec3d getJ2000EquatorialPos(
const StelCore* core=0)
const;
171 bool prepareCommunication();
172 void performCommunication();
173 void telescopeGoto(
const Vec3d &j2000Pos);
174 bool isInitialized(
void)
const
176 return (!address.isNull());
178 void performReading(
void);
179 void performWriting(
void);
183 QHostAddress address;
185 QTcpSocket * tcpSocket;
186 bool wait_for_connection_establishment;
187 qint64 end_of_timeout;
188 char readBuffer[120];
190 char writeBuffer[120];
191 char *writeBufferEnd;
195 virtual bool hasKnownPosition(
void)
const
197 return interpolatedPosition.isKnown();
203 void socketConnected(
void);
204 void socketFailed(QAbstractSocket::SocketError socketError);
207 #endif // _TELESCOPE_HPP_
This TelescopeClient class can controll a telescope by communicating to a server process ("telescope ...
An abstract base class that should never be used directly, only inherited.
QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
TelescopeClient supports the following InfoStringGroup flags: