Instrument Neutral Distributed Interface INDI  1.9.5
ieq45driver.h
Go to the documentation of this file.
1 /*
2  IEQ45 Driver
3  Copyright (C) 2011 Nacho Mas (mas.ignacio@gmail.com). Only litle changes
4  from lx200basic made it by Jasem Mutlaq (mutlaqja@ikarustech.com)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 */
21 
22 #pragma once
23 
24 /* Slew speeds */
25 enum TSlew
26 {
31 };
32 /* Alignment modes */
33 enum TAlign
34 {
38 };
39 /* Directions */
41 {
47 };
48 /* Formats of Right ascention and Declenation */
49 enum TFormat
50 {
53 };
54 /* Time Format */
56 {
60 };
61 /* Focus operation */
63 {
66 };
68 {
72 };
73 /* Library catalogs */
75 {
78 };
79 /* Frequency mode */
81 {
85 };
86 /* Deep Sky Catalogs */
88 {
96 };
97 /* Mount tracking frequency, in Hz */
98 enum TFreq
99 {
104 };
105 
106 #define MaxReticleDutyCycle 15
107 #define MaxFocuserSpeed 4
108 
109 /* GET formatted sexagisemal value from device, return as double */
110 #define getIEQ45RA(fd, x) getCommandSexa(fd, x, ":GR#") //OK
111 #define getIEQ45DEC(fd, x) getCommandSexa(fd, x, ":GD#") //OK
112 //#define getObjectRA(fd, x) getCommandSexa(fd, x, ":Gr#") //NO OK
113 //#define getObjectDEC(fd, x) getCommandSexa(fd, x, ":Gd#") //NO OK
114 //#define getLocalTime12(fd, x) getCommandSexa(fd, x, ":Ga#") //NO OK
115 #define getLocalTime24(fd, x) getCommandSexa(fd, x, ":GL#") //OK
116 #define getSDTime(fd, x) getCommandSexa(fd, x, ":GS#") //OK
117 #define getIEQ45Alt(fd, x) getCommandSexa(fd, x, ":GA#") //OK
118 #define getIEQ45Az(fd, x) getCommandSexa(fd, x, ":GZ#") //OK
119 
120 /* GET String from device and store in supplied buffer x */
121 //#define getObjectInfo(fd, x) getCommandString(fd, x, ":LI#") //NO OK
122 //#define getVersionDate(fd, x) getCommandString(fd, x, ":GVD#") //NO OK
123 //#define getVersionTime(fd, x) getCommandString(fd, x, ":GVT#") //NO OK
124 //#define getFullVersion(fd, x) getCommandString(fd, x, ":GVF#") //NO OK
125 //#define getVersionNumber(fd, x) getCommandString(fd, x, ":GVN#") //NO OK
126 //#define getProductName(fd, x) getCommandString(fd, x, ":GVP#") //NO OK
127 //#define turnGPS_StreamOn(fd) getCommandString(fd, x, ":gps#") //NO OK
128 
129 /* GET Int from device and store in supplied pointer to integer x */
130 #define getUTCOffset(fd, x) getCommandInt(fd, x, ":GG#") //OK
131 //#define getMaxElevationLimit(fd, x) getCommandInt(fd, x, ":Go#") //NO OK
132 //#define getMinElevationLimit(fd, x) getCommandInt(fd, x, ":Gh#") //NO OK
133 
134 /* Generic set, x is an integer */
135 //#define setReticleDutyFlashCycle(fd, x) setCommandInt(fd, x, ":BD")
136 #define setReticleFlashRate(fd, x) setCommandInt(fd, x, ":B")
137 #define setFocuserSpeed(fd, x) setCommandInt(fd, x, ":F")
138 #define setSlewSpeed(fd, x) setCommandInt(fd, x, ":Sw")
139 
140 /* Set X:Y:Z */
141 #define setLocalTime(fd, x, y, z) setCommandXYZ(fd, x, y, z, ":SL")
142 #define setSDTime(fd, x, y, z) setCommandXYZ(fd, x, y, z, ":SS")
143 
144 /* GPS Specefic */
145 #define turnGPSOn(fd) write(fd, ":g+#", 5)
146 #define turnGPSOff(fd) write(fd, ":g-#", 5)
147 #define alignGPSScope(fd) write(fd, ":Aa#", 5)
148 #define gpsSleep(fd) write(fd, ":hN#", 5)
149 #define gpsWakeUp(fd) write(fd, ":hW#", 5);
150 #define gpsRestart(fd) write(fd, ":I#", 4);
151 #define updateGPS_System(fd) setStandardProcedure(fd, ":gT#")
152 #define enableDecAltPec(fd) write(fd, ":QA+#", 6)
153 #define disableDecAltPec(fd) write(fd, ":QA-#", 6)
154 #define enableRaAzPec(fd) write(fd, ":QZ+#", 6)
155 #define disableRaAzPec(fd) write(fd, ":QZ-#", 6)
156 #define activateAltDecAntiBackSlash(fd) write(fd, "$BAdd#", 7)
157 #define activateAzRaAntiBackSlash(fd) write(fd, "$BZdd#", 7)
158 #define SelenographicSync(fd) write(fd, ":CL#", 5);
159 
160 #define slewToAltAz(fd) setStandardProcedure(fd, ":MA#")
161 #define toggleTimeFormat(fd) write(fd, ":H#", 4)
162 #define increaseReticleBrightness(fd) write(fd, ":B+#", 5)
163 #define decreaseReticleBrightness(fd) write(fd, ":B-#", 5)
164 #define turnFanOn(fd) write(fd, ":f+#", 5)
165 #define turnFanOff(fd) write(fd, ":f-#", 5)
166 #define seekHomeAndSave(fd) write(fd, ":hS#", 5)
167 #define seekHomeAndSet(fd) write(fd, ":hF#", 5)
168 #define turnFieldDeRotatorOn(fd) write(fd, ":r+#", 5)
169 #define turnFieldDeRotatorOff(fd) write(fd, ":r-#", 5)
170 #define slewToPark(fd) write(fd, ":hP#", 5)
171 
172 #ifdef __cplusplus
173 extern "C" {
174 #endif
175 
176 /**************************************************************************
177  Basic I/O - OBSELETE
178 **************************************************************************/
179 /*int openPort(const char *portID);
180 int portRead(char *buf, int nbytes, int timeout);
181 int portWrite(const char * buf);
182 int IEQ45readOut(int timeout);
183 int Connect(const char* device);
184 void Disconnect();*/
185 
186 /**************************************************************************
187  Diagnostics
188  **************************************************************************/
189 char ACK(int fd);
190 /*int testTelescope();
191 int testAP();*/
192 int check_IEQ45_connection(int fd);
193 
194 /**************************************************************************
195  Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
196  **************************************************************************/
197 
198 /* Get Double from Sexagisemal */
199 int getCommandSexa(int fd, double *value, const char *cmd);
200 /* Get String */
201 int getCommandString(int fd, char *data, const char *cmd);
202 /* Get Int */
203 int getCommandInt(int fd, int *value, const char *cmd);
204 /* Get tracking frequency */
205 int getTrackFreq(int fd, double *value);
206 /* Get site Latitude */
207 int getSiteLatitude(int fd, int *dd, int *mm);
208 /* Get site Longitude */
209 int getSiteLongitude(int fd, int *ddd, int *mm);
210 /* Get Calender data */
211 int getCalendarDate(int fd, char *date);
212 /* Get site Name */
213 int getSiteName(int fd, char *siteName, int siteNum);
214 /* Get Number of Bars */
215 int getNumberOfBars(int fd, int *value);
216 /* Get Home Search Status */
217 int getHomeSearchStatus(int fd, int *status);
218 /* Get OTA Temperature */
219 int getOTATemp(int fd, double *value);
220 /* Get time format: 12 or 24 */
221 int getTimeFormat(int fd, int *format);
222 /* Get RA, DEC from Sky Commander controller */
223 int updateSkyCommanderCoord(int fd, double *ra, double *dec);
224 /* Get RA, DEC from Intelliscope/SkyWizard controllers */
225 int updateIntelliscopeCoord(int fd, double *ra, double *dec);
226 
227 /**************************************************************************
228  Set Commands
229  **************************************************************************/
230 
231 /* Set Int */
232 int setCommandInt(int fd, int data, const char *cmd);
233 /* Set Sexigesimal */
234 int setCommandXYZ(int fd, int x, int y, int z, const char *cmd);
235 /* Common routine for Set commands */
236 int setStandardProcedure(int fd, char *writeData);
237 /* Set Slew Mode */
238 int setSlewMode(int fd, int slewMode);
239 /* Set Alignment mode */
240 int setAlignmentMode(int fd, unsigned int alignMode);
241 /* Set Object RA */
242 int setObjectRA(int fd, double ra);
243 /* set Object DEC */
244 int setObjectDEC(int fd, double dec);
245 /* Set Calender date */
246 int setCalenderDate(int fd, int dd, int mm, int yy);
247 /* Set UTC offset */
248 int setUTCOffset(int fd, double hours);
249 /* Set Track Freq */
250 int setTrackFreq(int fd, double trackF);
251 /* Set current site longitude */
252 int setSiteLongitude(int fd, double Long);
253 /* Set current site latitude */
254 int setSiteLatitude(int fd, double Lat);
255 /* Set Object Azimuth */
256 int setObjAz(int fd, double az);
257 /* Set Object Altitude */
258 int setObjAlt(int fd, double alt);
259 /* Set site name */
260 int setSiteName(int fd, char *siteName, int siteNum);
261 /* Set maximum slew rate */
262 int setMaxSlewRate(int fd, int slewRate);
263 /* Set focuser motion */
264 int setFocuserMotion(int fd, int motionType);
265 /* SET GPS Focuser raneg (1 to 4) */
266 int setGPSFocuserSpeed(int fd, int speed);
267 /* Set focuser speed mode */
268 int setFocuserSpeedMode(int fd, int speedMode);
269 /* Set minimum elevation limit */
270 int setMinElevationLimit(int fd, int min);
271 /* Set maximum elevation limit */
272 int setMaxElevationLimit(int fd, int max);
273 
274 /**************************************************************************
275  Motion Commands
276  **************************************************************************/
277 /* Slew to the selected coordinates */
278 int Slew(int fd);
279 /* Synchronize to the selected coordinates and return the matching object if any */
280 int Sync(int fd, char *matchedObject);
281 /* Abort slew in all axes */
282 int abortSlew(int fd);
283 /* Move into one direction, two valid directions can be stacked */
284 int MoveTo(int fd, int direction);
285 /* Halt movement in a particular direction */
286 int HaltMovement(int fd, int direction);
287 /* Select the tracking mode */
288 int selectTrackingMode(int fd, int trackMode);
289 /* Select Astro-Physics tracking mode */
290 int selectAPTrackingMode(int fd, int trackMode);
291 /* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
292 int SendPulseCmd(int fd, int direction, int duration_msec);
293 
294 /**************************************************************************
295  Other Commands
296  **************************************************************************/
297 /* Ensures IEQ45 RA/DEC format is long */
298 int checkIEQ45Format(int fd);
299 /* Select a site from the IEQ45 controller */
300 int selectSite(int fd, int siteNum);
301 /* Select a catalog object */
302 int selectCatalogObject(int fd, int catalog, int NNNN);
303 /* Select a sub catalog */
304 int selectSubCatalog(int fd, int catalog, int subCatalog);
305 
306 #ifdef __cplusplus
307 }
308 #endif
setTrackFreq
int setTrackFreq(int fd, double trackF)
Definition: lx200driver.cpp:1366
getNumberOfBars
int getNumberOfBars(int fd, int *value)
Definition: ieq45driver8406.c:502
setObjAlt
int setObjAlt(int fd, double alt)
Definition: lx200driver.cpp:1192
Slew
int Slew(int fd)
Definition: lx200driver.cpp:1396
getTimeFormat
int getTimeFormat(int fd, int *format)
Definition: lx200driver.cpp:438
HaltMovement
int HaltMovement(int fd, int direction)
Definition: lx200driver.cpp:1500
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
StarCatalog
StarCatalog
Definition: lx200driver.h:87
TFocusMotion
TFocusMotion
Definition: lx200driver.h:69
setCalenderDate
int setCalenderDate(int fd, int dd, int mm, int yy)
Definition: lx200driver.cpp:1047
abortSlew
int abortSlew(int fd)
Definition: lx200driver.cpp:1544
updateIntelliscopeCoord
int updateIntelliscopeCoord(int fd, double *ra, double *dec)
Definition: ieq45driver8406.c:609
fd
int fd
Definition: indiserver.c:117
IEQ45_AM
@ IEQ45_AM
Definition: ieq45driver.h:58
TAlign
TAlign
Definition: lx200driver.h:32
IEQ45_CALDWELL
@ IEQ45_CALDWELL
Definition: ieq45driver.h:92
min
double min(void)
setCommandXYZ
int setCommandXYZ(int fd, int x, int y, int z, const char *cmd)
Definition: lx200driver.cpp:1004
TSlew
TSlew
Definition: lx200driver.h:24
TTimeFormat
TTimeFormat
Definition: lx200driver.h:62
IEQ45_STAR
@ IEQ45_STAR
Definition: ieq45driver.h:82
getCommandInt
int getCommandInt(int fd, int *value, const char *cmd)
Definition: lx200driver.cpp:278
IEQ45_NORTH
@ IEQ45_NORTH
Definition: ieq45driver.h:42
setGPSFocuserSpeed
int setGPSFocuserSpeed(int fd, int speed)
Definition: lx200driver.cpp:1335
TCatalog
TCatalog
Definition: lx200driver.h:81
getOTATemp
int getOTATemp(int fd, double *value)
Definition: lx200driver.cpp:779
IEQ45_FOCUSFAST
@ IEQ45_FOCUSFAST
Definition: ieq45driver.h:71
getTrackFreq
int getTrackFreq(int fd, double *value)
Definition: lx200driver.cpp:703
setFocuserSpeedMode
int setFocuserSpeedMode(int fd, int speedMode)
Definition: lx200driver.cpp:1303
setObjectDEC
int setObjectDEC(int fd, double dec)
Definition: lx200driver.cpp:959
setMaxElevationLimit
int setMaxElevationLimit(int fd, int max)
Definition: lx200driver.cpp:893
IEQ45_GCVS
@ IEQ45_GCVS
Definition: ieq45driver.h:84
IEQ45_SLEW_MAX
@ IEQ45_SLEW_MAX
Definition: ieq45driver.h:27
IEQ45_FOCUSSLOW
@ IEQ45_FOCUSSLOW
Definition: ieq45driver.h:70
setAlignmentMode
int setAlignmentMode(int fd, unsigned int alignMode)
Definition: lx200driver.cpp:1016
IEQ45_SHORT_FORMAT
@ IEQ45_SHORT_FORMAT
Definition: ieq45driver.h:51
max
double max(void)
IEQ45_NGC
@ IEQ45_NGC
Definition: ieq45driver.h:89
getCommandString
int getCommandString(int fd, char *data, const char *cmd)
Definition: lx200driver.cpp:321
IEQ45_ARP
@ IEQ45_ARP
Definition: ieq45driver.h:93
IEQ45_TRACK_ZERO
@ IEQ45_TRACK_ZERO
Definition: ieq45driver.h:103
TFreq
TFreq
Definition: lx200driver.h:105
IEQ45_LONG_FORMAT
@ IEQ45_LONG_FORMAT
Definition: ieq45driver.h:52
getCalendarDate
int getCalendarDate(int fd, char *date)
Definition: lx200driver.cpp:398
getCommandSexa
int getCommandSexa(int fd, double *value, const char *cmd)
Definition: lx200driver.cpp:241
setUTCOffset
int setUTCOffset(int fd, double hours)
Definition: lx200driver.cpp:1096
ra
double ra
Definition: ieqprolegacydriver.cpp:43
IEQ45_STAR_C
@ IEQ45_STAR_C
Definition: ieq45driver.h:76
setMaxSlewRate
int setMaxSlewRate(int fd, int slewRate)
Definition: lx200driver.cpp:907
IEQ45_UGC
@ IEQ45_UGC
Definition: ieq45driver.h:91
IEQ45_SAO
@ IEQ45_SAO
Definition: ieq45driver.h:83
IEQ45_FOCUSIN
@ IEQ45_FOCUSIN
Definition: ieq45driver.h:64
setMinElevationLimit
int setMinElevationLimit(int fd, int min)
Definition: lx200driver.cpp:883
setSlewMode
int setSlewMode(int fd, int slewMode)
Definition: lx200driver.cpp:1237
setSiteLongitude
int setSiteLongitude(int fd, double Long)
Definition: lx200driver.cpp:1114
getSiteLatitude
int getSiteLatitude(int fd, int *dd, int *mm)
Definition: ieq45driver8406.c:403
IEQ45_MESSIER_C
@ IEQ45_MESSIER_C
Definition: ieq45driver.h:95
IEQ45_TRACK_SOLAR
@ IEQ45_TRACK_SOLAR
Definition: ieq45driver.h:102
setObjAz
int setObjAz(int fd, double az)
Definition: lx200driver.cpp:1176
dec
double dec
Definition: ieqprolegacydriver.cpp:44
IEQ45_EAST
@ IEQ45_EAST
Definition: ieq45driver.h:44
IEQ45_DEEPSKY_C
@ IEQ45_DEEPSKY_C
Definition: ieq45driver.h:77
updateSkyCommanderCoord
int updateSkyCommanderCoord(int fd, double *ra, double *dec)
Definition: ieq45driver8406.c:579
getSiteName
int getSiteName(int fd, char *siteName, int siteNum)
Definition: lx200driver.cpp:480
setSiteLatitude
int setSiteLatitude(int fd, double Lat)
Definition: lx200driver.cpp:1145
IEQ45_ALIGN_LAND
@ IEQ45_ALIGN_LAND
Definition: ieq45driver.h:37
check_IEQ45_connection
int check_IEQ45_connection(int fd)
Definition: ieq45driver8406.c:146
IEQ45_TRACK_SIDERAL
@ IEQ45_TRACK_SIDERAL
Definition: ieq45driver.h:100
setObjectRA
int setObjectRA(int fd, double ra)
Definition: lx200driver.cpp:924
IEQ45_HALTFOCUS
@ IEQ45_HALTFOCUS
Definition: ieq45driver.h:69
MoveTo
int MoveTo(int fd, int direction)
Definition: lx200driver.cpp:1432
selectSite
int selectSite(int fd, int siteNum)
Definition: lx200driver.cpp:1592
selectAPTrackingMode
int selectAPTrackingMode(int fd, int trackMode)
Definition: lx200apdriver.cpp:459
getHomeSearchStatus
int getHomeSearchStatus(int fd, int *status)
Definition: lx200driver.cpp:742
IEQ45_ALL
@ IEQ45_ALL
Definition: ieq45driver.h:46
setCommandInt
int setCommandInt(int fd, int data, const char *cmd)
Definition: lx200driver.cpp:855
IEQ45_PM
@ IEQ45_PM
Definition: ieq45driver.h:59
IEQ45_SLEW_GUIDE
@ IEQ45_SLEW_GUIDE
Definition: ieq45driver.h:30
setFocuserMotion
int setFocuserMotion(int fd, int motionType)
Definition: lx200driver.cpp:1276
IEQ45_SLEW_CENTER
@ IEQ45_SLEW_CENTER
Definition: ieq45driver.h:29
TFormat
TFormat
Definition: ieq45driver.h:49
IEQ45_SOUTH
@ IEQ45_SOUTH
Definition: ieq45driver.h:45
IEQ45_ALIGN_POLAR
@ IEQ45_ALIGN_POLAR
Definition: ieq45driver.h:35
IEQ45_WEST
@ IEQ45_WEST
Definition: ieq45driver.h:43
IEQ45_FOCUSOUT
@ IEQ45_FOCUSOUT
Definition: ieq45driver.h:65
setStandardProcedure
int setStandardProcedure(int fd, char *writeData)
Definition: ieq45driver8406.c:657
SendPulseCmd
int SendPulseCmd(int fd, int direction, int duration_msec)
Definition: lx200driver.cpp:1466
IEQ45_ALIGN_ALTAZ
@ IEQ45_ALIGN_ALTAZ
Definition: ieq45driver.h:36
ACK
char ACK(int fd)
Definition: lx200driver.cpp:213
selectCatalogObject
int selectCatalogObject(int fd, int catalog, int NNNN)
Definition: lx200driver.cpp:1632
IEQ45_SLEW_FIND
@ IEQ45_SLEW_FIND
Definition: ieq45driver.h:28
TFocusSpeed
TFocusSpeed
Definition: lx200driver.h:74
Sync
int Sync(int fd, char *matchedObject)
Definition: lx200driver.cpp:1561
getSiteLongitude
int getSiteLongitude(int fd, int *ddd, int *mm)
Definition: ieq45driver8406.c:434
setSiteName
int setSiteName(int fd, char *siteName, int siteNum)
Definition: lx200driver.cpp:1208
IEQ45_IC
@ IEQ45_IC
Definition: ieq45driver.h:90
selectTrackingMode
int selectTrackingMode(int fd, int trackMode)
Definition: lx200driver.cpp:1790
DeepSkyCatalog
DeepSkyCatalog
Definition: lx200driver.h:94
TDirection
TDirection
Definition: lx200driver.h:39
IEQ45_TRACK_LUNAR
@ IEQ45_TRACK_LUNAR
Definition: ieq45driver.h:101
IEQ45_ABELL
@ IEQ45_ABELL
Definition: ieq45driver.h:94
checkIEQ45Format
int checkIEQ45Format(int fd)
Definition: ieq45driver8406.c:1363
IEQ45_24
@ IEQ45_24
Definition: ieq45driver.h:57
selectSubCatalog
int selectSubCatalog(int fd, int catalog, int subCatalog)
Definition: lx200driver.cpp:1667