26 #ifndef _TELESCOPE_HPP_ 27 #define _TELESCOPE_HPP_ 29 #include <QHostAddress> 36 #include "StelApp.hpp" 37 #include "StelObject.hpp" 38 #include "InterpolatedPosition.hpp" 57 static const QString TELESCOPECLIENT_TYPE;
66 return Vec3f(1, 1, 1);
77 QString
getType(
void)
const {
return TELESCOPECLIENT_TYPE;}
78 QString
getID()
const {
return name;}
82 virtual void telescopeGoto(
const Vec3d &j2000Pos,
StelObjectP selectObject) = 0;
83 virtual bool isConnected(
void)
const = 0;
84 virtual bool hasKnownPosition(
void)
const = 0;
85 void addOcular(
double fov) {
if (fov>=0.0) oculars.push_back(fov);}
86 const QList<double> &getOculars(
void)
const {
return oculars;}
88 virtual bool prepareCommunication() {
return false;}
89 virtual void performCommunication() {}
96 virtual QString getTelescopeInfoString(
const StelCore* core,
const InfoStringGroup& flags)
const 103 virtual bool isInitialized(
void)
const {
return true;}
104 float getSelectPriority(
const StelCore* core)
const {Q_UNUSED(core);
return -10.f;}
106 QList<double> oculars;
120 desired_pos[0] = XYZ[0] = 1.0;
121 desired_pos[1] = XYZ[1] = 0.0;
122 desired_pos[2] = XYZ[2] = 0.0;
125 bool isConnected(
void)
const 129 bool prepareCommunication(
void)
131 XYZ = XYZ * 31.0 + desired_pos;
132 const double lq = XYZ.lengthSquared();
134 XYZ *= (1.0/std::sqrt(lq));
141 desired_pos = j2000Pos;
142 desired_pos.normalize();
144 bool hasKnownPosition(
void)
const 167 TelescopeTCP(
const QString &name,
const QString ¶ms, Equinox eq = EquinoxJ2000);
172 bool isConnected(
void)
const 175 return (tcpSocket->state() == QAbstractSocket::ConnectedState);
180 bool prepareCommunication();
181 void performCommunication();
183 bool isInitialized(
void)
const 185 return (!address.isNull());
187 void performReading(
void);
188 void performWriting(
void);
192 QHostAddress address;
194 QTcpSocket * tcpSocket;
195 bool wait_for_connection_establishment;
196 qint64 end_of_timeout;
197 char readBuffer[120];
199 char writeBuffer[120];
200 char *writeBufferEnd;
204 virtual bool hasKnownPosition(
void)
const 206 return interpolatedPosition.isKnown();
212 void socketConnected(
void);
213 void socketFailed(QAbstractSocket::SocketError socketError);
216 #endif // _TELESCOPE_HPP_ This TelescopeClient class can control a telescope by communicating to a server process ("telescope s...
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
An abstract base class that should never be used directly, only inherited.
Main class for Stellarium core processing.
virtual Vec3d getJ2000EquatorialPos(const StelCore *core) const =0
Get observer-centered equatorial coordinates at equinox J2000.
QString getID() const
Returns a unique identifier for this object.
virtual double getAngularSize(const StelCore *) const
Return the angular radius of a circle containing the object as seen from the observer with the circle...
QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
TelescopeClient supports the following InfoStringGroup flags:
QString getEnglishName(void) const
Return object's name in english.
Vec3d getJ2000EquatorialPos(const StelCore *) const
Get observer-centered equatorial coordinates at equinox J2000.
Vec3f getInfoColor(void) const
Get a color used to display info about the object.
QString getType(void) const
Return object's type. It should be the name of the class.
QString getNameI18n(void) const
Return translated object's name.