TelescopeClient.cpp   TelescopeClient.cpp 
skipping to change at line 236 skipping to change at line 236
if(address.isNull()) if(address.isNull())
{ {
qWarning() << "ERROR creating TelescopeTCP: cannot find IPv4 address. Addresses found at " << host << ":" << info.addresses(); qWarning() << "ERROR creating TelescopeTCP: cannot find IPv4 address. Addresses found at " << host << ":" << info.addresses();
return; return;
} }
end_of_timeout = -0x8000000000000000LL; end_of_timeout = -0x8000000000000000LL;
interpolatedPosition.reset(); interpolatedPosition.reset();
connect(tcpSocket, SIGNAL(connected()), this, SLOT(socketConnected() ));
connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this , SLOT(socketFailed(QAbstractSocket::SocketError))); connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this , SLOT(socketFailed(QAbstractSocket::SocketError)));
} }
void TelescopeTCP::hangup(void) void TelescopeTCP::hangup(void)
{ {
if (tcpSocket->isValid()) if (tcpSocket->isValid())
{ {
tcpSocket->abort();// Or maybe tcpSocket->close()? tcpSocket->abort();// Or maybe tcpSocket->close()?
} }
skipping to change at line 273 skipping to change at line 274
{ {
const StelCore* core = StelApp::getInstance().getCore(); const StelCore* core = StelApp::getInstance().getCore();
position = core->j2000ToEquinoxEqu(j2000Pos); position = core->j2000ToEquinoxEqu(j2000Pos);
} }
if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeBuffer)) if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeBuffer))
{ {
const double ra_signed = atan2(position[1], position[0]); const double ra_signed = atan2(position[1], position[0]);
//Workaround for the discrepancy in precision between Window s/Linux/PPC Macs and Intel Macs: //Workaround for the discrepancy in precision between Window s/Linux/PPC Macs and Intel Macs:
const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI); const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI);
const double dec = atan2(position[2], sqrt(position[0]*posit ion[0]+position[1]*position[1])); const double dec = atan2(position[2], std::sqrt(position[0]* position[0]+position[1]*position[1]));
unsigned int ra_int = (unsigned int)floor(0.5 + ra*(((unsign ed int)0x80000000)/M_PI)); unsigned int ra_int = (unsigned int)floor(0.5 + ra*(((unsign ed int)0x80000000)/M_PI));
int dec_int = (int)floor(0.5 + dec*(((unsigned int)0x8000000 0)/M_PI)); int dec_int = (int)floor(0.5 + dec*(((unsigned int)0x8000000 0)/M_PI));
// length of packet: // length of packet:
*writeBufferEnd++ = 20; *writeBufferEnd++ = 20;
*writeBufferEnd++ = 0; *writeBufferEnd++ = 0;
// type of packet: // type of packet:
*writeBufferEnd++ = 0; *writeBufferEnd++ = 0;
*writeBufferEnd++ = 0; *writeBufferEnd++ = 0;
// client_micros: // client_micros:
qint64 now = getNow(); qint64 now = getNow();
skipping to change at line 516 skipping to change at line 517
if (tcpSocket->bytesAvailable() > 0) if (tcpSocket->bytesAvailable() > 0)
{ {
//If performReading() is called when there are no by tes to read, //If performReading() is called when there are no by tes to read,
//it closes the connection //it closes the connection
performReading(); performReading();
} }
} }
} }
void TelescopeTCP::socketConnected(void)
{
qDebug() << "TelescopeTCP(" << name <<"): turning off Nagle algorith
m.";
tcpSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
}
//TODO: More informative error messages? //TODO: More informative error messages?
void TelescopeTCP::socketFailed(QAbstractSocket::SocketError) void TelescopeTCP::socketFailed(QAbstractSocket::SocketError)
{ {
qDebug() << "TelescopeTCP(" << name << "): TCP socket error:\n" << t cpSocket->errorString(); qDebug() << "TelescopeTCP(" << name << "): TCP socket error:\n" << t cpSocket->errorString();
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 9 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/