TelescopeClient.cpp   TelescopeClient.cpp 
skipping to change at line 27 skipping to change at line 27
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "TelescopeClient.hpp" #include "TelescopeClient.hpp"
#include "TelescopeClientJsonRts2.hpp"
#include "TelescopeClientDirectLx200.hpp" #include "TelescopeClientDirectLx200.hpp"
#include "TelescopeClientDirectNexStar.hpp" #include "TelescopeClientDirectNexStar.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include <cmath> #include <cmath>
#include <QDebug> #include <QDebug>
#include <QHostAddress> #include <QHostAddress>
skipping to change at line 49 skipping to change at line 50
#include <QString> #include <QString>
#include <QTcpSocket> #include <QTcpSocket>
#include <QTextStream> #include <QTextStream>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> // GetSystemTimeAsFileTime() #include <windows.h> // GetSystemTimeAsFileTime()
#else #else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
const QString TelescopeClient::TELESCOPECLIENT_TYPE = QStringLiteral("Teles
cope");
TelescopeClient *TelescopeClient::create(const QString &url) TelescopeClient *TelescopeClient::create(const QString &url)
{ {
// example url: My_first_telescope:TCP:J2000:localhost:10000:500000 // example url: My_first_telescope:TCP:J2000:localhost:10000:500000
// split to: // split to:
// name = My_first_telescope // name = My_first_telescope
// type = TCP // type = TCP
// equinox = J2000 // equinox = J2000
// params = localhost:10000:500000 // params = localhost:10000:500000
// //
// The params part is optional. We will use QRegExp to validate // The params part is optional. We will use QRegExp to validate
skipping to change at line 75 skipping to change at line 78
{ {
// trimmed removes whitespace on either end of a QString // trimmed removes whitespace on either end of a QString
name = urlSchema.capturedTexts().at(1).trimmed(); name = urlSchema.capturedTexts().at(1).trimmed();
type = urlSchema.capturedTexts().at(2).trimmed(); type = urlSchema.capturedTexts().at(2).trimmed();
equinox = urlSchema.capturedTexts().at(3).trimmed(); equinox = urlSchema.capturedTexts().at(3).trimmed();
params = urlSchema.capturedTexts().at(4).trimmed(); params = urlSchema.capturedTexts().at(4).trimmed();
} }
else else
{ {
qWarning() << "WARNING - telescope definition" << url << "no t recognised"; qWarning() << "WARNING - telescope definition" << url << "no t recognised";
return NULL; return Q_NULLPTR;
} }
Equinox eq = EquinoxJ2000; Equinox eq = EquinoxJ2000;
if (equinox == "JNow") if (equinox == "JNow")
eq = EquinoxJNow; eq = EquinoxJNow;
qDebug() << "Creating telescope" << url << "; name/type/equinox/para ms:" << name << type << ((eq == EquinoxJNow) ? "JNow" : "J2000") << params; qDebug() << "Creating telescope" << url << "; name/type/equinox/para ms:" << name << type << ((eq == EquinoxJNow) ? "JNow" : "J2000") << params;
TelescopeClient * newTelescope = 0; TelescopeClient * newTelescope = Q_NULLPTR;
//if (type == "Dummy") //if (type == "Dummy")
if (type == "TelescopeServerDummy") if (type == "TelescopeServerDummy")
{ {
newTelescope = new TelescopeClientDummy(name, params); newTelescope = new TelescopeClientDummy(name, params);
} }
else if (type == "TCP") else if (type == "TCP")
{ {
newTelescope = new TelescopeTCP(name, params, eq); newTelescope = new TelescopeTCP(name, params, eq);
} }
else if (type == "RTS2")
{
newTelescope = new TelescopeClientJsonRts2(name, params, eq)
;
}
else if (type == "TelescopeServerLx200") //BM: One of the rare occas ions of painless extension else if (type == "TelescopeServerLx200") //BM: One of the rare occas ions of painless extension
{ {
newTelescope= new TelescopeClientDirectLx200(name, params, e q); newTelescope= new TelescopeClientDirectLx200(name, params, e q);
} }
else if (type == "TelescopeServerNexStar") else if (type == "TelescopeServerNexStar")
{ {
newTelescope= new TelescopeClientDirectNexStar(name, params, eq); newTelescope= new TelescopeClientDirectNexStar(name, params, eq);
} }
else else
{ {
skipping to change at line 133 skipping to change at line 140
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << nameI18n << "</h2>"; oss << "<h2>" << nameI18n << "</h2>";
} }
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
oss << getTelescopeInfoString(core, flags);
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
//! returns the current system time in microseconds since the Epoch //! returns the current system time in microseconds since the Epoch
//! Prior to revision 6308, it was necessary to put put this method in an //! Prior to revision 6308, it was necessary to put put this method in an
//! #ifdef block, as duplicate function definition caused errors during sta tic //! #ifdef block, as duplicate function definition caused errors during sta tic
//! linking. //! linking.
qint64 getNow(void) qint64 getNow(void)
skipping to change at line 259 skipping to change at line 268
readBufferEnd = readBuffer; readBufferEnd = readBuffer;
writeBufferEnd = writeBuffer; writeBufferEnd = writeBuffer;
wait_for_connection_establishment = false; wait_for_connection_establishment = false;
interpolatedPosition.reset(); interpolatedPosition.reset();
} }
//! queues a GOTO command with the specified position to the write buffer. //! queues a GOTO command with the specified position to the write buffer.
//! For the data format of the command see the //! For the data format of the command see the
//! "Stellarium telescope control protocol" text file //! "Stellarium telescope control protocol" text file
void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos) void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectO bject)
{ {
Q_UNUSED(selectObject);
if (!isConnected()) if (!isConnected())
return; return;
Vec3d position = j2000Pos; Vec3d position = j2000Pos;
if (equinox == EquinoxJNow) if (equinox == EquinoxJNow)
{ {
const StelCore* core = StelApp::getInstance().getCore(); const StelCore* core = StelApp::getInstance().getCore();
position = core->j2000ToEquinoxEqu(j2000Pos, StelCore::Refra ctionOff); position = core->j2000ToEquinoxEqu(j2000Pos, StelCore::Refra ctionOff);
} }
 End of changes. 8 change blocks. 
3 lines changed or deleted 16 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/