Instrument Neutral Distributed Interface INDI  1.9.5
lx200driver.h
Go to the documentation of this file.
1 /*
2  LX200 Driver
3  Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
4 
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.
9 
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.
14 
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #pragma once
22 
23 /* Slew speeds */
24 enum TSlew
25 {
30 };
31 /* Alignment modes */
32 enum TAlign
33 {
37 };
38 /* Directions */
40 {
46 };
47 /* Formats of Equatorial Right Ascension and Declination */
49 {
53 };
54 /* Formats of Geographic Latitude and Longitude */
56 {
60 };
61 /* Time Format */
63 {
67 };
68 /* Focus operation */
70 {
73 };
75 {
79 };
80 /* Library catalogs */
82 {
85 };
86 /* Frequency mode */
88 {
92 };
93 /* Deep Sky Catalogs */
95 {
103 };
104 /* Mount tracking frequency, in Hz */
105 enum TFreq
106 {
111 };
112 
113 #define MaxReticleDutyCycle 15
114 #define MaxFocuserSpeed 4
115 
116 /* GET formatted sexagisemal value from device, return as double */
117 #define getLX200RA(fd, x) getCommandSexa(fd, x, ":GR#")
118 #define getLX200DEC(fd, x) getCommandSexa(fd, x, ":GD#")
119 #define getObjectRA(fd, x) getCommandSexa(fd, x, ":Gr#")
120 #define getObjectDEC(fd, x) getCommandSexa(fd, x, ":Gd#")
121 #define getLocalTime12(fd, x) getCommandSexa(fd, x, ":Ga#")
122 #define getLocalTime24(fd, x) getCommandSexa(fd, x, ":GL#")
123 #define getSDTime(fd, x) getCommandSexa(fd, x, ":GS#")
124 #define getLX200Alt(fd, x) getCommandSexa(fd, x, ":GA#")
125 #define getLX200Az(fd, x) getCommandSexa(fd, x, ":GZ#")
126 
127 /* GET String from device and store in supplied buffer x */
128 #define getObjectInfo(fd, x) getCommandString(fd, x, ":LI#")
129 #define getVersionDate(fd, x) getCommandString(fd, x, ":GVD#")
130 #define getVersionTime(fd, x) getCommandString(fd, x, ":GVT#")
131 #define getFullVersion(fd, x) getCommandString(fd, x, ":GVF#")
132 #define getVersionNumber(fd, x) getCommandString(fd, x, ":GVN#")
133 #define getProductName(fd, x) getCommandString(fd, x, ":GVP#")
134 #define turnGPS_StreamOn(fd) getCommandString(fd, x, ":gps#")
135 
136 /* GET Int from device and store in supplied pointer to integer x */
137 #define getUTCOffset(fd, x) getCommandInt(fd, x, ":GG#")
138 #define getMaxElevationLimit(fd, x) getCommandInt(fd, x, ":Go#")
139 #define getMinElevationLimit(fd, x) getCommandInt(fd, x, ":Gh#")
140 
141 /* Generic set, x is an integer */
142 #define setReticleDutyFlashCycle(fd, x) setCommandInt(fd, x, ":BD")
143 #define setReticleFlashRate(fd, x) setCommandInt(fd, x, ":B")
144 #define setFocuserSpeed(fd, x) setCommandInt(fd, x, ":F")
145 #define setSlewSpeed(fd, x) setCommandInt(fd, x, ":Sw")
146 
147 /* Set X:Y:Z */
148 #define setLocalTime(fd, x, y, z) setCommandXYZ(fd, x, y, z, ":SL")
149 #define setSDTime(fd, x, y, z) setCommandXYZ(fd, x, y, z, ":SS")
150 
151 /* GPS Specefic */
152 #define turnGPSOn(fd) write(fd, ":g+#", 4)
153 #define turnGPSOff(fd) write(fd, ":g-#", 4)
154 #define alignGPSScope(fd) write(fd, ":Aa#", 4)
155 #define gpsSleep(fd) write(fd, ":hN#", 4)
156 #define gpsWakeUp(fd) write(fd, ":hW#", 4);
157 #define gpsRestart(fd) write(fd, ":I#", 3);
158 #define updateGPS_System(fd) setStandardProcedure(fd, ":gT#")
159 #define enableDecAltPec(fd) write(fd, ":QA+#", 4)
160 #define disableDecAltPec(fd) write(fd, ":QA-#", 4)
161 #define enableRaAzPec(fd) write(fd, ":QZ+#", 4)
162 #define disableRaAzPec(fd) write(fd, ":QZ-#", 4)
163 #define activateAltDecAntiBackSlash(fd) write(fd, ":$BAdd#", 7)
164 #define activateAzRaAntiBackSlash(fd) write(fd, ":$BZdd#", 7)
165 #define SelenographicSync(fd) write(fd, ":CL#", 4);
166 
167 #define slewToAltAz(fd) setStandardProcedure(fd, ":MA#")
168 #define toggleTimeFormat(fd) write(fd, ":H#", 3)
169 #define increaseReticleBrightness(fd) write(fd, ":B+#", 4)
170 #define decreaseReticleBrightness(fd) write(fd, ":B-#", 4)
171 #define turnFanOn(fd) write(fd, ":f+#", 4)
172 #define turnFanOff(fd) write(fd, ":f-#", 4)
173 #define seekHomeAndSave(fd) write(fd, ":hS#", 4)
174 #define seekHomeAndSet(fd) write(fd, ":hF#", 4)
175 #define turnFieldDeRotatorOn(fd) write(fd, ":r+#", 4)
176 #define turnFieldDeRotatorOff(fd) write(fd, ":r-#", 4)
177 #define slewToPark(fd) write(fd, ":hP#", 4)
178 #define initTelescope(fd) write(fd, ":I#", 3)
179 
180 /**************************************************************************
181  Basic I/O - OBSELETE
182 **************************************************************************/
183 /*int openPort(const char *portID);
184 int portRead(char *buf, int nbytes, int timeout);
185 int portWrite(const char * buf);
186 int LX200readOut(int timeout);
187 int Connect(const char* device);
188 void Disconnect();*/
189 
190 /**************************************************************************
191  Diagnostics
192  **************************************************************************/
193 char ACK(int fd);
194 /*int testTelescope();
195 int testAP();*/
196 int check_lx200_connection(int fd);
197 
198 /**************************************************************************
199  Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
200  **************************************************************************/
201 
202 /* Get Double from Sexagisemal */
203 int getCommandSexa(int fd, double *value, const char *cmd);
204 /* Get String */
205 int getCommandString(int fd, char *data, const char *cmd);
206 /* Get Int */
207 int getCommandInt(int fd, int *value, const char *cmd);
208 /* Get tracking frequency */
209 int getTrackFreq(int fd, double *value);
210 /* Get site Latitude */
211 int getSiteLatitude(int fd, int *dd, int *mm, double *ssf);
212 /* Get site Longitude */
213 int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf);
214 /* Get site Latitude */
215 int getSiteLatitudeAlt(int fd, int *dd, int *mm, double *ssf, const char *cmd);
216 /* Get site Longitude */
217 int getSiteLongitudeAlt(int fd, int *ddd, int *mm, double *ssf, const char *cmd);
218 /* Get Calender data */
219 int getCalendarDate(int fd, char *date);
220 /* Get site Name */
221 int getSiteName(int fd, char *siteName, int siteNum);
222 /* Get Home Search Status */
223 int getHomeSearchStatus(int fd, int *status);
224 /* Get OTA Temperature */
225 int getOTATemp(int fd, double *value);
226 /* Get time format: 12 or 24 */
227 int getTimeFormat(int fd, int *format);
228 /* Get RA, DEC from Sky Commander controller */
229 int updateSkyCommanderCoord(int fd, double *ra, double *dec);
230 /* Get RA, DEC from Intelliscope/SkyWizard controllers */
231 int updateIntelliscopeCoord(int fd, double *ra, double *dec);
232 
233 /**************************************************************************
234  Set Commands
235  **************************************************************************/
236 
237 /* Set Int */
238 int setCommandInt(int fd, int data, const char *cmd);
239 /* Set Sexigesimal */
240 int setCommandXYZ(int fd, int x, int y, int z, const char *cmd);
241 /* Common routine for Set commands */
242 int setStandardProcedure(int fd, const char *writeData);
243 /* Set Slew Mode */
244 int setSlewMode(int fd, int slewMode);
245 /* Set Alignment mode */
246 int setAlignmentMode(int fd, unsigned int alignMode);
247 /* Set Object RA */
248 int setObjectRA(int fd, double ra);
249 /* set Object DEC */
250 int setObjectDEC(int fd, double dec);
251 /* Set Calender date */
252 int setCalenderDate(int fd, int dd, int mm, int yy);
253 /* Set UTC offset */
254 int setUTCOffset(int fd, double hours);
255 /* Set Track Freq */
256 int setTrackFreq(int fd, double trackF);
257 /* Replacement, for the above offering more precision, controlled by LX200_HAS_PRECISE_TRACKING_FREQ will work on OnStep (and AutoStar II) */
258 int setPreciseTrackFreq(int fd, double trackF);
259 /* Set current site longitude */
260 int setSiteLongitude(int fd, double Long);
261 /* Set current site latitude */
262 int setSiteLatitude(int fd, double Lat);
263 /* Set Object Azimuth */
264 int setObjAz(int fd, double az);
265 /* Set Object Altitude */
266 int setObjAlt(int fd, double alt);
267 /* Set site name */
268 int setSiteName(int fd, char *siteName, int siteNum);
269 /* Set maximum slew rate */
270 int setMaxSlewRate(int fd, int slewRate);
271 /* Set focuser motion */
272 int setFocuserMotion(int fd, int motionType);
273 /* SET GPS Focuser raneg (1 to 4) */
274 int setGPSFocuserSpeed(int fd, int speed);
275 /* Set focuser speed mode */
276 int setFocuserSpeedMode(int fd, int speedMode);
277 /* Set minimum elevation limit */
278 int setMinElevationLimit(int fd, int min);
279 /* Set maximum elevation limit */
280 int setMaxElevationLimit(int fd, int max);
281 
282 /**************************************************************************
283  Motion Commands
284  **************************************************************************/
285 /* Slew to the selected coordinates */
286 int Slew(int fd);
287 /* Synchronize to the selected coordinates and return the matching object if any */
288 int Sync(int fd, char *matchedObject);
289 /* Abort slew in all axes */
290 int abortSlew(int fd);
291 /* Move into one direction, two valid directions can be stacked */
292 int MoveTo(int fd, int direction);
293 /* Halt movement in a particular direction */
294 int HaltMovement(int fd, int direction);
295 /* Select the tracking mode */
296 int selectTrackingMode(int fd, int trackMode);
297 /* Is Slew complete? 0 if complete, 1 if in progress, otherwise return an error */
298 int isSlewComplete(int fd);
299 /* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
300 int SendPulseCmd(int fd, int direction, int duration_msec);
301 
302 /**************************************************************************
303  Other Commands
304  **************************************************************************/
305 /* Determines LX200 RA/DEC format, tries to set to long if found short */
307 /* return the controller_format enum value */
309 /* Select a site from the LX200 controller */
310 int selectSite(int fd, int siteNum);
311 /* Select a catalog object */
312 int selectCatalogObject(int fd, int catalog, int NNNN);
313 /* Select a sub catalog */
314 int selectSubCatalog(int fd, int catalog, int subCatalog);
315 /* Set Debug */
316 void setLX200Debug(const char *deviceName, unsigned int debug_level);
setSiteName
int setSiteName(int fd, char *siteName, int siteNum)
Definition: lx200driver.cpp:1208
TGeographicFormat
TGeographicFormat
Definition: lx200driver.h:55
LX200_STAR
@ LX200_STAR
Definition: lx200driver.h:89
selectSubCatalog
int selectSubCatalog(int fd, int catalog, int subCatalog)
Definition: lx200driver.cpp:1667
setCalenderDate
int setCalenderDate(int fd, int dd, int mm, int yy)
Definition: lx200driver.cpp:1047
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
MoveTo
int MoveTo(int fd, int direction)
Definition: lx200driver.cpp:1432
StarCatalog
StarCatalog
Definition: lx200driver.h:87
TFocusMotion
TFocusMotion
Definition: lx200driver.h:69
LX200_ALIGN_LAND
@ LX200_ALIGN_LAND
Definition: lx200driver.h:36
LX200_ARP
@ LX200_ARP
Definition: lx200driver.h:100
getTimeFormat
int getTimeFormat(int fd, int *format)
Definition: lx200driver.cpp:438
fd
int fd
Definition: indiserver.c:117
TAlign
TAlign
Definition: lx200driver.h:32
isSlewComplete
int isSlewComplete(int fd)
Definition: lx200driver.cpp:350
min
double min(void)
selectTrackingMode
int selectTrackingMode(int fd, int trackMode)
Definition: lx200driver.cpp:1790
setCommandInt
int setCommandInt(int fd, int data, const char *cmd)
Definition: lx200driver.cpp:855
setUTCOffset
int setUTCOffset(int fd, double hours)
Definition: lx200driver.cpp:1096
LX200_TRACK_SOLAR
@ LX200_TRACK_SOLAR
Definition: lx200driver.h:108
LX200_EQ_LONGER_FORMAT
@ LX200_EQ_LONGER_FORMAT
Definition: lx200driver.h:52
LX200_FOCUSSLOW
@ LX200_FOCUSSLOW
Definition: lx200driver.h:77
TSlew
TSlew
Definition: lx200driver.h:24
TTimeFormat
TTimeFormat
Definition: lx200driver.h:62
setSiteLatitude
int setSiteLatitude(int fd, double Lat)
Definition: lx200driver.cpp:1145
setFocuserMotion
int setFocuserMotion(int fd, int motionType)
Definition: lx200driver.cpp:1276
setObjAz
int setObjAz(int fd, double az)
Definition: lx200driver.cpp:1176
LX200_UGC
@ LX200_UGC
Definition: lx200driver.h:98
LX200_NORTH
@ LX200_NORTH
Definition: lx200driver.h:41
TCatalog
TCatalog
Definition: lx200driver.h:81
LX200_DEEPSKY_C
@ LX200_DEEPSKY_C
Definition: lx200driver.h:84
LX200_SLEW_FIND
@ LX200_SLEW_FIND
Definition: lx200driver.h:27
LX200_GEO_LONG_FORMAT
@ LX200_GEO_LONG_FORMAT
Definition: lx200driver.h:58
LX200_WEST
@ LX200_WEST
Definition: lx200driver.h:42
LX200_NGC
@ LX200_NGC
Definition: lx200driver.h:96
Sync
int Sync(int fd, char *matchedObject)
Definition: lx200driver.cpp:1561
setTrackFreq
int setTrackFreq(int fd, double trackF)
Definition: lx200driver.cpp:1366
setLX200Debug
void setLX200Debug(const char *deviceName, unsigned int debug_level)
Definition: lx200driver.cpp:58
setFocuserSpeedMode
int setFocuserSpeedMode(int fd, int speedMode)
Definition: lx200driver.cpp:1303
LX200_SAO
@ LX200_SAO
Definition: lx200driver.h:90
setCommandXYZ
int setCommandXYZ(int fd, int x, int y, int z, const char *cmd)
Definition: lx200driver.cpp:1004
getSiteLatitude
int getSiteLatitude(int fd, int *dd, int *mm, double *ssf)
Definition: lx200driver.cpp:539
abortSlew
int abortSlew(int fd)
Definition: lx200driver.cpp:1544
LX200_EAST
@ LX200_EAST
Definition: lx200driver.h:43
getTrackFreq
int getTrackFreq(int fd, double *value)
Definition: lx200driver.cpp:703
max
double max(void)
setPreciseTrackFreq
int setPreciseTrackFreq(int fd, double trackF)
Definition: lx200driver.cpp:1379
setSlewMode
int setSlewMode(int fd, int slewMode)
Definition: lx200driver.cpp:1237
setMaxElevationLimit
int setMaxElevationLimit(int fd, int max)
Definition: lx200driver.cpp:893
setObjAlt
int setObjAlt(int fd, double alt)
Definition: lx200driver.cpp:1192
TFreq
TFreq
Definition: lx200driver.h:105
LX200_ALIGN_POLAR
@ LX200_ALIGN_POLAR
Definition: lx200driver.h:34
getSiteName
int getSiteName(int fd, char *siteName, int siteNum)
Definition: lx200driver.cpp:480
LX200_MESSIER_C
@ LX200_MESSIER_C
Definition: lx200driver.h:102
ra
double ra
Definition: ieqprolegacydriver.cpp:43
checkLX200EquatorialFormat
int checkLX200EquatorialFormat(int fd)
Definition: lx200driver.cpp:1698
getHomeSearchStatus
int getHomeSearchStatus(int fd, int *status)
Definition: lx200driver.cpp:742
LX200_GEO_LONGER_FORMAT
@ LX200_GEO_LONGER_FORMAT
Definition: lx200driver.h:59
selectCatalogObject
int selectCatalogObject(int fd, int catalog, int NNNN)
Definition: lx200driver.cpp:1632
setMaxSlewRate
int setMaxSlewRate(int fd, int slewRate)
Definition: lx200driver.cpp:907
LX200_EQ_LONG_FORMAT
@ LX200_EQ_LONG_FORMAT
Definition: lx200driver.h:51
getCalendarDate
int getCalendarDate(int fd, char *date)
Definition: lx200driver.cpp:398
dec
double dec
Definition: ieqprolegacydriver.cpp:44
getSiteLongitudeAlt
int getSiteLongitudeAlt(int fd, int *ddd, int *mm, double *ssf, const char *cmd)
Definition: lx200driver.cpp:629
setAlignmentMode
int setAlignmentMode(int fd, unsigned int alignMode)
Definition: lx200driver.cpp:1016
LX200_TRACK_LUNAR
@ LX200_TRACK_LUNAR
Definition: lx200driver.h:109
LX200_GEO_SHORT_FORMAT
@ LX200_GEO_SHORT_FORMAT
Definition: lx200driver.h:57
LX200_GCVS
@ LX200_GCVS
Definition: lx200driver.h:91
LX200_FOCUSOUT
@ LX200_FOCUSOUT
Definition: lx200driver.h:72
LX200_CALDWELL
@ LX200_CALDWELL
Definition: lx200driver.h:99
updateSkyCommanderCoord
int updateSkyCommanderCoord(int fd, double *ra, double *dec)
Definition: ieq45driver8406.c:579
selectSite
int selectSite(int fd, int siteNum)
Definition: lx200driver.cpp:1592
LX200_HALTFOCUS
@ LX200_HALTFOCUS
Definition: lx200driver.h:76
LX200_ALL
@ LX200_ALL
Definition: lx200driver.h:45
TEquatorialFormat
TEquatorialFormat
Definition: lx200driver.h:48
setMinElevationLimit
int setMinElevationLimit(int fd, int min)
Definition: lx200driver.cpp:883
Slew
int Slew(int fd)
Definition: lx200driver.cpp:1396
getCommandSexa
int getCommandSexa(int fd, double *value, const char *cmd)
Definition: lx200driver.cpp:241
LX200_ALIGN_ALTAZ
@ LX200_ALIGN_ALTAZ
Definition: lx200driver.h:35
getSiteLatitudeAlt
int getSiteLatitudeAlt(int fd, int *dd, int *mm, double *ssf, const char *cmd)
Definition: lx200driver.cpp:555
SendPulseCmd
int SendPulseCmd(int fd, int direction, int duration_msec)
Definition: lx200driver.cpp:1466
getCommandInt
int getCommandInt(int fd, int *value, const char *cmd)
Definition: lx200driver.cpp:278
LX200_ABELL
@ LX200_ABELL
Definition: lx200driver.h:101
setSiteLongitude
int setSiteLongitude(int fd, double Long)
Definition: lx200driver.cpp:1114
LX200_STAR_C
@ LX200_STAR_C
Definition: lx200driver.h:83
LX200_AM
@ LX200_AM
Definition: lx200driver.h:65
getLX200EquatorialFormat
int getLX200EquatorialFormat()
Definition: lx200driver.cpp:1688
LX200_EQ_SHORT_FORMAT
@ LX200_EQ_SHORT_FORMAT
Definition: lx200driver.h:50
setGPSFocuserSpeed
int setGPSFocuserSpeed(int fd, int speed)
Definition: lx200driver.cpp:1335
LX200_TRACK_MANUAL
@ LX200_TRACK_MANUAL
Definition: lx200driver.h:110
LX200_SLEW_GUIDE
@ LX200_SLEW_GUIDE
Definition: lx200driver.h:29
setObjectDEC
int setObjectDEC(int fd, double dec)
Definition: lx200driver.cpp:959
LX200_FOCUSIN
@ LX200_FOCUSIN
Definition: lx200driver.h:71
LX200_TRACK_SIDEREAL
@ LX200_TRACK_SIDEREAL
Definition: lx200driver.h:107
LX200_SLEW_MAX
@ LX200_SLEW_MAX
Definition: lx200driver.h:26
LX200_SOUTH
@ LX200_SOUTH
Definition: lx200driver.h:44
LX200_IC
@ LX200_IC
Definition: lx200driver.h:97
LX200_PM
@ LX200_PM
Definition: lx200driver.h:66
HaltMovement
int HaltMovement(int fd, int direction)
Definition: lx200driver.cpp:1500
getSiteLongitude
int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf)
Definition: lx200driver.cpp:549
ACK
char ACK(int fd)
Definition: lx200driver.cpp:213
updateIntelliscopeCoord
int updateIntelliscopeCoord(int fd, double *ra, double *dec)
Definition: ieq45driver8406.c:609
TFocusSpeed
TFocusSpeed
Definition: lx200driver.h:74
setStandardProcedure
int setStandardProcedure(int fd, const char *writeData)
Definition: lx200driver.cpp:821
LX200_SLEW_CENTER
@ LX200_SLEW_CENTER
Definition: lx200driver.h:28
check_lx200_connection
int check_lx200_connection(int fd)
Definition: lx200driver.cpp:176
getCommandString
int getCommandString(int fd, char *data, const char *cmd)
Definition: lx200driver.cpp:321
LX200_24
@ LX200_24
Definition: lx200driver.h:64
setObjectRA
int setObjectRA(int fd, double ra)
Definition: lx200driver.cpp:924
DeepSkyCatalog
DeepSkyCatalog
Definition: lx200driver.h:94
TDirection
TDirection
Definition: lx200driver.h:39
LX200_FOCUSFAST
@ LX200_FOCUSFAST
Definition: lx200driver.h:78
getOTATemp
int getOTATemp(int fd, double *value)
Definition: lx200driver.cpp:779