Instrument Neutral Distributed Interface INDI
1.9.5
|
Go to the documentation of this file.
2 LX200 Astro - Physics Driver
3 Copyright (C) 2007 Markus Wildi
5 This library is free software;
6 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;
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT
ANY WARRANTY;
14 without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License
for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with
this library;
20 if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
39 #define LX200_TIMEOUT 5
42 #define MAX_LX200AP_PULSE_LEN 999
55 const struct timespec timeout = {0, 50000000L};
67 "check_lx200ap_connection: not a valid file descriptor received");
71 for (i = 0; i < 2; i++)
76 "check_lx200ap_connection: unsuccessful write to telescope, %d", nbytes_write);
81 tcflush(
fd, TCIFLUSH);
84 temp_string[nbytes_read - 1] =
'\0';
87 nbytes_write, temp_string);
91 nanosleep(&timeout,
nullptr);
101 int nbytes_write = 0;
104 char temp_string[16];
118 tcflush(
fd, TCIFLUSH);
123 if ((temp_string[0] ==
'A') || ((temp_string[0] ==
'0') && (temp_string[1] ==
'0')) || (temp_string[0] ==
'@'))
126 for (i = nbytes_read; i > 0; i--)
128 temp_string[i] = temp_string[i - 1];
130 temp_string[0] =
'-';
131 temp_string[nbytes_read + 1] =
'\0';
133 if (temp_string[1] ==
'A')
135 temp_string[1] =
'0';
136 switch (temp_string[2])
140 temp_string[2] =
'1';
144 temp_string[2] =
'2';
148 temp_string[2] =
'3';
152 temp_string[2] =
'4';
156 temp_string[2] =
'5';
165 else if (temp_string[1] ==
'0')
167 temp_string[1] =
'0';
168 temp_string[2] =
'6';
170 else if (temp_string[1] ==
'@')
172 temp_string[1] =
'0';
173 switch (temp_string[2])
177 temp_string[2] =
'7';
181 temp_string[2] =
'8';
185 temp_string[2] =
'9';
189 temp_string[2] =
'0';
192 temp_string[1] =
'1';
193 temp_string[2] =
'1';
197 temp_string[1] =
'1';
198 temp_string[2] =
'2';
214 temp_string[nbytes_read - 1] =
'\0';
228 char temp_string[16];
232 snprintf(temp_string,
sizeof(temp_string),
"#:Sz %03d*%02d:%02d#", h, m, s);
244 char temp_string[16];
251 snprintf(temp_string,
sizeof(temp_string),
"#:Sa -%02d*%02d:%02d#", d, m, s);
255 snprintf(temp_string,
sizeof(temp_string),
"#:Sa %+02d*%02d:%02d#", d, m, s);
266 char temp_string[16];
270 snprintf(temp_string,
sizeof(temp_string),
"#:SG %+03d:%02d:%02d#", h, m, s);
278 const struct timespec timeout = {0, 10000000L};
280 int nbytes_write = 0;
291 matchedObject[nbytes_read - 1] =
'\0';
296 nanosleep(&timeout,
nullptr);
298 tcflush(
fd, TCIFLUSH);
305 const struct timespec timeout = {0, 10000000L};
307 int nbytes_write = 0;
319 matchedObject[nbytes_read - 1] =
'\0';
324 nanosleep(&timeout,
nullptr);
326 tcflush(
fd, TCIFLUSH);
334 int nbytes_write = 0;
369 int nbytes_write = 0;
418 int nbytes_write = 0;
462 int nbytes_write = 0;
470 "selectAPTrackingMode: Setting tracking mode to sidereal.");
521 int nbytes_write = 0;
565 int nbytes_write = 0;
593 char temp_string[16];
597 snprintf(temp_string,
sizeof(temp_string),
"#:Sr %02d:%02d:%02d#", h, m, s);
607 char temp_string[16];
613 snprintf(temp_string,
sizeof(temp_string),
"#:Sd -%02d*%02d:%02d#", d, m, s);
617 snprintf(temp_string,
sizeof(temp_string),
"#:Sd %+03d*%02d:%02d#", d, m, s);
628 char temp_string[32];
631 snprintf(temp_string,
sizeof(temp_string),
"#:Sg %03d*%02d:%02d#", d, m, s);
641 char temp_string[32];
644 snprintf(temp_string,
sizeof(temp_string),
"#:St %+03d*%02d:%02d#", d, m, s);
659 int nbytes_written = 0;
666 snprintf(
cmd, 16,
":RR%c%03.4f#", sign, fabs(rate));
670 tcflush(
fd, TCIFLUSH);
688 response[nbytes_read] =
'\0';
691 tcflush(
fd, TCIFLUSH);
707 int nbytes_written = 0;
714 snprintf(
cmd, 16,
":RD%c%03.4f#", sign, fabs(rate));
719 tcflush(
fd, TCIFLUSH);
737 response[nbytes_read] =
'\0';
740 tcflush(
fd, TCIFLUSH);
751 int nbytes_write = 0;
764 sprintf(
cmd,
":Mn%03d#", duration_msec);
767 sprintf(
cmd,
":Ms%03d#", duration_msec);
770 sprintf(
cmd,
":Me%03d#", duration_msec);
773 sprintf(
cmd,
":Mw%03d#", duration_msec);
783 tcflush(
fd, TCIFLUSH);
791 char temp_string[64];
793 int nbytes_write = 0;
801 "check_lx200ap_connection: not a valid file descriptor received");
809 "check_lx200ap_connection: unsuccessful write to telescope, %d", nbytes_write);
814 tcflush(
fd, TCIFLUSH);
817 temp_string[nbytes_read - 1] =
'\0';
820 nbytes_write, temp_string);
822 *parkStatus = temp_string[0];
823 *slewStatus = temp_string[3];
839 int nbytes_write = 0;
854 int nbytes_write = 0;
873 int nbytes_write = 0;
933 char temp_string[64];
935 int nbytes_write = 0;
943 "check_lx200ap_connection: not a valid file descriptor received");
951 "check_lx200ap_connection: unsuccessful write to telescope, %d", nbytes_write);
956 tcflush(
fd, TCIFLUSH);
959 temp_string[nbytes_read - 1] =
'\0';
962 nbytes_write, temp_string);
964 *parkStatus = temp_string[0];
965 *slewStatus = temp_string[3];
int check_lx200ap_connection(int fd)
Implementations for common driver routines.
int selectAPGuideRate(int fd, int guideRate)
void getSexComponents(double value, int *d, int *m, int *s)
int f_scansexa(const char *str0, double *dp)
convert sexagesimal string str AxBxC to double.
int selectAPSlewRate(int fd, int slewRate)
#define AP_TRACKING_CUSTOM
int setAPObjectAZ(int fd, double az)
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
#define AP_TRACKING_LUNAR
int selectAPMoveToRate(int fd, int moveToRate)
int setAPRATrackRate(int fd, double rate)
int setAPObjectDEC(int fd, double dec)
#define DEBUGDEVICE(device, priority, msg)
#define MAX_LX200AP_PULSE_LEN
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
int setAPObjectAlt(int fd, double alt)
unsigned int AP_DBG_SCOPE
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
#define AP_TRACKING_SIDEREAL
int selectAPPECState(int fd, int pecstate)
int setStandardProcedure(int fd, const char *writeData)
int APUnParkMount(int fd)
int selectAPTrackingMode(int fd, int trackMode)
int setAPObjectRA(int fd, double ra)
int selectAPCenterRate(int fd, int centerRate)
#define DEBUGFDEVICE(device, priority, msg,...)
int setAPSiteLatitude(int fd, double Lat)
char lx200ap_name[MAXINDIDEVICE]
int getAPUTCOffset(int fd, double *value)
int setAPSiteLongitude(int fd, double Long)
int APSyncCMR(int fd, char *matchedObject)
void set_lx200ap_name(const char *deviceName, unsigned int debug_level)
int setAPUTCOffset(int fd, double hours)
int check_lx200ap_status(int fd, char *parkStatus, char *slewStatus)
int swapAPButtons(int fd, int currentSwap)
int setAPDETrackRate(int fd, double rate)
int APSyncCM(int fd, char *matchedObject)
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
#define AP_TRACKING_SOLAR
int APSendPulseCmd(int fd, int direction, int duration_msec)