Instrument Neutral Distributed Interface INDI  2.0.2
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 {
45  LX200_ALL
46 };
47 /* Formats of Equatorial Right Ascension and Declination */
49 {
53 };
54 /* Formats of Geographic Latitude and Longitude */
56 {
60 };
61 /* Time Format */
63 {
66  LX200_PM
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 getDaylightSaving(fd, x) getCommandInt(fd, x, ":GH#")
139 #define getMaxElevationLimit(fd, x) getCommandInt(fd, x, ":Go#")
140 #define getMinElevationLimit(fd, x) getCommandInt(fd, x, ":Gh#")
141 
142 /* Generic set, x is an integer */
143 #define setReticleDutyFlashCycle(fd, x) setCommandInt(fd, x, ":BD")
144 #define setReticleFlashRate(fd, x) setCommandInt(fd, x, ":B")
145 #define setFocuserSpeed(fd, x) setCommandInt(fd, x, ":F")
146 #define setSlewSpeed(fd, x) setCommandInt(fd, x, ":Sw")
147 
148 /* GPS Specefic */
149 #define turnGPSOn(fd) write(fd, ":g+#", 4)
150 #define turnGPSOff(fd) write(fd, ":g-#", 4)
151 #define alignGPSScope(fd) write(fd, ":Aa#", 4)
152 #define gpsSleep(fd) write(fd, ":hN#", 4)
153 #define gpsWakeUp(fd) write(fd, ":hW#", 4);
154 #define gpsRestart(fd) write(fd, ":I#", 3);
155 #define updateGPS_System(fd) setStandardProcedure(fd, ":gT#")
156 #define enableDecAltPec(fd) write(fd, ":QA+#", 4)
157 #define disableDecAltPec(fd) write(fd, ":QA-#", 4)
158 #define enableRaAzPec(fd) write(fd, ":QZ+#", 4)
159 #define disableRaAzPec(fd) write(fd, ":QZ-#", 4)
160 #define activateAltDecAntiBackSlash(fd) write(fd, ":$BAdd#", 7)
161 #define activateAzRaAntiBackSlash(fd) write(fd, ":$BZdd#", 7)
162 #define SelenographicSync(fd) write(fd, ":CL#", 4);
163 
164 #define slewToAltAz(fd) setStandardProcedure(fd, ":MA#")
165 #define toggleTimeFormat(fd) write(fd, ":H#", 3)
166 #define increaseReticleBrightness(fd) write(fd, ":B+#", 4)
167 #define decreaseReticleBrightness(fd) write(fd, ":B-#", 4)
168 #define turnFanOn(fd) write(fd, ":f+#", 4)
169 #define turnFanOff(fd) write(fd, ":f-#", 4)
170 #define seekHomeAndSave(fd) write(fd, ":hS#", 4)
171 #define seekHomeAndSet(fd) write(fd, ":hF#", 4)
172 #define turnFieldDeRotatorOn(fd) write(fd, ":r+#", 4)
173 #define turnFieldDeRotatorOff(fd) write(fd, ":r-#", 4)
174 #define slewToPark(fd) write(fd, ":hP#", 4)
175 #define initTelescope(fd) write(fd, ":I#", 3)
176 
177 /**************************************************************************
178  Basic I/O - OBSELETE
179 **************************************************************************/
180 /*int openPort(const char *portID);
181 int portRead(char *buf, int nbytes, int timeout);
182 int portWrite(const char * buf);
183 int LX200readOut(int timeout);
184 int Connect(const char* device);
185 void Disconnect();*/
186 
187 /**************************************************************************
188  Diagnostics
189  **************************************************************************/
190 char ACK(int fd);
191 /*int testTelescope();
192 int testAP();*/
193 int check_lx200_connection(int fd);
194 
195 /**************************************************************************
196  Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
197  **************************************************************************/
198 
199 /* Get Double from Sexagisemal */
200 int getCommandSexa(int fd, double *value, const char *cmd);
201 /* Get String */
202 int getCommandString(int fd, char *data, const char *cmd);
203 /* Get Int */
204 int getCommandInt(int fd, int *value, const char *cmd);
205 /* Get tracking frequency */
206 int getTrackFreq(int fd, double *value);
207 /* Get site Latitude */
208 int getSiteLatitude(int fd, int *dd, int *mm, double *ssf);
209 /* Get site Longitude */
210 int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf);
211 /* Get site Latitude */
212 int getSiteLatitudeAlt(int fd, int *dd, int *mm, double *ssf, const char *cmd);
213 /* Get site Longitude */
214 int getSiteLongitudeAlt(int fd, int *ddd, int *mm, double *ssf, const char *cmd);
215 /* Get Calender data */
216 int getCalendarDate(int fd, char *date);
217 /* Get site Name */
218 int getSiteName(int fd, char *siteName, int siteNum);
219 /* Get Home Search Status */
220 int getHomeSearchStatus(int fd, int *status);
221 /* Get OTA Temperature */
222 int getOTATemp(int fd, double *value);
223 /* Get time format: 12 or 24 */
224 int getTimeFormat(int fd, int *format);
225 /* Get RA, DEC from Sky Commander controller */
226 int updateSkyCommanderCoord(int fd, double *ra, double *dec);
227 /* Get RA, DEC from Intelliscope/SkyWizard controllers */
228 int updateIntelliscopeCoord(int fd, double *ra, double *dec);
229 
230 /**************************************************************************
231  Set Commands
232  **************************************************************************/
233 
234 /* Set Int */
235 int setCommandInt(int fd, int data, const char *cmd);
236 /* Set Sexigesimal */
237 int setCommandXYZ(int fd, int x, int y, int z, const char *cmd, bool addSpace = false);
238 /* Common routine for Set commands */
239 int setStandardProcedure(int fd, const char *writeData);
240 /* Set Slew Mode */
241 int setSlewMode(int fd, int slewMode);
242 /* Set Alignment mode */
243 int setAlignmentMode(int fd, unsigned int alignMode);
244 /* Set Object RA */
245 int setObjectRA(int fd, double ra, bool addSpace = false);
246 /* set Object DEC */
247 int setObjectDEC(int fd, double dec, bool addSpace = false);
248 /* Set Calender date */
249 int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace = false);
250 /* Set UTC offset */
251 int setUTCOffset(int fd, double hours);
252 /* Set Track Freq */
253 int setTrackFreq(int fd, double trackF);
254 /* Replacement, for the above offering more precision, controlled by LX200_HAS_PRECISE_TRACKING_FREQ will work on OnStep (and AutoStar II) */
255 int setPreciseTrackFreq(int fd, double trackF);
256 /* Set current site longitude */
257 int setSiteLongitude(int fd, double Long, bool addSpace = false);
258 /* Set current site latitude */
259 int setSiteLatitude(int fd, double Lat, bool addSpace = false);
260 /* Set Object Azimuth */
261 int setObjAz(int fd, double az);
262 /* Set Object Altitude */
263 int setObjAlt(int fd, double alt);
264 /* Set site name */
265 int setSiteName(int fd, char *siteName, int siteNum);
266 /* Set maximum slew rate */
267 int setMaxSlewRate(int fd, int slewRate);
268 /* Set focuser motion */
269 int setFocuserMotion(int fd, int motionType);
270 /* SET GPS Focuser raneg (1 to 4) */
271 int setGPSFocuserSpeed(int fd, int speed);
272 /* Set focuser speed mode */
273 int setFocuserSpeedMode(int fd, int speedMode);
274 /* Set minimum elevation limit */
275 int setMinElevationLimit(int fd, int min);
276 /* Set maximum elevation limit */
277 int setMaxElevationLimit(int fd, int max);
278 
279 /* Set X:Y:Z */
280 int setLocalTime(int fd, int x, int y, int z, bool addSpace = false);
281 int setSDTime(int fd, int x, int y, int z, bool addSpace = false);
282 
283 
284 /**************************************************************************
285  Motion Commands
286  **************************************************************************/
287 /* Slew to the selected coordinates */
288 int Slew(int fd);
289 /* Synchronize to the selected coordinates and return the matching object if any */
290 int Sync(int fd, char *matchedObject);
291 /* Abort slew in all axes */
292 int abortSlew(int fd);
293 /* Move into one direction, two valid directions can be stacked */
294 int MoveTo(int fd, int direction);
295 /* Halt movement in a particular direction */
296 int HaltMovement(int fd, int direction);
297 /* Select the tracking mode */
298 int selectTrackingMode(int fd, int trackMode);
299 /* Is Slew complete? 0 if complete, 1 if in progress, otherwise return an error */
300 int isSlewComplete(int fd);
301 /* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
302 int SendPulseCmd(int fd, int direction, int duration_msec, bool wait_after_command=false, int max_wait_ms=1000);
303 
304 /**************************************************************************
305  Other Commands
306  **************************************************************************/
307 /* Determines LX200 RA/DEC format, tries to set to long if found short */
309 /* return the controller_format enum value */
311 /* Select a site from the LX200 controller */
312 int selectSite(int fd, int siteNum);
313 /* Select a catalog object */
314 int selectCatalogObject(int fd, int catalog, int NNNN);
315 /* Select a sub catalog */
316 int selectSubCatalog(int fd, int catalog, int subCatalog);
317 /* Set Debug */
318 void setLX200Debug(const char *deviceName, unsigned int debug_level);
double max(void)
double min(void)
double ra
double dec
int fd
Definition: intelliscope.c:43
int setFocuserMotion(int fd, int motionType)
int setAlignmentMode(int fd, unsigned int alignMode)
int setSlewMode(int fd, int slewMode)
int setLocalTime(int fd, int x, int y, int z, bool addSpace=false)
int setObjAlt(int fd, double alt)
int check_lx200_connection(int fd)
Definition: lx200driver.cpp:64
int setMinElevationLimit(int fd, int min)
TFocusMotion
Definition: lx200driver.h:70
@ LX200_FOCUSOUT
Definition: lx200driver.h:72
@ LX200_FOCUSIN
Definition: lx200driver.h:71
int getHomeSearchStatus(int fd, int *status)
int setCommandXYZ(int fd, int x, int y, int z, const char *cmd, bool addSpace=false)
int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf)
int setObjAz(int fd, double az)
int setSiteLongitude(int fd, double Long, bool addSpace=false)
int selectTrackingMode(int fd, int trackMode)
int getSiteLatitudeAlt(int fd, int *dd, int *mm, double *ssf, const char *cmd)
int setMaxSlewRate(int fd, int slewRate)
int getSiteName(int fd, char *siteName, int siteNum)
TAlign
Definition: lx200driver.h:33
@ LX200_ALIGN_POLAR
Definition: lx200driver.h:34
@ LX200_ALIGN_LAND
Definition: lx200driver.h:36
@ LX200_ALIGN_ALTAZ
Definition: lx200driver.h:35
int setMaxElevationLimit(int fd, int max)
int selectSite(int fd, int siteNum)
int getCommandInt(int fd, int *value, const char *cmd)
int getLX200EquatorialFormat()
int selectSubCatalog(int fd, int catalog, int subCatalog)
TCatalog
Definition: lx200driver.h:82
@ LX200_DEEPSKY_C
Definition: lx200driver.h:84
@ LX200_STAR_C
Definition: lx200driver.h:83
TTimeFormat
Definition: lx200driver.h:63
@ LX200_AM
Definition: lx200driver.h:65
@ LX200_24
Definition: lx200driver.h:64
@ LX200_PM
Definition: lx200driver.h:66
int checkLX200EquatorialFormat(int fd)
int SendPulseCmd(int fd, int direction, int duration_msec, bool wait_after_command=false, int max_wait_ms=1000)
TFocusSpeed
Definition: lx200driver.h:75
@ LX200_FOCUSSLOW
Definition: lx200driver.h:77
@ LX200_HALTFOCUS
Definition: lx200driver.h:76
@ LX200_FOCUSFAST
Definition: lx200driver.h:78
int setObjectDEC(int fd, double dec, bool addSpace=false)
int abortSlew(int fd)
TFreq
Definition: lx200driver.h:106
@ LX200_TRACK_MANUAL
Definition: lx200driver.h:110
@ LX200_TRACK_SOLAR
Definition: lx200driver.h:108
@ LX200_TRACK_LUNAR
Definition: lx200driver.h:109
@ LX200_TRACK_SIDEREAL
Definition: lx200driver.h:107
TDirection
Definition: lx200driver.h:40
@ LX200_WEST
Definition: lx200driver.h:42
@ LX200_ALL
Definition: lx200driver.h:45
@ LX200_SOUTH
Definition: lx200driver.h:44
@ LX200_NORTH
Definition: lx200driver.h:41
@ LX200_EAST
Definition: lx200driver.h:43
int getCommandSexa(int fd, double *value, const char *cmd)
char ACK(int fd)
int Sync(int fd, char *matchedObject)
int setTrackFreq(int fd, double trackF)
int setFocuserSpeedMode(int fd, int speedMode)
TEquatorialFormat
Definition: lx200driver.h:49
@ LX200_EQ_LONGER_FORMAT
Definition: lx200driver.h:52
@ LX200_EQ_SHORT_FORMAT
Definition: lx200driver.h:50
@ LX200_EQ_LONG_FORMAT
Definition: lx200driver.h:51
int getCalendarDate(int fd, char *date)
int updateSkyCommanderCoord(int fd, double *ra, double *dec)
int Slew(int fd)
int MoveTo(int fd, int direction)
int getTimeFormat(int fd, int *format)
int setCommandInt(int fd, int data, const char *cmd)
TGeographicFormat
Definition: lx200driver.h:56
@ LX200_GEO_SHORT_FORMAT
Definition: lx200driver.h:57
@ LX200_GEO_LONG_FORMAT
Definition: lx200driver.h:58
@ LX200_GEO_LONGER_FORMAT
Definition: lx200driver.h:59
int getCommandString(int fd, char *data, const char *cmd)
int setStandardProcedure(int fd, const char *writeData)
int getOTATemp(int fd, double *value)
DeepSkyCatalog
Definition: lx200driver.h:95
@ LX200_CALDWELL
Definition: lx200driver.h:99
@ LX200_UGC
Definition: lx200driver.h:98
@ LX200_ABELL
Definition: lx200driver.h:101
@ LX200_MESSIER_C
Definition: lx200driver.h:102
@ LX200_ARP
Definition: lx200driver.h:100
@ LX200_IC
Definition: lx200driver.h:97
@ LX200_NGC
Definition: lx200driver.h:96
int getTrackFreq(int fd, double *value)
TSlew
Definition: lx200driver.h:25
@ LX200_SLEW_CENTER
Definition: lx200driver.h:28
@ LX200_SLEW_GUIDE
Definition: lx200driver.h:29
@ LX200_SLEW_MAX
Definition: lx200driver.h:26
@ LX200_SLEW_FIND
Definition: lx200driver.h:27
int setPreciseTrackFreq(int fd, double trackF)
int setSiteName(int fd, char *siteName, int siteNum)
void setLX200Debug(const char *deviceName, unsigned int debug_level)
Definition: lx200driver.cpp:58
int setUTCOffset(int fd, double hours)
int setSDTime(int fd, int x, int y, int z, bool addSpace=false)
int setGPSFocuserSpeed(int fd, int speed)
int updateIntelliscopeCoord(int fd, double *ra, double *dec)
int setObjectRA(int fd, double ra, bool addSpace=false)
int getSiteLongitudeAlt(int fd, int *ddd, int *mm, double *ssf, const char *cmd)
int HaltMovement(int fd, int direction)
StarCatalog
Definition: lx200driver.h:88
@ LX200_SAO
Definition: lx200driver.h:90
@ LX200_GCVS
Definition: lx200driver.h:91
@ LX200_STAR
Definition: lx200driver.h:89
int setSiteLatitude(int fd, double Lat, bool addSpace=false)
int getSiteLatitude(int fd, int *dd, int *mm, double *ssf)
int isSlewComplete(int fd)
int selectCatalogObject(int fd, int catalog, int NNNN)
int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace=false)
__u8 cmd[4]
Definition: pwc-ioctl.h:2