Instrument Neutral Distributed Interface INDI  0.9.9
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  enum TelescopeMotionCommand { MOTION_START, MOTION_STOP };
58 
59  virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
60  virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
61  virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
62  virtual void ISGetProperties (const char *dev);
63  virtual bool ISSnoopDevice(XMLEle *root);
64 
66  virtual bool initProperties();
68  virtual bool updateProperties();
69 
71  virtual void TimerHit();
72 
76  virtual bool Connect();
77 
80  virtual bool Disconnect();
81 
88  virtual bool Connect(const char *port);
89 
90  protected:
91 
92  virtual bool saveConfigItems(FILE *fp);
93 
95  void NewRaDec(double ra,double dec);
96 
106  virtual bool ReadScopeStatus()=0;
107 
112  virtual bool Goto(double ra,double dec)=0;
113 
118  virtual bool canSync();
119 
124  virtual bool Sync(double ra,double dec);
125 
132  virtual bool MoveNS(TelescopeMotionNS dir, TelescopeMotionCommand command);
133 
140  virtual bool MoveWE(TelescopeMotionWE dir, TelescopeMotionCommand command);
141 
146  virtual bool canPark();
147 
152  virtual bool Park();
153 
158  virtual bool Abort()=0;
159 
166  virtual bool updateTime(ln_date *utc, double utc_offset);
167 
175  virtual bool updateLocation(double latitude, double longitude, double elevation);
176 
177  // Since every mount I know of actually uses a serial port for control
178  // We put the serial helper into the base telescope class
179  // One less piece to worry about in the hardware specific
180  // low level stuff
181  int PortFD;
182 
183  // This is a variable filled in by the ReadStatus telescope
184  // low level code, used to report current state
185  // are we slewing, tracking, or parked.
186  TelescopeStatus TrackState;
187 
188  // All telescopes should produce equatorial co-ordinates
190  INumber EqN[2];
191 
192  ISwitchVectorProperty AbortSP; // Abort motion
193  ISwitch AbortS[1];
194 
195  ISwitchVectorProperty CoordSP; // A switch vector that stores how we should readct
196  ISwitch CoordS[3]; // On a coord_set message, sync, or slew
197 
198  INumberVectorProperty LocationNP; // A number vector that stores lattitude and longitude
199  INumber LocationN[3];
200 
201  ISwitchVectorProperty ParkSP; // A Switch in the client interface to park the scope
202  ISwitch ParkS[1];
203 
204  ITextVectorProperty PortTP; // A text vector that stores out physical port name
205  IText PortT[1];
206 
207  ISwitch MovementNSS[2]; // A switch for North/South motion
208  ISwitchVectorProperty MovementNSSP;
209 
210  ISwitch MovementWES[2]; // A switch for West/East motion
211  ISwitchVectorProperty MovementWESP;
212 
213  INumber ScopeParametersN[4];
214  INumberVectorProperty ScopeParametersNP;
215 
216  IText TimeT[2];
217  ITextVectorProperty TimeTP;
218 
219  int last_we_motion, last_ns_motion;
220 
221 };
222 
223 #endif // INDI::Telescope_H
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:93
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
virtual bool Goto(double ra, double dec)=0
Move the scope to the supplied RA and DEC coordinates.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
Class to provide general functionality of a telescope device.
Definition: inditelescope.h:46
One number descriptor.
Definition: indiapi.h:223
virtual void TimerHit()
Called when setTimer() time is up.
virtual bool updateTime(ln_date *utc, double utc_offset)
Update telescope time, date, and UTC offset.
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minumum set of properties are defined t...
virtual bool Sync(double ra, double dec)
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool MoveWE(TelescopeMotionWE dir, TelescopeMotionCommand command)
Move the telescope in the direction dir.
Switch vector property descriptor.
Definition: indiapi.h:290
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
One switch descriptor.
Definition: indiapi.h:279
virtual bool updateProperties()
Called when connected state changes, to add/remove properties.
virtual bool initProperties()
Called to initialize basic properties required all the time.
Number vector property descriptor.
Definition: indiapi.h:251
One text descriptor.
Definition: indiapi.h:177
virtual bool Abort()=0
Abort telescope motion.
virtual bool Disconnect()
Disconnect from telescope.
virtual bool canPark()
Does the mount support park?
virtual bool Park()
Park the telescope to its home position.
virtual bool canSync()
Does the mount support sync?
ISState
Switch state.
Definition: indiapi.h:105
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
virtual bool ReadScopeStatus()=0
Read telescope status. This function checks the following:
virtual bool Connect()
Connect to the telescope.
virtual bool updateLocation(double latitude, double longitude, double elevation)
Update telescope location settings.
Text vector property descriptor.
Definition: indiapi.h:195
virtual bool MoveNS(TelescopeMotionNS dir, TelescopeMotionCommand command)
Start or Stop the telescope motion in the direction dir.