Instrument Neutral Distributed Interface INDI  0.9.8
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 <libnova.h>
23 
24 #include "defaultdevice.h"
25 
47 {
48  private:
49 
50  public:
51  Telescope();
52  virtual ~Telescope();
53 
54  enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, SCOPE_PARKING, SCOPE_PARKED };
55  enum TelescopeMotionNS { MOTION_NORTH, MOTION_SOUTH };
56  enum TelescopeMotionWE { MOTION_WEST, MOTION_EAST };
57 
58  virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
59  virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
60  virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
61  virtual void ISGetProperties (const char *dev);
62  virtual bool ISSnoopDevice(XMLEle *root);
63 
65  virtual bool initProperties();
67  virtual bool updateProperties();
68 
70  virtual void TimerHit();
71 
75  virtual bool Connect();
76 
79  virtual bool Disconnect();
80 
87  virtual bool Connect(const char *port);
88 
89  protected:
90 
91  virtual bool saveConfigItems(FILE *fp);
92 
94  void NewRaDec(double ra,double dec);
95 
105  virtual bool ReadScopeStatus()=0;
106 
111  virtual bool Goto(double ra,double dec)=0;
112 
117  virtual bool canSync();
118 
123  virtual bool Sync(double ra,double dec);
124 
129  virtual bool MoveNS(TelescopeMotionNS dir);
130 
135  virtual bool MoveWE(TelescopeMotionWE dir);
136 
141  virtual bool canPark();
142 
147  virtual bool Park();
148 
153  virtual bool Abort()=0;
154 
161  virtual bool updateTime(ln_date *utc, double utc_offset);
162 
170  virtual bool updateLocation(double latitude, double longitude, double elevation);
171 
172  // Since every mount I know of actually uses a serial port for control
173  // We put the serial helper into the base telescope class
174  // One less piece to worry about in the hardware specific
175  // low level stuff
176  int PortFD;
177 
178  // This is a variable filled in by the ReadStatus telescope
179  // low level code, used to report current state
180  // are we slewing, tracking, or parked.
181  TelescopeStatus TrackState;
182 
183  // All telescopes should produce equatorial co-ordinates
185  INumber EqN[2];
186 
187  ISwitchVectorProperty AbortSP; // Abort motion
188  ISwitch AbortS[1];
189 
190  ISwitchVectorProperty CoordSP; // A switch vector that stores how we should readct
191  ISwitch CoordS[3]; // On a coord_set message, sync, or slew
192 
193  ISwitchVectorProperty ConfigSP; // A switch vector that stores how we should readct
194  ISwitch ConfigS[3]; // On a coord_set message, sync, or slew
195 
196  INumberVectorProperty LocationNP; // A number vector that stores lattitude and longitude
197  INumber LocationN[3];
198 
199  ISwitchVectorProperty ParkSP; // A Switch in the client interface to park the scope
200  ISwitch ParkS[1];
201 
202  ITextVectorProperty PortTP; // A text vector that stores out physical port name
203  IText PortT[1];
204 
205  ISwitch MovementNSS[2]; // A switch for North/South motion
206  ISwitchVectorProperty MovementNSSP;
207 
208  ISwitch MovementWES[2]; // A switch for West/East motion
209  ISwitchVectorProperty MovementWESP;
210 
211  INumber ScopeParametersN[4];
212  INumberVectorProperty ScopeParametersNP;
213 
214  IText TimeT[2];
215  ITextVectorProperty TimeTP;
216 
217 };
218 
219 #endif // INDI::Telescope_H