TelescopeClient.hpp   TelescopeClient.hpp 
skipping to change at line 37 skipping to change at line 37
#define _TELESCOPE_HPP_ #define _TELESCOPE_HPP_
#include <QHostAddress> #include <QHostAddress>
#include <QHostInfo> #include <QHostInfo>
#include <QList> #include <QList>
#include <QString> #include <QString>
#include <QTcpSocket> #include <QTcpSocket>
#include <QObject> #include <QObject>
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" //Needed for getting StelNavigator instances
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelNavigator.hpp" #include "StelNavigator.hpp"
#include "InterpolatedPosition.hpp"
qint64 getNow(void); qint64 getNow(void);
enum Equinox {
EquinoxJ2000,
EquinoxJNow
};
//! An abstract base class that should never be used directly, only inherit ed. //! An abstract base class that should never be used directly, only inherit ed.
//! This class used to be called Telescope, but it has been renamed //! This class used to be called Telescope, but it has been renamed
//! to TelescopeClient in order to resolve a compiler/linker conflict //! to TelescopeClient in order to resolve a compiler/linker conflict
//! with the identically named Telescope class in Stellarium's main code. //! with the identically named Telescope class in Stellarium's main code.
class TelescopeClient : public QObject, public StelObject class TelescopeClient : public QObject, public StelObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static TelescopeClient *create(const QString &url); static TelescopeClient *create(const QString &url);
virtual ~TelescopeClient(void) {} virtual ~TelescopeClient(void) {}
skipping to change at line 142 skipping to change at line 149
Vec3d getJ2000EquatorialPos(const StelNavigator*) const Vec3d getJ2000EquatorialPos(const StelNavigator*) const
{ {
return XYZ; return XYZ;
} }
private: private:
Vec3d XYZ; // j2000 position Vec3d XYZ; // j2000 position
Vec3d desired_pos; Vec3d desired_pos;
}; };
//! A telescope's position at a given time.
//! This structure used to be defined inline in TelescopeTCP.
struct Position
{
qint64 server_micros;
qint64 client_micros;
Vec3d pos;
int status;
};
//! This TelescopeClient class can controll a telescope by communicating //! This TelescopeClient class can controll a telescope by communicating
//! to a server process ("telescope server") via //! to a server process ("telescope server") via
//! the "Stellarium telescope control protocol" over TCP/IP. //! the "Stellarium telescope control protocol" over TCP/IP.
//! The "Stellarium telescope control protocol" is specified in a seperate //! The "Stellarium telescope control protocol" is specified in a seperate
//! document along with the telescope server software. //! document along with the telescope server software.
class TelescopeTCP : public TelescopeClient class TelescopeTCP : public TelescopeClient
{ {
Q_OBJECT Q_OBJECT
public: public:
TelescopeTCP(const QString &name,const QString &params); TelescopeTCP(const QString &name, const QString &params, Equinox eq = EquinoxJ2000);
~TelescopeTCP(void) ~TelescopeTCP(void)
{ {
hangup(); hangup();
} }
bool isConnected(void) const bool isConnected(void) const
{ {
//return (tcpSocket->isValid() && !wait_for_connection_estab lishment); //return (tcpSocket->isValid() && !wait_for_connection_estab lishment);
return (tcpSocket->state() == QAbstractSocket::ConnectedStat e); return (tcpSocket->state() == QAbstractSocket::ConnectedStat e);
} }
skipping to change at line 186 skipping to change at line 183
void telescopeGoto(const Vec3d &j2000Pos); void telescopeGoto(const Vec3d &j2000Pos);
bool isInitialized(void) const bool isInitialized(void) const
{ {
return (!address.isNull()); return (!address.isNull());
} }
void performReading(void); void performReading(void);
void performWriting(void); void performWriting(void);
private: private:
void hangup(void); void hangup(void);
void resetPositions(void);
QHostAddress address; QHostAddress address;
unsigned int port; unsigned int port;
QTcpSocket * tcpSocket; QTcpSocket * tcpSocket;
bool wait_for_connection_establishment; bool wait_for_connection_establishment;
qint64 end_of_timeout; qint64 end_of_timeout;
char readBuffer[120]; char readBuffer[120];
char *readBufferEnd; char *readBufferEnd;
char writeBuffer[120]; char writeBuffer[120];
char *writeBufferEnd; char *writeBufferEnd;
int time_delay; int time_delay;
Position positions[16]; InterpolatedPosition interpolatedPosition;
Position *position_pointer;
Position *const end_position;
virtual bool hasKnownPosition(void) const virtual bool hasKnownPosition(void) const
{ {
return (position_pointer->client_micros != 0x7FFFFFFFFFFFFFF FLL); return interpolatedPosition.isKnown();
} }
Equinox equinox;
private slots: private slots:
void socketFailed(QAbstractSocket::SocketError socketError); void socketFailed(QAbstractSocket::SocketError socketError);
}; };
#endif // _TELESCOPE_HPP_ #endif // _TELESCOPE_HPP_
 End of changes. 9 change blocks. 
16 lines changed or deleted 12 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/