Instrument Neutral Distributed Interface INDI  0.9.6
inditelescope.h
1 /*******************************************************************************
2  Copyright(c) 2011 Gerry Rozema, Jasem Mutlaq. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 *******************************************************************************/
18 
19 #ifndef INDI_TELESCOPE_H
20 #define INDI_TELESCOPE_H
21 
22 #include "defaultdevice.h"
23 
45 {
46  private:
47 
48  public:
49  Telescope();
50  virtual ~Telescope();
51 
52  enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, SCOPE_PARKING, SCOPE_PARKED };
53  enum TelescopeMotionNS { MOTION_NORTH, MOTION_SOUTH };
54  enum TelescopeMotionWE { MOTION_WEST, MOTION_EAST };
55 
56  virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
57  virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
58  virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
59  virtual void ISGetProperties (const char *dev);
60 
62  virtual bool initProperties();
64  virtual bool updateProperties();
65 
67  virtual void TimerHit();
68 
72  virtual bool Connect();
73 
76  virtual bool Disconnect();
77 
84  virtual bool Connect(const char *port);
85 
86  protected:
87 
88  virtual bool saveConfigItems(FILE *fp);
89 
91  void NewRaDec(double ra,double dec);
92 
102  virtual bool ReadScopeStatus()=0;
103 
108  virtual bool Goto(double ra,double dec)=0;
109 
114  virtual bool canSync();
115 
120  virtual bool Sync(double ra,double dec);
121 
126  virtual bool MoveNS(TelescopeMotionNS dir);
127 
132  virtual bool MoveWE(TelescopeMotionWE dir);
133 
138  virtual bool canPark();
139 
144  virtual bool Park();
145 
150  virtual bool Abort()=0;
151 
152  // Since every mount I know of actually uses a serial port for control
153  // We put the serial helper into the base telescope class
154  // One less piece to worry about in the hardware specific
155  // low level stuff
156  int PortFD;
157 
158  // This is a variable filled in by the ReadStatus telescope
159  // low level code, used to report current state
160  // are we slewing, tracking, or parked.
161  TelescopeStatus TrackState;
162 
163  // All telescopes should produce equatorial co-ordinates
165  INumber EqN[2];
166 
167  ISwitchVectorProperty AbortSV; // Abort motion
168  ISwitch AbortS[1];
169 
170  ISwitchVectorProperty CoordSV; // A switch vector that stores how we should readct
171  ISwitch CoordS[3]; // On a coord_set message, sync, or slew
172 
173  ISwitchVectorProperty ConfigSV; // A switch vector that stores how we should readct
174  ISwitch ConfigS[3]; // On a coord_set message, sync, or slew
175 
176  INumberVectorProperty LocationNV; // A number vector that stores lattitude and longitude
177  INumber LocationN[2];
178 
179  ISwitchVectorProperty ParkSV; // A Switch in the client interface to park the scope
180  ISwitch ParkS[1];
181 
182  ITextVectorProperty PortTP; // A text vector that stores out physical port name
183  IText PortT[1];
184 
185  ISwitch MovementNSS[2]; // A switch for North/South motion
186  ISwitchVectorProperty MovementNSSP;
187 
188  ISwitch MovementWES[2]; // A switch for West/East motion
189  ISwitchVectorProperty MovementWESP;
190 
191  INumber ScopeParametersN[4];
192  INumberVectorProperty ScopeParametersNP;
193 
194 };
195 
196 #endif // INDI::Telescope_H