1 | /******************************************************************************* |
---|
2 | Copyright(c) 2010 Gerry Rozema. All rights reserved. |
---|
3 | |
---|
4 | This program is free software; you can redistribute it and/or modify it |
---|
5 | under the terms of the GNU General Public License as published by the Free |
---|
6 | Software Foundation; either version 2 of the License, or (at your option) |
---|
7 | any later version. |
---|
8 | |
---|
9 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License along with |
---|
15 | this program; if not, write to the Free Software Foundation, Inc., 59 |
---|
16 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | |
---|
18 | The full GNU General Public License is included in this distribution in the |
---|
19 | file called LICENSE. |
---|
20 | *******************************************************************************/ |
---|
21 | |
---|
22 | #ifndef INDI_TELESCOPE_H |
---|
23 | #define INDI_TELESCOPE_H |
---|
24 | |
---|
25 | #include "defaultdriver.h" |
---|
26 | |
---|
27 | class INDI::Telescope : public INDI::DefaultDriver |
---|
28 | { |
---|
29 | protected: |
---|
30 | //bool Connected; |
---|
31 | |
---|
32 | private: |
---|
33 | |
---|
34 | public: |
---|
35 | Telescope(); |
---|
36 | virtual ~Telescope(); |
---|
37 | |
---|
38 | enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, SCOPE_PARKING, SCOPE_PARKED }; |
---|
39 | |
---|
40 | // All telescopes should produce equatorial co-ordinates |
---|
41 | INumberVectorProperty *EqNV; |
---|
42 | INumber EqN[2]; |
---|
43 | |
---|
44 | // And we need a vector to store requests, ie, where are we asked to go |
---|
45 | INumberVectorProperty *EqReqNV; |
---|
46 | INumber EqReqN[2]; |
---|
47 | |
---|
48 | ISwitchVectorProperty *CoordSV; // A switch vector that stores how we should readct |
---|
49 | ISwitch CoordS[3]; // On a coord_set message, sync, or slew |
---|
50 | |
---|
51 | INumberVectorProperty *LocationNV; // A number vector that stores lattitude and longitude |
---|
52 | INumber LocationN[2]; |
---|
53 | |
---|
54 | ISwitchVectorProperty *ParkSV; // A Switch in the client interface to park the scope |
---|
55 | ISwitch ParkS[1]; |
---|
56 | |
---|
57 | // I dont know of any telescopes that dont |
---|
58 | // need a port for connection |
---|
59 | // So lets put all the port connect framework |
---|
60 | // into our generic telescope super class |
---|
61 | ITextVectorProperty *PortTV; // A text vector that stores out physical port name |
---|
62 | IText PortT[1]; |
---|
63 | |
---|
64 | |
---|
65 | // Ok, we do need our virtual functions from the base class for processing |
---|
66 | // client requests |
---|
67 | // We process numbers,switches and text in the telescope |
---|
68 | // These are the base IndiDevice overrides we process |
---|
69 | virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); |
---|
70 | virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n); |
---|
71 | virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n); |
---|
72 | virtual void ISGetProperties (const char *dev); |
---|
73 | |
---|
74 | // overrides of base class virtual functions |
---|
75 | // that are specific to our way of implementing Indi |
---|
76 | virtual bool initProperties(); // Called to initialize basic properties required all the time |
---|
77 | virtual bool updateProperties(); // Called when connected state changes, to add/remove properties |
---|
78 | |
---|
79 | virtual void TimerHit(); |
---|
80 | virtual bool Connect(); |
---|
81 | virtual bool Disconnect(); |
---|
82 | |
---|
83 | virtual bool Connect(const char *); |
---|
84 | |
---|
85 | |
---|
86 | // Since every mount I know of actually uses a serial port for control |
---|
87 | // We put the serial helper into the base telescope class |
---|
88 | // One less piece to worry about in the hardware specific |
---|
89 | // low level stuff |
---|
90 | int PortFD; |
---|
91 | |
---|
92 | |
---|
93 | // This is a variable filled in by the ReadStatus telescope |
---|
94 | // low level code, used to report current state |
---|
95 | // are we slewing, tracking, or parked. |
---|
96 | int TrackState; |
---|
97 | |
---|
98 | |
---|
99 | // These functions are telescope specific |
---|
100 | // and meant to make life really easy for deriving |
---|
101 | // hardware specific telescope classes |
---|
102 | int NewRaDec(double,double); // The child class will call this when it has updates |
---|
103 | |
---|
104 | |
---|
105 | // And these are the hardware specific functions our children need to override |
---|
106 | // They are not pure virtual, because, not all functions are relavent for all types |
---|
107 | // of mount, ie, a Goto is not relavent for a Push-to mount |
---|
108 | |
---|
109 | /** \brief Read telescope status. |
---|
110 | This function checks the following: |
---|
111 | <ol> |
---|
112 | <li>Check if the link to the telescope is alive.</li> |
---|
113 | <li>Update telescope status: Idle, Slewing, Parking..etc.</li> |
---|
114 | <li>Read coordinates</li> |
---|
115 | </ol> |
---|
116 | \return True if reading scope status is OK, false if an error is encounterd. */ |
---|
117 | virtual bool ReadScopeStatus(); |
---|
118 | |
---|
119 | virtual bool Goto(double ra,double dec); |
---|
120 | virtual bool Sync(double ra,double dec); |
---|
121 | virtual bool Park(); |
---|
122 | |
---|
123 | }; |
---|
124 | |
---|
125 | #endif // INDI::Telescope_H |
---|