Stellarium  0.90.0
Lx200Connection.hpp
1 /*
2 The stellarium telescope library helps building
3 telescope server programs, that can communicate with stellarium
4 by means of the stellarium TCP telescope protocol.
5 It also contains smaple server classes (dummy, Meade LX200).
6 
7 Author and Copyright of this file and of the stellarium telescope library:
8 Johannes Gajdosik, 2006
9 
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 as published by the Free Software Foundation; either version 2
13 of the License, or (at your option) any later version.
14 
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
23 */
24 
25 #ifndef _LX200_CONNECTION_HPP_
26 #define _LX200_CONNECTION_HPP_
27 
28 #include "SerialPort.hpp"
29 
30 #include <list>
31 using namespace std;
32 
33 class Lx200Command;
34 
37 {
38 public:
39  Lx200Connection(Server &server, const char *serial_device);
40  void sendGoto(unsigned int ra_int, int dec_int);
41  void sendCommand(Lx200Command * command);
42  void setTimeBetweenCommands(long long int micro_seconds)
43  {
44  time_between_commands = micro_seconds;
45  }
46 
47 private:
49  void dataReceived(const char *&p, const char *read_buff_end);
51  void sendPosition(unsigned int ra_int, int dec_int, int status) {Q_UNUSED(ra_int); Q_UNUSED(dec_int); Q_UNUSED(status);}
52  void resetCommunication(void);
53  void prepareSelectFds(fd_set &read_fds, fd_set &write_fds, int &fd_max);
54  bool writeFrontCommandToBuffer(void);
59  void flushCommandList(void);
60 
61 private:
62  list<Lx200Command*> command_list;
63  long long int time_between_commands;
64  long long int next_send_time;
65  long long int read_timeout_endtime;
66  int goto_commands_queued;
67 };
68 
69 #endif //_LX200_CONNECTION_HPP_
Base class for telescope server classes.
Definition: Server.hpp:45
STL namespace.
Serial port connection to a Meade LX200 or a compatible telescope.
Abstract base class for Meade LX200 (and compatible) commands.
Serial interface connection.
Definition: SerialPort.hpp:37