moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / indi / apmount.h
blob15aee22c3d28df6a2f5faa3110b1dd4a0355883c
1 /*
2 Astro-Physics driver
3 Copyright (C) 2005 Jasem Mutlaq (mutlaqja@ikarustech.com)
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef ASTROPHYSICS_H
22 #define ASTROPHYSICS_H
24 #include "indidevapi.h"
25 #include "indicom.h"
27 #define POLLMS 1000 /* poll period, ms */
28 #define mydev "Astro-Physics" /* The device name */
32 /* equatorial position */
34 // N.B. No Static identifier as it is needed for external linkage
38 class APMount
40 public:
41 APMount();
42 ~APMount();
44 void ISGetProperties (const char *dev);
45 void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
46 void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
47 void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
48 void ISPoll ();
50 void connectionLost();
51 void connectionResumed();
53 private:
55 void initProperties();
57 /* Switches */
58 ISwitch AlignmentS [2];
59 ISwitch PowerS[2];
60 ISwitch OnCoordSetS[3];
61 ISwitch TrackModeS[4];
62 ISwitch AbortSlewS[1];
63 ISwitch ParkS[2];
64 ISwitch MovementS[4];
65 ISwitch FocusSpeedS[3];
66 ISwitch FocusMotionS[2];
68 /* Texts */
69 IText PortT[1];
70 IText UTCT[1];
72 /* Numbers */
73 INumber EqN[2];
74 INumber GeoN[2];
75 INumber FocusTimerN[1];
76 INumber SDTimeN[1];
78 /* Switch Vectors */
79 ISwitchVectorProperty PowerSP;
80 ISwitchVectorProperty AlignmentSP;
81 ISwitchVectorProperty OnCoordSetSP;
82 ISwitchVectorProperty AbortSlewSP;
83 ISwitchVectorProperty ParkSP;
84 ISwitchVectorProperty TrackModeSP;
85 ISwitchVectorProperty MovementSP;
86 ISwitchVectorProperty FocusSpeedSP;
87 ISwitchVectorProperty FocusMotionSP;
89 /* Number Vectors */
90 INumberVectorProperty EqNP;
91 INumberVectorProperty GeoNP;
92 INumberVectorProperty FocusTimerNP;
93 INumberVectorProperty SDTimeNP;
95 /* Text Vectors */
96 ITextVectorProperty PortTP;
97 ITextVectorProperty TimeTP;
99 void getBasicData();
100 int checkPower(INumberVectorProperty *np);
101 int checkPower(ISwitchVectorProperty *sp);
102 int checkPower(ITextVectorProperty *tp);
103 void handleError(ISwitchVectorProperty *svp, int err, const char *msg);
104 void handleError(INumberVectorProperty *nvp, int err, const char *msg);
105 void handleError(ITextVectorProperty *tvp, int err, const char *msg);
106 bool isTelescopeOn(void);
107 void powerTelescope();
108 void slewError(int slewCode);
109 void getAlignment();
110 int handleCoordSet();
111 int getOnSwitch(ISwitchVectorProperty *sp);
112 void correctFault();
113 void enableSimulation(bool enable);
114 void updateTime();
115 void updateLocation();
118 protected:
119 int timeFormat;
120 int currentSiteNum;
121 int trackingMode;
123 double JD;
124 double targetRA;
125 double targetDEC;
126 double lastRA;
127 double lastDEC;
128 double UTCOffset;
129 bool fault;
130 bool simulation;
132 struct tm *localTM;
134 int currentSet;
135 int lastSet;
136 int lastMove[4];
140 #endif