Instrument Neutral Distributed Interface INDI  1.0.0
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 
57  typedef struct
58  {
60  bool canSync;
62  bool canPark;
64  bool canAbort;
66 
70  TelescopeCapability GetTelescopeCapability() const { return capability;}
71 
76  void SetTelescopeCapability(TelescopeCapability * cap);
77 
78  enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, SCOPE_PARKING, SCOPE_PARKED };
79  enum TelescopeMotionNS { MOTION_NORTH, MOTION_SOUTH };
80  enum TelescopeMotionWE { MOTION_WEST, MOTION_EAST };
81  enum TelescopeMotionCommand { MOTION_START, MOTION_STOP };
82 
83  virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
84  virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
85  virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
86  virtual void ISGetProperties (const char *dev);
87  virtual bool ISSnoopDevice(XMLEle *root);
88 
90  virtual bool initProperties();
92  virtual bool updateProperties();
93 
95  virtual void TimerHit();
96 
100  virtual bool Connect();
101 
104  virtual bool Disconnect();
105 
112  virtual bool Connect(const char *port);
113 
114  protected:
115 
116  virtual bool saveConfigItems(FILE *fp);
117 
119  void NewRaDec(double ra,double dec);
120 
130  virtual bool ReadScopeStatus()=0;
131 
136  virtual bool Goto(double ra,double dec)=0;
137 
142  virtual bool Sync(double ra,double dec);
143 
150  virtual bool MoveNS(TelescopeMotionNS dir, TelescopeMotionCommand command);
151 
158  virtual bool MoveWE(TelescopeMotionWE dir, TelescopeMotionCommand command);
159 
164  virtual bool Park();
165 
170  virtual bool Abort()=0;
171 
178  virtual bool updateTime(ln_date *utc, double utc_offset);
179 
187  virtual bool updateLocation(double latitude, double longitude, double elevation);
188 
189  // Since every mount I know of actually uses a serial port for control
190  // We put the serial helper into the base telescope class
191  // One less piece to worry about in the hardware specific
192  // low level stuff
193  int PortFD;
194 
195  // This is a variable filled in by the ReadStatus telescope
196  // low level code, used to report current state
197  // are we slewing, tracking, or parked.
198  TelescopeStatus TrackState;
199 
200  // All telescopes should produce equatorial co-ordinates
202  INumber EqN[2];
203 
204  ISwitchVectorProperty AbortSP; // Abort motion
205  ISwitch AbortS[1];
206 
207  ISwitchVectorProperty CoordSP; // A switch vector that stores how we should readct
208  ISwitch CoordS[3]; // On a coord_set message, sync, or slew
209 
210  INumberVectorProperty LocationNP; // A number vector that stores lattitude and longitude
211  INumber LocationN[3];
212 
213  ISwitchVectorProperty ParkSP; // A Switch in the client interface to park the scope
214  ISwitch ParkS[1];
215 
216  ITextVectorProperty PortTP; // A text vector that stores out physical port name
217  IText PortT[1];
218 
219  ISwitch MovementNSS[2]; // A switch for North/South motion
220  ISwitchVectorProperty MovementNSSP;
221 
222  ISwitch MovementWES[2]; // A switch for West/East motion
223  ISwitchVectorProperty MovementWESP;
224 
225  INumber ScopeParametersN[4];
226  INumberVectorProperty ScopeParametersNP;
227 
228  IText TimeT[2];
229  ITextVectorProperty TimeTP;
230 
231  TelescopeCapability capability;
232  int last_we_motion, last_ns_motion;
233 
234 };
235 
236 #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:224
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:291
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:280
virtual bool updateProperties()
Called when connected state changes, to add/remove properties.
virtual bool initProperties()
Called to initialize basic properties required all the time.
Holds the capabilities of a telescope.
Definition: inditelescope.h:57
Number vector property descriptor.
Definition: indiapi.h:252
One text descriptor.
Definition: indiapi.h:178
virtual bool Abort()=0
Abort telescope motion.
TelescopeCapability GetTelescopeCapability() const
GetTelescopeCapability returns the capability of the Telescope.
Definition: inditelescope.h:70
virtual bool Disconnect()
Disconnect from telescope.
void SetTelescopeCapability(TelescopeCapability *cap)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual bool Park()
Park the telescope to its home position.
ISState
Switch state.
Definition: indiapi.h:106
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:196
virtual bool MoveNS(TelescopeMotionNS dir, TelescopeMotionCommand command)
Start or Stop the telescope motion in the direction dir.