Connection.cpp   Connection.cpp 
/* /*
The stellarium telescope library helps building The stellarium telescope library helps building
telescope server programs, that can communicate with stellarium telescope server programs, that can communicate with stellarium
by means of the stellarium TCP telescope protocol. by means of the stellarium TCP telescope protocol.
It also contains smaple server classes (dummy, Meade LX200). It also contains smaple server classes (dummy, Meade LX200).
Author and Copyright of this file and of the stellarium telescope library: Author and Copyright of this file and of the stellarium telescope library:
Johannes Gajdosik, 2006 Johannes Gajdosik, 2006
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU General Public License
License as published by the Free Software Foundation; either as published by the Free Software Foundation; either version 2
version 2.1 of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
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 GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU General Public License
License along with this library; if not, write to the Free Software along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA USA.
*/ */
#include "Connection.hpp" #include "Connection.hpp"
#include "Server.hpp" #include "Server.hpp"
#include "LogFile.hpp" #include "LogFile.hpp"
using namespace std; using namespace std;
#include <math.h> #include <math.h>
skipping to change at line 75 skipping to change at line 75
dec_sign = '-'; dec_sign = '-';
} }
h = (unsigned int)floor(0.5+h*(24*3600*10000/4294967296.0)); h = (unsigned int)floor(0.5+h*(24*3600*10000/4294967296.0));
const int ra_ms = h % 10000; h /= 10000; const int ra_ms = h % 10000; h /= 10000;
const int ra_s = h % 60; h /= 60; const int ra_s = h % 60; h /= 60;
const int ra_m = h % 60; h /= 60; const int ra_m = h % 60; h /= 60;
h %= 24; h %= 24;
const int dec_ms = d % 1000; d /= 1000; const int dec_ms = d % 1000; d /= 1000;
const int dec_s = d % 60; d /= 60; const int dec_s = d % 60; d /= 60;
const int dec_m = d % 60; d /= 60; const int dec_m = d % 60; d /= 60;
o << "ra = " o << "RA = "
<< qSetPadChar(' ') << qSetFieldWidth(2) << h << 'h' << qSetPadChar(' ')
<< qSetPadChar('0') << qSetFieldWidth(2) << ra_m << 'm' << qSetFieldWidth(2) << h << qSetFieldWidth(0) << 'h'
<< qSetPadChar('0') << qSetFieldWidth(2) << ra_s << '.' << qSetPadChar('0')
<< qSetPadChar('0') << qSetFieldWidth(4) << ra_ms << qSetFieldWidth(2) << ra_m << qSetFieldWidth(0) << 'm'
<< " dec = " << qSetFieldWidth(2) << ra_s << qSetFieldWidth(0) << '.'
<< qSetFieldWidth(4) << ra_ms << qSetFieldWidth(0)
<< " Dec = "
<< ((d<10)?" ":"") << dec_sign << d << 'd' << ((d<10)?" ":"") << dec_sign << d << 'd'
<< qSetPadChar('0') << qSetFieldWidth(2) << dec_m << 'm' << qSetFieldWidth(2) << dec_m << qSetFieldWidth(0) << 'm'
<< qSetPadChar('0') << qSetFieldWidth(2) << dec_s << '.' << qSetFieldWidth(2) << dec_s << qSetFieldWidth(0) << '.'
<< qSetPadChar('0') << qSetFieldWidth(3) << dec_ms << qSetFieldWidth(3) << dec_ms << qSetFieldWidth(0)
<< qSetPadChar(' ') << qSetFieldWidth(0); << qSetPadChar(' ');
return o; return o;
} }
#endif #endif
Connection::Connection(Server &server, SOCKET fd) : Socket(server, fd) Connection::Connection(Server &server, SOCKET fd) : Socket(server, fd)
{ {
read_buff_end = read_buff; read_buff_end = read_buff;
write_buff_end = write_buff; write_buff_end = write_buff;
server_minus_client_time = 0x7FFFFFFFFFFFFFFFLL; server_minus_client_time = 0x7FFFFFFFFFFFFFFFLL;
} }
skipping to change at line 283 skipping to change at line 285
(((unsigned int)(unsigned c har)(p[13])) << 8) | (((unsigned int)(unsigned c har)(p[13])) << 8) |
(((unsigned int)(unsigned c har)(p[14])) << 16) | (((unsigned int)(unsigned c har)(p[14])) << 16) |
(((unsigned int)(unsigned c har)(p[15])) << 24); (((unsigned int)(unsigned c har)(p[15])) << 24);
const int dec_int = const int dec_int =
(int)( ((unsigned int)(unsigned c har)(p[16])) | (int)( ((unsigned int)(unsigned c har)(p[16])) |
(((unsigned int)(unsigned c har)(p[17])) << 8) | (((unsigned int)(unsigned c har)(p[17])) << 8) |
(((unsigned int)(unsigned c har)(p[18])) << 16) | (((unsigned int)(unsigned c har)(p[18])) << 16) |
(((unsigned int)(unsigned c har)(p[19])) << 24) ); (((unsigned int)(unsigned c har)(p[19])) << 24) );
#ifdef DEBUG5 #ifdef DEBUG5
*log_file << Now() << "Connection::dataRecei ved: " *log_file << Now() << "Connection::dataRecei ved: "
<< PrintRaDec(ra_int,dec_ int) << PrintRaDec(ra_int, dec _int)
<< endl; << endl;
#endif #endif
server.gotoReceived(ra_int, dec_int); server.gotoReceived(ra_int, dec_int);
} }
break; break;
default: default:
//No other types of commands are acceptable at the m oment //No other types of commands are acceptable at the m oment
*log_file << Now() *log_file << Now()
 End of changes. 6 change blocks. 
20 lines changed or deleted 22 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/