Instrument Neutral Distributed Interface INDI 2.2.5
ieq45driver8407.c
Go to the documentation of this file.
1#if 0
2 IEQ45 Driver
3 Copyright (C) 2011 Nacho Mas ([email protected]). Only litle changes
4 from lx200basic made it by Jasem Mutlaq ([email protected])
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 NOTES on 9407 vs 8406:
21 .-Diferente init V#,
22 .- Diferent response to :MS#
23 .- Diff RT0,1, .. codification
24
25#endif
26
27#include "ieq45driver.h"
28
29#include "indicom.h"
30#include "indidevapi.h"
31
32#ifndef _WIN32
33#include <termios.h>
34#endif
35
36#define IEQ45_TIMEOUT 5 /* FD timeout in seconds */
37
39int is8407ver = 0;
40
41/**************************************************************************
42 Diagnostics
43 **************************************************************************/
45
46/**************************************************************************
47 Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
48 **************************************************************************/
49
50/* Get Double from Sexagisemal */
51int getCommandSexa(int fd, double *value, const char *cmd);
52/* Get String */
53int getCommandString(int fd, char *data, const char *cmd);
54/* Get Int */
55int getCommandInt(int fd, int *value, const char *cmd);
56/* Get tracking frequency */
57int getTrackFreq(int fd, double *value);
58/* Get site Latitude */
59int getSiteLatitude(int fd, int *dd, int *mm);
60/* Get site Longitude */
61int getSiteLongitude(int fd, int *ddd, int *mm);
62/* Get Calender data */
63int getCalendarDate(int fd, char *date);
64/* Get site Name */
65int getSiteName(int fd, char *siteName, int siteNum);
66/* Get Number of Bars */
67int getNumberOfBars(int fd, int *value);
68/* Get Home Search Status */
69int getHomeSearchStatus(int fd, int *status);
70/* Get OTA Temperature */
71int getOTATemp(int fd, double *value);
72/* Get time format: 12 or 24 */
73int getTimeFormat(int fd, int *format);
74
75/**************************************************************************
76 Set Commands
77 **************************************************************************/
78
79/* Set Int */
80int setCommandInt(int fd, int data, const char *cmd);
81/* Set Sexigesimal */
82int setCommandXYZ(int fd, int x, int y, int z, const char *cmd);
83/* Common routine for Set commands */
84int setStandardProcedure(int fd, char *writeData);
85/* Set Slew Mode */
86int setSlewMode(int fd, int slewMode);
87/* Set Alignment mode */
88int setAlignmentMode(int fd, unsigned int alignMode);
89/* Set Object RA */
90int setObjectRA(int fd, double ra);
91/* set Object DEC */
92int setObjectDEC(int fd, double dec);
93/* Set Calender date */
94int setCalenderDate(int fd, int dd, int mm, int yy);
95/* Set UTC offset */
96int setUTCOffset(int fd, double hours);
97/* Set Track Freq */
98int setTrackFreq(int fd, double trackF);
99/* Set current site longitude */
100int setSiteLongitude(int fd, double Long);
101/* Set current site latitude */
102int setSiteLatitude(int fd, double Lat);
103/* Set Object Azimuth */
104int setObjAz(int fd, double az);
105/* Set Object Altitude */
106int setObjAlt(int fd, double alt);
107/* Set site name */
108int setSiteName(int fd, char *siteName, int siteNum);
109/* Set maximum slew rate */
110int setMaxSlewRate(int fd, int slewRate);
111/* Set focuser motion */
112int setFocuserMotion(int fd, int motionType);
113/* Set focuser speed mode */
114int setFocuserSpeedMode(int fd, int speedMode);
115/* Set minimum elevation limit */
116int setMinElevationLimit(int fd, int min);
117/* Set maximum elevation limit */
118int setMaxElevationLimit(int fd, int max);
119
120/**************************************************************************
121 Motion Commands
122 **************************************************************************/
123/* Slew to the selected coordinates */
124int Slew(int fd);
125/* Synchronize to the selected coordinates and return the matching object if any */
126int Sync(int fd, char *matchedObject);
127/* Abort slew in all axes */
128int abortSlew(int fd);
129/* Move into one direction, two valid directions can be stacked */
130int MoveTo(int fd, int direction);
131/* Half movement in a particular direction */
132int HaltMovement(int fd, int direction);
133/* Select the tracking mode */
134int selectTrackingMode(int fd, int trackMode);
135/* Select Astro-Physics tracking mode */
136int selectAPTrackingMode(int fd, int trackMode);
137/* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
138int SendPulseCmd(int fd, int direction, int duration_msec);
139
140/**************************************************************************
141 Other Commands
142 **************************************************************************/
143/* Ensures IEQ45 RA/DEC format is long */
144int checkIEQ45Format(int fd);
145/* Select a site from the IEQ45 controller */
146int selectSite(int fd, int siteNum);
147/* Select a catalog object */
148int selectCatalogObject(int fd, int catalog, int NNNN);
149/* Select a sub catalog */
150int selectSubCatalog(int fd, int catalog, int subCatalog);
151
153{
154 int i = 0;
155 char firmwareVersion[] = ":V#";
156 char MountInfo[] = ":MountInfo#";
157 char response[64];
158 int nbytes_read = 0;
159
160#ifdef INDI_DEBUG
161 IDLog("Testing telescope's connection using :V# command...\n");
162#endif
163
164 if (in_fd <= 0)
165 return -1;
166
167 for (i = 0; i < 2; i++)
168 {
169 if (write(in_fd, firmwareVersion, sizeof(firmwareVersion)) < 0)
170 return -1;
171 tty_read(in_fd, response, 1, IEQ45_TIMEOUT, &nbytes_read);
172 if (nbytes_read != 1)
173 return -1;
174 usleep(50000);
175 }
176
177#ifdef INDI_DEBUG
178 IDLog("Initializating telescope's using :MountInfo# command...\n");
179#endif
180
181 for (i = 0; i < 2; i++)
182 {
183 if (write(in_fd, MountInfo, sizeof(MountInfo)) < 0)
184 return -1;
185 tty_read(in_fd, response, 1, IEQ45_TIMEOUT, &nbytes_read);
186 if (nbytes_read == 1)
187 return 0;
188 usleep(50000);
189 }
190
191 return -1;
192}
193
194/**********************************************************************
195* GET
196**********************************************************************/
197void remove_spaces(char *texto_recibe)
198{
199 char *texto_sin_espacio;
200 for (texto_sin_espacio = texto_recibe; *texto_recibe; texto_recibe++)
201 {
202 if (isspace(*texto_recibe))
203 continue;
204 *texto_sin_espacio++ = *texto_recibe;
205 }
206 *texto_sin_espacio = '\0';
207}
208
209int getCommandSexa(int fd, double *value, const char *cmd)
210{
211 char temp_string[16];
212 int error_type;
213 int nbytes_write = 0, nbytes_read = 0;
214
215 tcflush(fd, TCIFLUSH);
216 if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK)
217 return error_type;
218
219 /*if ( (read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT)) < 1)
220 return read_ret;*/
221 tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
222
223 temp_string[nbytes_read - 1] = '\0';
224
225 /*IDLog("getComandSexa: %s\n", temp_string);*/
226 //IEQ45 sometimes send a malformed RA/DEC (intermediate spaces)
227 //so I clean before:
228 remove_spaces(temp_string);
229
230 if (f_scansexa(temp_string, value))
231 {
232#ifdef INDI_DEBUG
233 IDLog("unable to process [%s]\n", temp_string);
234#endif
235 return -1;
236 }
237
238 tcflush(fd, TCIFLUSH);
239 return 0;
240}
241
242int getCommandInt(int fd, int *value, const char *cmd)
243{
244 char temp_string[16];
245 float temp_number;
246 int error_type;
247 int nbytes_write = 0, nbytes_read = 0;
248
249 tcflush(fd, TCIFLUSH);
250
251 if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK)
252 return error_type;
253
254 tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
255
256 temp_string[nbytes_read - 1] = '\0';
257
258 /* Float */
259 if (strchr(temp_string, '.'))
260 {
261 if (sscanf(temp_string, "%f", &temp_number) != 1)
262 return -1;
263
264 *value = (int)temp_number;
265 }
266 /* Int */
267 else if (sscanf(temp_string, "%d", value) != 1)
268 return -1;
269
270 return 0;
271}
272
273int getCommandString(int fd, char *data, const char *cmd)
274{
275 char *term;
276 int error_type;
277 int nbytes_write = 0, nbytes_read = 0;
278
279 /*if (portWrite(cmd) < 0)
280 return -1;*/
281
282 if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK)
283 return error_type;
284
285 /*read_ret = portRead(data, -1, IEQ45_TIMEOUT);*/
286 error_type = tty_read_section(fd, data, '#', IEQ45_TIMEOUT, &nbytes_read);
287 tcflush(fd, TCIFLUSH);
288
289 if (error_type != TTY_OK)
290 return error_type;
291
292 term = strchr(data, '#');
293 if (term)
294 *term = '\0';
295
296#ifdef INDI_DEBUG
297/*IDLog("Requested data: %s\n", data);*/
298#endif
299
300 return 0;
301}
302
303int getCalendarDate(int fd, char *date)
304{
305 int dd, mm, yy;
306 int error_type;
307 int nbytes_read = 0;
308 char mell_prefix[3];
309
310 if ((error_type = getCommandString(fd, date, ":GC#")))
311 return error_type;
312
313 /* Meade format is MM/DD/YY */
314
315 nbytes_read = sscanf(date, "%d%*c%d%*c%d", &mm, &dd, &yy);
316 if (nbytes_read < 3)
317 return -1;
318
319 /* We consider years 50 or more to be in the last century, anything less in the 21st century.*/
320 if (yy > 50)
321 strncpy(mell_prefix, "19", 3);
322 else
323 strncpy(mell_prefix, "20", 3);
324
325 /* We need to have in in YYYY/MM/DD format */
326 snprintf(date, 16, "%s%02d/%02d/%02d", mell_prefix, yy, mm, dd);
327
328 return (0);
329}
330
331int getTimeFormat(int fd, int *format)
332{
333 char temp_string[16];
334 int error_type;
335 int nbytes_write = 0, nbytes_read = 0;
336 int tMode;
337
338 /*if (portWrite(":Gc#") < 0)
339 return -1;*/
340
341 if ((error_type = tty_write_string(fd, ":Gc#", &nbytes_write)) != TTY_OK)
342 return error_type;
343
344 /*read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT);*/
345 if ((error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read)) != TTY_OK)
346 return error_type;
347
348 tcflush(fd, TCIFLUSH);
349
350 if (nbytes_read < 1)
351 return error_type;
352
353 temp_string[nbytes_read - 1] = '\0';
354
355 nbytes_read = sscanf(temp_string, "(%d)", &tMode);
356
357 if (nbytes_read < 1)
358 return -1;
359 else
360 *format = tMode;
361
362 return 0;
363}
364
365int getSiteName(int fd, char *siteName, int siteNum)
366{
367 char *term;
368 int error_type;
369 int nbytes_write = 0, nbytes_read = 0;
370
371 switch (siteNum)
372 {
373 case 1:
374 /*if (portWrite(":GM#") < 0)
375 return -1;*/
376 if ((error_type = tty_write_string(fd, ":GM#", &nbytes_write)) != TTY_OK)
377 return error_type;
378 break;
379 case 2:
380 /*if (portWrite(":GN#") < 0)
381 return -1;*/
382 if ((error_type = tty_write_string(fd, ":GN#", &nbytes_write)) != TTY_OK)
383 return error_type;
384 break;
385 case 3:
386 /*if (portWrite(":GO#") < 0)
387 return -1;*/
388 if ((error_type = tty_write_string(fd, ":GO#", &nbytes_write)) != TTY_OK)
389 return error_type;
390 break;
391 case 4:
392 /*if (portWrite(":GP#") < 0)
393 return -1;*/
394 if ((error_type = tty_write_string(fd, ":GP#", &nbytes_write)) != TTY_OK)
395 return error_type;
396 break;
397 default:
398 return -1;
399 }
400
401 /*read_ret = portRead(siteName, -1, IEQ45_TIMEOUT);*/
402 error_type = tty_read_section(fd, siteName, '#', IEQ45_TIMEOUT, &nbytes_read);
403 tcflush(fd, TCIFLUSH);
404
405 if (nbytes_read < 1)
406 return error_type;
407
408 siteName[nbytes_read - 1] = '\0';
409
410 term = strchr(siteName, ' ');
411 if (term)
412 *term = '\0';
413
414 term = strchr(siteName, '<');
415 if (term)
416 strcpy(siteName, "unused site");
417
418#ifdef INDI_DEBUG
419 IDLog("Requested site name: %s\n", siteName);
420#endif
421
422 return 0;
423}
424
425int getSiteLatitude(int fd, int *dd, int *mm)
426{
427 char temp_string[16];
428 int error_type;
429 int nbytes_write = 0, nbytes_read = 0;
430
431 /*if (portWrite(":Gt#") < 0)
432 return -1;*/
433 if ((error_type = tty_write_string(fd, ":Gt#", &nbytes_write)) != TTY_OK)
434 return error_type;
435
436 /*read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT);*/
437 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
438 tcflush(fd, TCIFLUSH);
439
440 if (nbytes_read < 1)
441 return error_type;
442
443 temp_string[nbytes_read - 1] = '\0';
444
445 if (sscanf(temp_string, "%d%*c%d", dd, mm) < 2)
446 return -1;
447
448#ifdef INDI_DEBUG
449 fprintf(stderr, "Requested site latitude in String %s\n", temp_string);
450 fprintf(stderr, "Requested site latitude %d:%d\n", *dd, *mm);
451#endif
452
453 return 0;
454}
455
456int getSiteLongitude(int fd, int *ddd, int *mm)
457{
458 char temp_string[16];
459 int error_type;
460 int nbytes_write = 0, nbytes_read = 0;
461
462 if ((error_type = tty_write_string(fd, ":Gg#", &nbytes_write)) != TTY_OK)
463 return error_type;
464
465 /*if (portWrite(":Gg#") < 0)
466 return -1;*/
467 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
468 /*read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT);*/
469
470 tcflush(fd, TCIFLUSH);
471
472 if (nbytes_read < 1)
473 return error_type;
474
475 temp_string[nbytes_read - 1] = '\0';
476
477 if (sscanf(temp_string, "%d%*c%d", ddd, mm) < 2)
478 return -1;
479
480#ifdef INDI_DEBUG
481 fprintf(stderr, "Requested site longitude in String %s\n", temp_string);
482 fprintf(stderr, "Requested site longitude %d:%d\n", *ddd, *mm);
483#endif
484
485 return 0;
486}
487
488int getTrackFreq(int fd, double *value)
489{
490 float Freq;
491 char temp_string[16];
492 int error_type;
493 int nbytes_write = 0, nbytes_read = 0;
494
495 if ((error_type = tty_write_string(fd, ":GT#", &nbytes_write)) != TTY_OK)
496 return error_type;
497
498 /*if (portWrite(":GT#") < 0)
499 return -1;*/
500
501 /*read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT);*/
502 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
503 tcflush(fd, TCIFLUSH);
504
505 if (nbytes_read < 1)
506 return error_type;
507
508 temp_string[nbytes_read] = '\0';
509
510 /*fprintf(stderr, "Telescope tracking freq str: %s\n", temp_string);*/
511
512 if (sscanf(temp_string, "%f#", &Freq) < 1)
513 return -1;
514
515 *value = (double)Freq;
516
517#ifdef INDI_DEBUG
518 fprintf(stderr, "Tracking frequency value is %f\n", Freq);
519#endif
520
521 return 0;
522}
523
524int getNumberOfBars(int fd, int *value)
525{
526 char temp_string[128];
527 int error_type;
528 int nbytes_write = 0, nbytes_read = 0;
529
530 if ((error_type = tty_write_string(fd, ":D#", &nbytes_write)) != TTY_OK)
531 return error_type;
532 /*if (portWrite(":D#") < 0)
533 return -1;*/
534
535 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
536 tcflush(fd, TCIFLUSH);
537
538 if (nbytes_read < 0)
539 return error_type;
540
541 *value = nbytes_read - 1;
542
543 return 0;
544}
545
546int getHomeSearchStatus(int fd, int *status)
547{
548 char temp_string[16];
549 int error_type;
550 int nbytes_write = 0, nbytes_read = 0;
551
552 if ((error_type = tty_write_string(fd, ":h?#", &nbytes_write)) != TTY_OK)
553 return error_type;
554 /*if (portWrite(":h?#") < 0)
555 return -1;*/
556
557 /*read_ret = portRead(temp_string, 1, IEQ45_TIMEOUT);*/
558 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
559 tcflush(fd, TCIFLUSH);
560
561 if (nbytes_read < 1)
562 return error_type;
563
564 temp_string[1] = '\0';
565
566 if (temp_string[0] == '0')
567 *status = 0;
568 else if (temp_string[0] == '1')
569 *status = 1;
570 else if (temp_string[0] == '2')
571 *status = 1;
572
573 return 0;
574}
575
576int getOTATemp(int fd, double *value)
577{
578 char temp_string[16];
579 int error_type;
580 int nbytes_write = 0, nbytes_read = 0;
581 float temp;
582
583 if ((error_type = tty_write_string(fd, ":fT#", &nbytes_write)) != TTY_OK)
584 return error_type;
585
586 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
587
588 if (nbytes_read < 1)
589 return error_type;
590
591 temp_string[nbytes_read - 1] = '\0';
592
593 if (sscanf(temp_string, "%f", &temp) < 1)
594 return -1;
595
596 *value = (double)temp;
597
598 return 0;
599}
600
601int updateSkyCommanderCoord(int fd, double *ra, double *dec)
602{
603 char coords[16];
604 char CR[1] = { (char)0x0D };
605 float RA = 0.0, DEC = 0.0;
606 int error_type;
607 int nbytes_read = 0;
608
609 error_type = write(fd, CR, 1);
610
611 error_type = tty_read(fd, coords, 16, IEQ45_TIMEOUT, &nbytes_read);
612 /*read_ret = portRead(coords, 16, IEQ45_TIMEOUT);*/
613 tcflush(fd, TCIFLUSH);
614
615 nbytes_read = sscanf(coords, " %g %g", &RA, &DEC);
616
617 if (nbytes_read < 2)
618 {
619#ifdef INDI_DEBUG
620 IDLog("Error in Sky commander number format [%s], exiting.\n", coords);
621#endif
622 return error_type;
623 }
624
625 *ra = RA;
626 *dec = DEC;
627
628 return 0;
629}
630
631int updateIntelliscopeCoord(int fd, double *ra, double *dec)
632{
633 char coords[16];
634 char CR[1] = { (char)0x51 }; /* "Q" */
635 float RA = 0.0, DEC = 0.0;
636 int error_type;
637 int nbytes_read = 0;
638
639 /*IDLog ("Sending a Q\n");*/
640 error_type = write(fd, CR, 1);
641 /* We start at 14 bytes in case its a Sky Wizard,
642 but read one more later it if it's a intelliscope */
643 /*read_ret = portRead (coords, 14, IEQ45_TIMEOUT);*/
644 error_type = tty_read(fd, coords, 14, IEQ45_TIMEOUT, &nbytes_read);
645 tcflush(fd, TCIFLUSH);
646 /*IDLog ("portRead() = [%s]\n", coords);*/
647
648 /* Remove the Q in the response from the Intelliscope but not the Sky Wizard */
649 if (coords[0] == 'Q')
650 {
651 coords[0] = ' ';
652 /* Read one more byte if Intelliscope to get the "CR" */
653 error_type = tty_read(fd, coords, 1, IEQ45_TIMEOUT, &nbytes_read);
654 /*read_ret = portRead (coords, 1, IEQ45_TIMEOUT);*/
655 }
656 nbytes_read = sscanf(coords, " %g %g", &RA, &DEC);
657 /*IDLog ("sscanf() RA = [%f]\n", RA * 0.0390625);*/
658 /*IDLog ("sscanf() DEC = [%f]\n", DEC * 0.0390625);*/
659
660 /*IDLog ("Intelliscope output [%s]", coords);*/
661 if (nbytes_read < 2)
662 {
663#ifdef INDI_DEBUG
664 IDLog("Error in Intelliscope number format [%s], exiting.\n", coords);
665#endif
666 return -1;
667 }
668
669 *ra = RA * 0.0390625;
670 *dec = DEC * 0.0390625;
671
672 return 0;
673}
674
675/**********************************************************************
676* SET
677**********************************************************************/
678
679int setStandardProcedure(int fd, char *data)
680{
681 char bool_return[2];
682 int error_type;
683 int nbytes_write = 0, nbytes_read = 0;
684
685 if ((error_type = tty_write_string(fd, data, &nbytes_write)) != TTY_OK)
686 return error_type;
687
688 error_type = tty_read(fd, bool_return, 1, IEQ45_TIMEOUT, &nbytes_read);
689 /*read_ret = portRead(boolRet, 1, IEQ45_TIMEOUT);*/
690 tcflush(fd, TCIFLUSH);
691
692 if (nbytes_read < 1)
693 return error_type;
694
695 if (bool_return[0] == '0')
696 {
697#ifdef INDI_DEBUG
698 IDLog("%s Failed.\n", data);
699#endif
700 return -1;
701 }
702
703#ifdef INDI_DEBUG
704 IDLog("%s Successful\n", data);
705#endif
706
707 return 0;
708}
709
710int setCommandInt(int fd, int data, const char *cmd)
711{
712 char temp_string[16];
713 int error_type;
714 int nbytes_write = 0;
715
716 snprintf(temp_string, sizeof(temp_string), "%s%d#", cmd, data);
717
718 if ((error_type = tty_write_string(fd, temp_string, &nbytes_write)) != TTY_OK)
719 return error_type;
720
721 /* if (portWrite(temp_string) < 0)
722 return -1;*/
723
724 return 0;
725}
726
728{
729 char temp_string[16];
730
731 snprintf(temp_string, sizeof(temp_string), ":Sh%02d#", min);
732
733 return (setStandardProcedure(fd, temp_string));
734}
735
737{
738 char temp_string[16];
739
740 snprintf(temp_string, sizeof(temp_string), ":So%02d*#", max);
741
742 return (setStandardProcedure(fd, temp_string));
743}
744
745int setMaxSlewRate(int fd, int slewRate)
746{
747 char temp_string[16];
748
749 if (slewRate < 2 || slewRate > 8)
750 return -1;
751
752 snprintf(temp_string, sizeof(temp_string), ":Sw%d#", slewRate);
753
754 return (setStandardProcedure(fd, temp_string));
755}
756
757int setObjectRA(int fd, double ra)
758{
759 int h, m, s, frac_m;
760 char temp_string[16];
761
762 getSexComponents(ra, &h, &m, &s);
763
764 frac_m = (s / 60.0) * 10.;
765
767 snprintf(temp_string, sizeof(temp_string), ":Sr %02d:%02d:%02d#", h, m, s);
768 else
769 snprintf(temp_string, sizeof(temp_string), ":Sr %02d:%02d.%01d#", h, m, frac_m);
770
771 /*IDLog("Set Object RA String %s\n", temp_string);*/
772 return (setStandardProcedure(fd, temp_string));
773}
774
775int setObjectDEC(int fd, double dec)
776{
777 int d, m, s;
778 char temp_string[16];
779
780 getSexComponents(dec, &d, &m, &s);
781
782 switch (controller_format)
783 {
785 /* case with negative zero */
786 if (!d && dec < 0)
787 snprintf(temp_string, sizeof(temp_string), ":Sd -%02d*%02d#", d, m);
788 else
789 snprintf(temp_string, sizeof(temp_string), ":Sd %+03d*%02d#", d, m);
790 break;
791
793 /* case with negative zero */
794 if (!d && dec < 0)
795 snprintf(temp_string, sizeof(temp_string), ":Sd -%02d:%02d:%02d#", d, m, s);
796 else
797 snprintf(temp_string, sizeof(temp_string), ":Sd %+03d:%02d:%02d#", d, m, s);
798 break;
799 }
800
801 /*IDLog("Set Object DEC String %s\n", temp_string);*/
802
803 return (setStandardProcedure(fd, temp_string));
804}
805
806int setCommandXYZ(int fd, int x, int y, int z, const char *cmd)
807{
808 char temp_string[16];
809
810 snprintf(temp_string, sizeof(temp_string), "%s %02d:%02d:%02d#", cmd, x, y, z);
811
812 return (setStandardProcedure(fd, temp_string));
813}
814
815int setAlignmentMode(int fd, unsigned int alignMode)
816{
817 /*fprintf(stderr , "Set alignment mode %d\n", alignMode);*/
818 int error_type;
819 int nbytes_write = 0;
820
821 switch (alignMode)
822 {
824 if ((error_type = tty_write_string(fd, ":AP#", &nbytes_write)) != TTY_OK)
825 return error_type;
826 /*if (portWrite(":AP#") < 0)
827 return -1;*/
828 break;
830 if ((error_type = tty_write_string(fd, ":AA#", &nbytes_write)) != TTY_OK)
831 return error_type;
832 /*if (portWrite(":AA#") < 0)
833 return -1;*/
834 break;
835 case IEQ45_ALIGN_LAND:
836 if ((error_type = tty_write_string(fd, ":AL#", &nbytes_write)) != TTY_OK)
837 return error_type;
838 /*if (portWrite(":AL#") < 0)
839 return -1;*/
840 break;
841 }
842
843 tcflush(fd, TCIFLUSH);
844 return 0;
845}
846
847int setCalenderDate(int fd, int dd, int mm, int yy)
848{
849 char temp_string[32];
850 char dumpPlanetaryUpdateString[64];
851 char bool_return[2];
852 int error_type;
853 int nbytes_write = 0, nbytes_read = 0;
854 yy = yy % 100;
855
856 snprintf(temp_string, sizeof(temp_string), ":SC %02d/%02d/%02d#", mm, dd, yy);
857
858 if ((error_type = tty_write_string(fd, temp_string, &nbytes_write)) != TTY_OK)
859 return error_type;
860
861 /*if (portWrite(temp_string) < 0)
862 return -1;*/
863
864 /*read_ret = portRead(boolRet, 1, IEQ45_TIMEOUT);*/
865 error_type = tty_read(fd, bool_return, 1, IEQ45_TIMEOUT, &nbytes_read);
866 tcflush(fd, TCIFLUSH);
867
868 if (nbytes_read < 1)
869 return error_type;
870
871 bool_return[1] = '\0';
872
873 if (bool_return[0] == '0')
874 return -1;
875
876 /* Read dumped data */
877 error_type = tty_read_section(fd, dumpPlanetaryUpdateString, '#', IEQ45_TIMEOUT, &nbytes_read);
878 error_type = tty_read_section(fd, dumpPlanetaryUpdateString, '#', 5, &nbytes_read);
879
880 return 0;
881}
882
883int setUTCOffset(int fd, double hours)
884{
885 char temp_string[16];
886
887 snprintf(temp_string, sizeof(temp_string), ":SG %+03d#", (int)hours);
888
889 /*IDLog("UTC string is %s\n", temp_string);*/
890
891 return (setStandardProcedure(fd, temp_string));
892}
893
894int setSiteLongitude(int fd, double Long)
895{
896 int d, m, s;
897 char temp_string[32];
898
899 getSexComponents(Long, &d, &m, &s);
900
901 snprintf(temp_string, sizeof(temp_string), ":Sg%03d:%02d#", d, m);
902
903 return (setStandardProcedure(fd, temp_string));
904}
905
906int setSiteLatitude(int fd, double Lat)
907{
908 int d, m, s;
909 char temp_string[32];
910
911 getSexComponents(Lat, &d, &m, &s);
912
913 snprintf(temp_string, sizeof(temp_string), ":St%+03d:%02d:%02d#", d, m, s);
914
915 return (setStandardProcedure(fd, temp_string));
916}
917
918int setObjAz(int fd, double az)
919{
920 int d, m, s;
921 char temp_string[16];
922
923 getSexComponents(az, &d, &m, &s);
924
925 snprintf(temp_string, sizeof(temp_string), ":Sz%03d:%02d#", d, m);
926
927 return (setStandardProcedure(fd, temp_string));
928}
929
930int setObjAlt(int fd, double alt)
931{
932 int d, m, s;
933 char temp_string[16];
934
935 getSexComponents(alt, &d, &m, &s);
936
937 snprintf(temp_string, sizeof(temp_string), ":Sa%+02d*%02d#", d, m);
938
939 return (setStandardProcedure(fd, temp_string));
940}
941
942int setSiteName(int fd, char *siteName, int siteNum)
943{
944 char temp_string[16];
945
946 switch (siteNum)
947 {
948 case 1:
949 snprintf(temp_string, sizeof(temp_string), ":SM %s#", siteName);
950 break;
951 case 2:
952 snprintf(temp_string, sizeof(temp_string), ":SN %s#", siteName);
953 break;
954 case 3:
955 snprintf(temp_string, sizeof(temp_string), ":SO %s#", siteName);
956 break;
957 case 4:
958 snprintf(temp_string, sizeof(temp_string), ":SP %s#", siteName);
959 break;
960 default:
961 return -1;
962 }
963
964 return (setStandardProcedure(fd, temp_string));
965}
966
967int setSlewMode(int fd, int slewMode)
968{
969 int error_type;
970 int nbytes_write = 0;
971
972 switch (slewMode)
973 {
974 case IEQ45_SLEW_MAX:
975 if ((error_type = tty_write_string(fd, ":RS#", &nbytes_write)) != TTY_OK)
976 return error_type;
977 /*if (portWrite(":RS#") < 0)
978 return -1;*/
979 break;
980 case IEQ45_SLEW_FIND:
981 if ((error_type = tty_write_string(fd, ":RM#", &nbytes_write)) != TTY_OK)
982 return error_type;
983 /*if (portWrite(":RM#") < 0)
984 return -1;*/
985 break;
987 if ((error_type = tty_write_string(fd, ":RC#", &nbytes_write)) != TTY_OK)
988 return error_type;
989 /*if (portWrite(":RC#") < 0)
990 return -1;*/
991 break;
992 case IEQ45_SLEW_GUIDE:
993 if ((error_type = tty_write_string(fd, ":RG#", &nbytes_write)) != TTY_OK)
994 return error_type;
995 /*if (portWrite(":RG#") < 0)
996 return -1;*/
997 break;
998 default:
999 break;
1000 }
1001
1002 tcflush(fd, TCIFLUSH);
1003 return 0;
1004}
1005
1006int setFocuserMotion(int fd, int motionType)
1007{
1008 int error_type;
1009 int nbytes_write = 0;
1010
1011 switch (motionType)
1012 {
1013 case IEQ45_FOCUSIN:
1014 if ((error_type = tty_write_string(fd, ":F+#", &nbytes_write)) != TTY_OK)
1015 return error_type;
1016#ifdef INDI_DEBUG
1017/*IDLog("Focus IN Command\n");*/
1018#endif
1019 /*if (portWrite(":F+#") < 0)
1020 return -1;*/
1021 break;
1022 case IEQ45_FOCUSOUT:
1023 if ((error_type = tty_write_string(fd, ":F-#", &nbytes_write)) != TTY_OK)
1024 return error_type;
1025#ifdef INDI_DEBUG
1026/*IDLog("Focus OUT Command\n");*/
1027#endif
1028 /*if (portWrite(":F-#") < 0)
1029 return -1;*/
1030 break;
1031 }
1032
1033 tcflush(fd, TCIFLUSH);
1034 return 0;
1035}
1036
1037int setFocuserSpeedMode(int fd, int speedMode)
1038{
1039 int error_type;
1040 int nbytes_write = 0;
1041
1042 switch (speedMode)
1043 {
1044 case IEQ45_HALTFOCUS:
1045 if ((error_type = tty_write_string(fd, ":FQ#", &nbytes_write)) != TTY_OK)
1046 return error_type;
1047#ifdef INDI_DEBUG
1048/*IDLog("Halt Focus Command\n");*/
1049#endif
1050 /* if (portWrite(":FQ#") < 0)
1051 return -1;*/
1052 break;
1053 case IEQ45_FOCUSSLOW:
1054 if ((error_type = tty_write_string(fd, ":FS#", &nbytes_write)) != TTY_OK)
1055 return error_type;
1056#ifdef INDI_DEBUG
1057/*IDLog("Focus Slow (FS) Command\n");*/
1058#endif
1059 /*if (portWrite(":FS#") < 0)
1060 return -1;*/
1061 break;
1062 case IEQ45_FOCUSFAST:
1063 if ((error_type = tty_write_string(fd, ":FF#", &nbytes_write)) != TTY_OK)
1064 return error_type;
1065#ifdef INDI_DEBUG
1066/*IDLog("Focus Fast (FF) Command\n");*/
1067#endif
1068 /*if (portWrite(":FF#") < 0)
1069 return -1;*/
1070 break;
1071 }
1072
1073 tcflush(fd, TCIFLUSH);
1074 return 0;
1075}
1076
1077int setGPSFocuserSpeed(int fd, int speed)
1078{
1079 char speed_str[8];
1080 int error_type;
1081 int nbytes_write = 0;
1082
1083 if (speed == 0)
1084 {
1085 /*if (portWrite(":FQ#") < 0)
1086 return -1;*/
1087 if ((error_type = tty_write_string(fd, ":FQ#", &nbytes_write)) != TTY_OK)
1088 return error_type;
1089#ifdef INDI_DEBUG
1090/*IDLog("GPS Focus HALT Command (FQ) \n");*/
1091#endif
1092
1093 return 0;
1094 }
1095
1096 snprintf(speed_str, 8, ":F%d#", speed);
1097
1098 if ((error_type = tty_write_string(fd, speed_str, &nbytes_write)) != TTY_OK)
1099 return error_type;
1100
1101#ifdef INDI_DEBUG
1102/*IDLog("GPS Focus Speed command %s \n", speed_str);*/
1103#endif
1104 /*if (portWrite(speed_str) < 0)
1105 return -1;*/
1106
1107 tcflush(fd, TCIFLUSH);
1108 return 0;
1109}
1110
1111int setTrackFreq(int fd, double trackF)
1112{
1113 char temp_string[16];
1114
1115 snprintf(temp_string, sizeof(temp_string), ":ST %04.1f#", trackF);
1116
1117 return (setStandardProcedure(fd, temp_string));
1118}
1119
1120/**********************************************************************
1121* Misc
1122*********************************************************************/
1123
1124int Slew(int fd)
1125{
1126 char slewNum[2];
1127 int error_type;
1128 int nbytes_write = 0, nbytes_read = 0;
1129
1130 if ((error_type = tty_write_string(fd, ":MS#", &nbytes_write)) != TTY_OK)
1131 return error_type;
1132
1133 error_type = tty_read(fd, slewNum, 1, IEQ45_TIMEOUT, &nbytes_read);
1134#ifdef INDI_DEBUG
1135//IDLog("SLEW _MS# %s %u \n", slewNum, nbytes_read);
1136#endif
1137
1138 if (nbytes_read < 1)
1139 return error_type;
1140
1141 /* We don't need to read the string message, just return corresponding error code */
1142 tcflush(fd, TCIFLUSH);
1143
1144 if (slewNum[0] == '1')
1145 return 0;
1146 else if (slewNum[0] == '0')
1147 return 1;
1148 else
1149 return 2;
1150}
1151
1152int MoveTo(int fd, int direction)
1153{
1154 int nbytes_write = 0;
1155
1156 switch (direction)
1157 {
1158 case IEQ45_NORTH:
1159 tty_write_string(fd, ":Mn#", &nbytes_write);
1160 /*portWrite(":Mn#");*/
1161 break;
1162 case IEQ45_WEST:
1163 tty_write_string(fd, ":Mw#", &nbytes_write);
1164 /*portWrite(":Mw#");*/
1165 break;
1166 case IEQ45_EAST:
1167 tty_write_string(fd, ":Me#", &nbytes_write);
1168 /*portWrite(":Me#");*/
1169 break;
1170 case IEQ45_SOUTH:
1171 tty_write_string(fd, ":Ms#", &nbytes_write);
1172 /*portWrite(":Ms#");*/
1173 break;
1174 default:
1175 break;
1176 }
1177
1178 tcflush(fd, TCIFLUSH);
1179 return 0;
1180}
1181
1182int SendPulseCmd(int fd, int direction, int duration_msec)
1183{
1184 int nbytes_write = 0;
1185 char cmd[20];
1186 switch (direction)
1187 {
1188 case IEQ45_NORTH:
1189 sprintf(cmd, ":Mgn%04d#", duration_msec);
1190 break;
1191 case IEQ45_SOUTH:
1192 sprintf(cmd, ":Mgs%04d#", duration_msec);
1193 break;
1194 case IEQ45_EAST:
1195 sprintf(cmd, ":Mge%04d#", duration_msec);
1196 break;
1197 case IEQ45_WEST:
1198 sprintf(cmd, ":Mgw%04d#", duration_msec);
1199 break;
1200 default:
1201 return 1;
1202 }
1203
1204 tty_write_string(fd, cmd, &nbytes_write);
1205
1206 tcflush(fd, TCIFLUSH);
1207 return 0;
1208}
1209
1210int HaltMovement(int fd, int direction)
1211{
1212 int error_type;
1213 int nbytes_write = 0;
1214
1215 switch (direction)
1216 {
1217 case IEQ45_NORTH:
1218 /*if (portWrite(":Qn#") < 0)
1219 return -1;*/
1220 if ((error_type = tty_write_string(fd, ":Qn#", &nbytes_write)) != TTY_OK)
1221 return error_type;
1222 break;
1223 case IEQ45_WEST:
1224 /*if (portWrite(":Qw#") < 0)
1225 return -1;*/
1226 if ((error_type = tty_write_string(fd, ":Qw#", &nbytes_write)) != TTY_OK)
1227 return error_type;
1228 break;
1229 case IEQ45_EAST:
1230 /*if (portWrite(":Qe#") < 0)
1231 return -1;*/
1232 if ((error_type = tty_write_string(fd, ":Qe#", &nbytes_write)) != TTY_OK)
1233 return error_type;
1234 break;
1235 case IEQ45_SOUTH:
1236 if ((error_type = tty_write_string(fd, ":Qs#", &nbytes_write)) != TTY_OK)
1237 return error_type;
1238 /*if (portWrite(":Qs#") < 0)
1239 return -1;*/
1240 break;
1241 case IEQ45_ALL:
1242 /*if (portWrite(":Q#") < 0)
1243 return -1;*/
1244 if ((error_type = tty_write_string(fd, ":Q#", &nbytes_write)) != TTY_OK)
1245 return error_type;
1246 break;
1247 default:
1248 return -1;
1249 break;
1250 }
1251
1252 tcflush(fd, TCIFLUSH);
1253 return 0;
1254}
1255
1257{
1258 /*if (portWrite(":Q#") < 0)
1259 return -1;*/
1260 int error_type;
1261 int nbytes_write = 0;
1262
1263 if ((error_type = tty_write_string(fd, ":Q#", &nbytes_write)) != TTY_OK)
1264 return error_type;
1265
1266 tcflush(fd, TCIFLUSH);
1267 return 0;
1268}
1269
1270int Sync(int fd, char *matchedObject)
1271{
1272 int error_type;
1273 int nbytes_write = 0, nbytes_read = 0;
1274
1275 // if ( (error_type = tty_write_string(fd, ":CM#", &nbytes_write)) != TTY_OK)
1276 if ((error_type = tty_write_string(fd, ":CMR#", &nbytes_write)) != TTY_OK)
1277 return error_type;
1278
1279 /*portWrite(":CM#");*/
1280
1281 /*read_ret = portRead(matchedObject, -1, IEQ45_TIMEOUT);*/
1282 error_type = tty_read_section(fd, matchedObject, '#', IEQ45_TIMEOUT, &nbytes_read);
1283
1284 if (nbytes_read < 1)
1285 return error_type;
1286
1287 matchedObject[nbytes_read - 1] = '\0';
1288
1289 /*IDLog("Matched Object: %s\n", matchedObject);*/
1290
1291 /* Sleep 10ms before flushing. This solves some issues with IEQ45 compatible devices. */
1292 usleep(10000);
1293 tcflush(fd, TCIFLUSH);
1294
1295 return 0;
1296}
1297
1298int selectSite(int fd, int siteNum)
1299{
1300 int error_type;
1301 int nbytes_write = 0;
1302
1303 switch (siteNum)
1304 {
1305 case 1:
1306 if ((error_type = tty_write_string(fd, ":W1#", &nbytes_write)) != TTY_OK)
1307 return error_type;
1308 /*if (portWrite(":W1#") < 0)
1309 return -1;*/
1310 break;
1311 case 2:
1312 if ((error_type = tty_write_string(fd, ":W2#", &nbytes_write)) != TTY_OK)
1313 return error_type;
1314 /*if (portWrite(":W2#") < 0)
1315 return -1;*/
1316 break;
1317 case 3:
1318 if ((error_type = tty_write_string(fd, ":W3#", &nbytes_write)) != TTY_OK)
1319 return error_type;
1320 /*if (portWrite(":W3#") < 0)
1321 return -1;*/
1322 break;
1323 case 4:
1324 if ((error_type = tty_write_string(fd, ":W4#", &nbytes_write)) != TTY_OK)
1325 return error_type;
1326 /*if (portWrite(":W4#") < 0)
1327 return -1;*/
1328 break;
1329 default:
1330 return -1;
1331 break;
1332 }
1333
1334 tcflush(fd, TCIFLUSH);
1335 return 0;
1336}
1337
1338int selectCatalogObject(int fd, int catalog, int NNNN)
1339{
1340 char temp_string[16];
1341 int error_type;
1342 int nbytes_write = 0;
1343
1344 switch (catalog)
1345 {
1346 case IEQ45_STAR_C:
1347 snprintf(temp_string, sizeof(temp_string), ":LS%d#", NNNN);
1348 break;
1349 case IEQ45_DEEPSKY_C:
1350 snprintf(temp_string, sizeof(temp_string), ":LC%d#", NNNN);
1351 break;
1352 case IEQ45_MESSIER_C:
1353 snprintf(temp_string, sizeof(temp_string), ":LM%d#", NNNN);
1354 break;
1355 default:
1356 return -1;
1357 }
1358
1359 if ((error_type = tty_write_string(fd, temp_string, &nbytes_write)) != TTY_OK)
1360 return error_type;
1361 /*if (portWrite(temp_string) < 0)
1362 return -1;*/
1363
1364 tcflush(fd, TCIFLUSH);
1365 return 0;
1366}
1367
1368int selectSubCatalog(int fd, int catalog, int subCatalog)
1369{
1370 char temp_string[16];
1371 switch (catalog)
1372 {
1373 case IEQ45_STAR_C:
1374 snprintf(temp_string, sizeof(temp_string), ":LsD%d#", subCatalog);
1375 break;
1376 case IEQ45_DEEPSKY_C:
1377 snprintf(temp_string, sizeof(temp_string), ":LoD%d#", subCatalog);
1378 break;
1379 case IEQ45_MESSIER_C:
1380 return 1;
1381 default:
1382 return 0;
1383 }
1384
1385 return (setStandardProcedure(fd, temp_string));
1386}
1387
1389{
1390 char temp_string[16];
1392 int error_type;
1393 int nbytes_write = 0, nbytes_read = 0;
1394
1395 if ((error_type = tty_write_string(fd, ":GR#", &nbytes_write)) != TTY_OK)
1396 return error_type;
1397
1398 /*if (portWrite(":GR#") < 0)
1399 return -1;*/
1400
1401 /*read_ret = portRead(temp_string, -1, IEQ45_TIMEOUT);*/
1402 error_type = tty_read_section(fd, temp_string, '#', IEQ45_TIMEOUT, &nbytes_read);
1403
1404 if (nbytes_read < 1)
1405 return error_type;
1406
1407 temp_string[nbytes_read - 1] = '\0';
1408
1409 /* Check whether it's short or long */
1410 if (temp_string[5] == '.')
1411 {
1413 return 0;
1414 }
1415 else
1416 return 0;
1417}
1418
1419int selectTrackingMode(int fd, int trackMode)
1420{
1421 int error_type;
1422 int nbytes_write = 0;
1423
1424 switch (trackMode)
1425 {
1427#ifdef INDI_DEBUG
1428 IDLog("Setting tracking mode to sidereal.\n");
1429#endif
1430 if ((error_type = tty_write_string(fd, ":RT0#", &nbytes_write)) != TTY_OK)
1431 return error_type;
1432 /*if (portWrite(":TQ#") < 0)
1433 return -1;*/
1434 break;
1435 case IEQ45_TRACK_LUNAR:
1436#ifdef INDI_DEBUG
1437 IDLog("Setting tracking mode to LUNAR.\n");
1438#endif
1439 if ((error_type = tty_write_string(fd, ":RT1#", &nbytes_write)) != TTY_OK)
1440 return error_type;
1441 /*if (portWrite(":TL#") < 0)
1442 return -1;*/
1443 break;
1444 case IEQ45_TRACK_SOLAR:
1445#ifdef INDI_DEBUG
1446 IDLog("Setting tracking mode to SOLAR.\n");
1447#endif
1448 if ((error_type = tty_write_string(fd, ":RT2#", &nbytes_write)) != TTY_OK)
1449 return error_type;
1450 /*if (portWrite(":TM#") < 0)
1451 return -1;*/
1452 break;
1453 case IEQ45_TRACK_ZERO:
1454#ifdef INDI_DEBUG
1455 IDLog("Setting tracking mode to custom.\n");
1456#endif
1457 if ((error_type = tty_write_string(fd, ":RT4#", &nbytes_write)) != TTY_OK)
1458 return error_type;
1459 /*if (portWrite(":TM#") < 0)
1460 return -1;*/
1461 break;
1462
1463 default:
1464 return -1;
1465 break;
1466 }
1467
1468 tcflush(fd, TCIFLUSH);
1469 return 0;
1470}
double max(void)
int setFocuserMotion(int fd, int motionType)
int setAlignmentMode(int fd, unsigned int alignMode)
int setSlewMode(int fd, int slewMode)
int setObjAlt(int fd, double alt)
int setMinElevationLimit(int fd, int min)
void remove_spaces(char *texto_recibe)
int getHomeSearchStatus(int fd, int *status)
int setObjAz(int fd, double az)
int selectTrackingMode(int fd, int trackMode)
int is8407ver
int setMaxSlewRate(int fd, int slewRate)
int getSiteName(int fd, char *siteName, int siteNum)
int check_IEQ45_connection(int fd)
int setObjectDEC(int fd, double dec)
int setMaxElevationLimit(int fd, int max)
int selectSite(int fd, int siteNum)
int setCalenderDate(int fd, int dd, int mm, int yy)
int getCommandInt(int fd, int *value, const char *cmd)
int setStandardProcedure(int fd, char *writeData)
int setSiteLatitude(int fd, double Lat)
int selectSubCatalog(int fd, int catalog, int subCatalog)
int getNumberOfBars(int fd, int *value)
int controller_format
int SendPulseCmd(int fd, int direction, int duration_msec)
int abortSlew(int fd)
int getCommandSexa(int fd, double *value, const char *cmd)
int Sync(int fd, char *matchedObject)
int setTrackFreq(int fd, double trackF)
int setFocuserSpeedMode(int fd, int speedMode)
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)
int getCommandString(int fd, char *data, const char *cmd)
int getSiteLongitude(int fd, int *ddd, int *mm)
int getSiteLatitude(int fd, int *dd, int *mm)
int getOTATemp(int fd, double *value)
#define IEQ45_TIMEOUT
int getTrackFreq(int fd, double *value)
int setCommandXYZ(int fd, int x, int y, int z, const char *cmd)
int setSiteName(int fd, char *siteName, int siteNum)
int setUTCOffset(int fd, double hours)
int checkIEQ45Format(int fd)
int setGPSFocuserSpeed(int fd, int speed)
int updateIntelliscopeCoord(int fd, double *ra, double *dec)
int setSiteLongitude(int fd, double Long)
int setObjectRA(int fd, double ra)
int HaltMovement(int fd, int direction)
int selectCatalogObject(int fd, int catalog, int NNNN)
int selectAPTrackingMode(int fd, int trackMode)
@ IEQ45_FOCUSIN
Definition ieq45driver.h:64
@ IEQ45_FOCUSOUT
Definition ieq45driver.h:65
@ IEQ45_ALIGN_ALTAZ
Definition ieq45driver.h:36
@ IEQ45_ALIGN_LAND
Definition ieq45driver.h:37
@ IEQ45_ALIGN_POLAR
Definition ieq45driver.h:35
@ IEQ45_DEEPSKY_C
Definition ieq45driver.h:77
@ IEQ45_STAR_C
Definition ieq45driver.h:76
@ IEQ45_FOCUSSLOW
Definition ieq45driver.h:70
@ IEQ45_HALTFOCUS
Definition ieq45driver.h:69
@ IEQ45_FOCUSFAST
Definition ieq45driver.h:71
@ IEQ45_TRACK_ZERO
@ IEQ45_TRACK_LUNAR
@ IEQ45_TRACK_SIDERAL
@ IEQ45_TRACK_SOLAR
@ IEQ45_EAST
Definition ieq45driver.h:44
@ IEQ45_SOUTH
Definition ieq45driver.h:45
@ IEQ45_WEST
Definition ieq45driver.h:43
@ IEQ45_NORTH
Definition ieq45driver.h:42
@ IEQ45_ALL
Definition ieq45driver.h:46
@ IEQ45_MESSIER_C
Definition ieq45driver.h:95
@ IEQ45_SLEW_GUIDE
Definition ieq45driver.h:30
@ IEQ45_SLEW_FIND
Definition ieq45driver.h:28
@ IEQ45_SLEW_CENTER
Definition ieq45driver.h:29
@ IEQ45_SLEW_MAX
Definition ieq45driver.h:27
@ IEQ45_LONG_FORMAT
Definition ieq45driver.h:52
@ IEQ45_SHORT_FORMAT
Definition ieq45driver.h:51
double ra
double dec
#define min(a, b)
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition indicom.c:653
int f_scansexa(const char *str0, double *dp)
convert sexagesimal string str AxBxC to double. x can be anything non-numeric. Any missing A,...
Definition indicom.c:194
void IDLog(const char *fmt,...)
Definition indicom.c:305
void getSexComponents(double value, int *d, int *m, int *s)
Definition indicom.c:243
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Definition indicom.c:548
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition indicom.c:473
Implementations for common driver routines.
@ TTY_OK
Definition indicom.h:54
Interface to the reference INDI C API device implementation on the Device Driver side.
int fd
uint8_t cmd[4]
Definition pwc-ioctl.h:2