moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / indi / lx200driver.h
blob5f08291a74f0431e12b1be8c7b599e405d28c107
1 /*
2 LX200 Driver
3 Copyright (C) 2003 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 LX200DRIVER_H
22 #define LX200DRIVER_H
24 /* Slew speeds */
25 enum TSlew { LX200_SLEW_MAX, LX200_SLEW_FIND, LX200_SLEW_CENTER, LX200_SLEW_GUIDE};
26 /* Alignment modes */
27 enum TAlign { LX200_ALIGN_POLAR, LX200_ALIGN_ALTAZ, LX200_ALIGN_LAND };
28 /* Directions */
29 enum TDirection { LX200_NORTH, LX200_WEST, LX200_EAST, LX200_SOUTH, LX200_ALL};
30 /* Formats of Right ascention and Declenation */
31 enum TFormat { LX200_FORMAT_SHORT, LX200_FORMAT_LONG};
32 /* Time Format */
33 enum TTimeFormat { LX200_24, LX200_AM, LX200_PM};
34 /* Focus operation */
35 enum TFocusMotion { LX200_FOCUSIN, LX200_FOCUSOUT };
36 enum TFocusSpeed { LX200_HALTFOCUS, LX200_FOCUSFAST, LX200_FOCUSMEDIUM, LX200_FOCUSSLOW };
37 /* Library catalogs */
38 enum TCatalog { LX200_STAR_C, LX200_DEEPSKY_C};
39 /* Frequency mode */
40 enum StarCatalog { LX200_STAR, LX200_SAO, LX200_GCVS };
41 /* Deep Sky Catalogs */
42 enum DeepSkyCatalog { LX200_NGC, LX200_IC, LX200_UGC, LX200_CALDWELL, LX200_ARP, LX200_ABELL, LX200_MESSIER_C};
43 /* Mount tracking frequency, in Hz */
44 enum TFreq { LX200_TRACK_DEFAULT, LX200_TRACK_LUNAR, LX200_TRACK_MANUAL};
46 #define MaxReticleDutyCycle 15
47 #define MaxFocuserSpeed 4
49 /* GET formatted sexagisemal value from device, return as double */
50 #define getLX200RA(x) getCommandSexa(x, "#:GR#")
51 #define getLX200DEC(x) getCommandSexa(x, "#:GD#")
52 #define getObjectRA(x) getCommandSexa(x, "#:Gr#")
53 #define getObjectDEC(x) getCommandSexa(x, "#:Gd#")
54 #define getLocalTime12(x) getCommandSexa(x, "#:Ga#")
55 #define getLocalTime24(x) getCommandSexa(x, "#:GL#")
56 #define getSDTime(x) getCommandSexa(x, "#:GS#")
57 #define getLX200Alt(x) getCommandSexa(x, "#:GA#")
58 #define getLX200Az(x) getCommandSexa(x, "#:GZ#")
60 /* GET String from device and store in supplied buffer x */
61 #define getObjectInfo(x) getCommandString(x, "#:LI#")
62 #define getVersionDate(x) getCommandString(x, "#:GVD#")
63 #define getVersionTime(x) getCommandString(x, "#:GVT#")
64 #define getFullVersion(x) getCommandString(x, "#:GVF#")
65 #define getVersionNumber(x) getCommandString(x, "#:GVN#")
66 #define getProductName(x) getCommandString(x, "#:GVP#")
67 #define turnGPS_StreamOn() getCommandString(x, "#:gps#")
69 /* GET Int from device and store in supplied pointer to integer x */
70 #define getUTCOffset(x) getCommandInt(x, "#:GG#")
71 #define getMaxElevationLimit(x) getCommandInt(x, "#:Go#")
72 #define getMinElevationLimit(x) getCommandInt(x, "#:Gh#")
74 /* Generic set, x is an integer */
75 #define setReticleDutyFlashCycle(x) setCommandInt(x, "#:BD")
76 #define setReticleFlashRate(x) setCommandInt(x, "#:B")
77 #define setFocuserSpeed(x) setCommandInt(x, "#:F")
78 #define setSlewSpeed(x) setCommandInt(x, "#:Sw")
80 /* Set X:Y:Z */
81 #define setLocalTime(x,y,z) setCommandXYZ(x,y,z, "#:SL")
82 #define setSDTime(x,y,z) setCommandXYZ(x,y,z, "#:SS")
84 /* GPS Specefic */
85 #define turnGPSOn() portWrite("#:g+#")
86 #define turnGPSOff() portWrite("#:g-#")
87 #define alignGPSScope() portWrite("#:Aa#")
88 #define gpsSleep() portWrite("#:hN#")
89 #define gpsWakeUp() portWrite("#:hW#")
90 #define gpsRestart() portWrite("#:I#")
91 #define updateGPS_System() setStandardProcedure("#:gT#")
92 #define enableDecAltPec() portWrite("#:QA+#")
93 #define disableDecAltPec() portWrite("#:QA-#")
94 #define enableRaAzPec() portWrite("#:QZ+#")
95 #define disableRaAzPec() portWrite("#:QZ-#")
96 #define activateAltDecAntiBackSlash() portWrite("#$BAdd#")
97 #define activateAzRaAntiBackSlash() portWrite("#$BZdd#")
98 #define SelenographicSync() portWrite("#:CL#")
100 #define slewToAltAz() setStandardProcedure("#:MA#")
101 #define toggleTimeFormat() portWrite("#:H#")
102 #define increaseReticleBrightness() portWrite("#:B+#")
103 #define decreaseReticleBrightness() portWrite("#:B-#")
104 #define turnFanOn() portWrite("#:f+#")
105 #define turnFanOff() portWrite("#:f-#")
106 #define seekHomeAndSave() portWrite("#:hS#")
107 #define seekHomeAndSet() portWrite("#:hF#")
108 #define turnFieldDeRotatorOn() portWrite("#:r+#")
109 #define turnFieldDeRotatorOff() portWrite("#:r-#")
110 #define slewToPark() portWrite("#:hP#")
112 /* Astro-Physics specific */
113 #define APPark() portWrite("#:KA#")
114 #define APUnpark() portWrite("#:PO#");
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
120 /**************************************************************************
121 Basic I/O
122 **************************************************************************/
123 int openPort(const char *portID);
124 int portRead(char *buf, int nbytes, int timeout);
125 int portWrite(const char * buf);
126 int LX200readOut(int timeout);
128 int Connect(const char* device);
129 void Disconnect();
131 /**************************************************************************
132 Diagnostics
133 **************************************************************************/
134 char ACK();
135 int testTelescope();
136 int testAP();
138 /**************************************************************************
139 Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
140 **************************************************************************/
142 /* Get Double from Sexagisemal */
143 int getCommandSexa(double *value, const char *cmd);
144 /* Get String */
145 int getCommandString(char *data, const char* cmd);
146 /* Get Int */
147 int getCommandInt(int *value, const char* cmd);
148 /* Get tracking frequency */
149 int getTrackFreq(double * value);
150 /* Get site Latitude */
151 int getSiteLatitude(int *dd, int *mm);
152 /* Get site Longitude */
153 int getSiteLongitude(int *ddd, int *mm);
154 /* Get Calender data */
155 int getCalenderDate(char *date);
156 /* Get site Name */
157 int getSiteName(char *siteName, int siteNum);
158 /* Get Number of Bars */
159 int getNumberOfBars(int *value);
160 /* Get Home Search Status */
161 int getHomeSearchStatus(int *status);
162 /* Get OTA Temperature */
163 int getOTATemp(double * value);
164 /* Get time format: 12 or 24 */
165 int getTimeFormat(int *format);
168 /**************************************************************************
169 Set Commands
170 **************************************************************************/
172 /* Set Int */
173 int setCommandInt(int data, const char *cmd);
174 /* Set Sexigesimal */
175 int setCommandXYZ( int x, int y, int z, const char *cmd);
176 /* Common routine for Set commands */
177 int setStandardProcedure(char * writeData);
178 /* Set Slew Mode */
179 int setSlewMode(int slewMode);
180 /* Set Alignment mode */
181 int setAlignmentMode(unsigned int alignMode);
182 /* Set Object RA */
183 int setObjectRA(double ra);
184 /* set Object DEC */
185 int setObjectDEC(double dec);
186 /* Set Calender date */
187 int setCalenderDate(int dd, int mm, int yy);
188 /* Set UTC offset */
189 int setUTCOffset(double hours);
190 /* Set Track Freq */
191 int setTrackFreq(double trackF);
192 /* Set current site longitude */
193 int setSiteLongitude(double Long);
194 /* Set current site latitude */
195 int setSiteLatitude(double Lat);
196 /* Set Object Azimuth */
197 int setObjAz(double az);
198 /* Set Object Altitude */
199 int setObjAlt(double alt);
200 /* Set site name */
201 int setSiteName(char * siteName, int siteNum);
202 /* Set maximum slew rate */
203 int setMaxSlewRate(int slewRate);
204 /* Set focuser motion */
205 int setFocuserMotion(int motionType);
206 /* Set focuser speed mode */
207 int setFocuserSpeedMode (int speedMode);
208 /* Set minimum elevation limit */
209 int setMinElevationLimit(int min);
210 /* Set maximum elevation limit */
211 int setMaxElevationLimit(int max);
213 /**************************************************************************
214 Motion Commands
215 **************************************************************************/
216 /* Slew to the selected coordinates */
217 int Slew();
218 /* Synchronize to the selected coordinates and return the matching object if any */
219 int Sync(char *matchedObject);
220 /* Abort slew in all axes */
221 int abortSlew();
222 /* Move into one direction, two valid directions can be stacked */
223 int MoveTo(int direction);
224 /* Half movement in a particular direction */
225 int HaltMovement(int direction);
226 /* Select the tracking mode */
227 int selectTrackingMode(int trackMode);
228 /* Select Astro-Physics tracking mode */
229 int selectAPTrackingMode(int trackMode);
231 /**************************************************************************
232 Other Commands
233 **************************************************************************/
234 /* Ensures LX200 RA/DEC format is long */
235 int checkLX200Format();
236 /* Select a site from the LX200 controller */
237 int selectSite(int siteNum);
238 /* Select a catalog object */
239 int selectCatalogObject(int catalog, int NNNN);
240 /* Select a sub catalog */
241 int selectSubCatalog(int catalog, int subCatalog);
243 #ifdef __cplusplus
245 #endif
247 #endif