Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/Lx200Command_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:44:31 2014
Кодировка:

Поисковые слова: m 17
Stellarium: /home/aw/devel/stellarium/trunk/plugins/TelescopeControl/src/servers/Lx200Command.hpp Source File
Stellarium 0.12.3
Lx200Command.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 
26 #ifndef _LX200_COMMAND_HPP_
27 #define _LX200_COMMAND_HPP_
28 
29 #include <QTextStream>
30 using namespace std;
31 
32 class Server;
34 
37 {
38 public:
39  virtual ~Lx200Command(void) {}
40  virtual bool writeCommandToBuffer(char *&buff, char *end) = 0;
41  bool hasBeenWrittenToBuffer(void) const {return has_been_written_to_buffer;}
42  virtual int readAnswerFromBuffer(const char *&buff, const char *end) = 0;
43  virtual bool needsNoAnswer(void) const {return false;}
44  virtual void print(QTextStream &o) const = 0;
45  virtual bool isCommandGotoSelected(void) const {return false;}
46  virtual bool shortAnswerReceived(void) const {return false;}
47  //returns true when reading is finished
48 
49 protected:
50  Lx200Command(Server &server);
52  bool has_been_written_to_buffer;
53 };
54 
55 inline QTextStream &operator<<(QTextStream &o, const Lx200Command &c)
56 {
57  c.print(o);
58  return o;
59 }
60 
64 {
65 public:
66  Lx200CommandToggleFormat(Server &server) : Lx200Command(server) {}
67 
68 private:
69  bool writeCommandToBuffer(char *&buff, char *end);
70  int readAnswerFromBuffer(const char*&, const char*) {return 1;}
71  bool needsNoAnswer(void) const {return true;}
72  void print(QTextStream &o) const;
73 };
74 
78 {
79 public:
80  Lx200CommandStopSlew(Server &server) : Lx200Command(server) {}
81 
82 private:
83  bool writeCommandToBuffer(char *&buff, char *end);
84  int readAnswerFromBuffer(const char*&, const char*) {return 1;}
85  bool needsNoAnswer(void) const {return true;}
86  void print(QTextStream &o) const;
87 };
88 
91 {
92 public:
93  Lx200CommandSetSelectedRa(Server &server, int ra)
94  : Lx200Command(server), ra(ra) {}
95  bool writeCommandToBuffer(char *&buff, char *end);
96  int readAnswerFromBuffer(const char *&buff, const char *end);
97  void print(QTextStream &o) const;
98 
99 private:
100  const int ra;
101 };
102 
105 {
106 public:
107  Lx200CommandSetSelectedDec(Server &server,int dec)
108  : Lx200Command(server), dec(dec) {}
109  bool writeCommandToBuffer(char *&buff, char *end);
110  int readAnswerFromBuffer(const char *&buff, const char *end);
111  void print(QTextStream &o) const;
112 
113 private:
114  const int dec;
115 };
116 
119 {
120 public:
122  : Lx200Command(server), first_byte(256) {}
123  bool writeCommandToBuffer(char *&buff, char *end);
124  int readAnswerFromBuffer(const char *&buff, const char *end);
125  void print(QTextStream &o) const;
126  bool isCommandGotoSelected(void) const {return true;}
127  bool shortAnswerReceived(void) const {return (first_byte != 256);}
128 
129 private:
130  int first_byte;
131 };
132 
135 {
136 public:
137  Lx200CommandGetRa(Server &server) : Lx200Command(server) {}
138  bool writeCommandToBuffer(char *&buff, char *end);
139  int readAnswerFromBuffer(const char *&buff, const char *end);
140  void print(QTextStream &o) const;
141 };
142 
145 {
146 public:
147  Lx200CommandGetDec(Server &server) : Lx200Command(server) {}
148  bool writeCommandToBuffer(char *&buff, char *end);
149  int readAnswerFromBuffer(const char *&buff, const char *end);
150  void print(QTextStream &o) const;
151 };
152 
153 #endif //_LX200_COMMAND_HPP_