char ACK(int fd); int check_lx200_connection(int fd); int getCommandSexa(int fd, double *value, const char *cmd); int getCommandString(int fd, char *data, const char *cmd); int getCommandInt(int fd, int *value, const char *cmd); int getTrackFreq(int fd, double *value); int getSiteLatitude(int fd, int *dd, int *mm); int getSiteLongitude(int fd, int *ddd, int *mm); int getCalendarDate(int fd, char *date); int getSiteName(int fd, char *siteName, int siteNum); int getHomeSearchStatus(int fd, int *status); int getOTATemp(int fd, double *value); int getTimeFormat(int fd, int *format); int setCommandInt(int fd, int data, const char *cmd); int setCommandXYZ(int fd, int x, int y, int z, const char *cmd); int setStandardProcedure(int fd, const char *writeData); int setSlewMode(int fd, int slewMode); int setAlignmentMode(int fd, unsigned int alignMode); int setObjectRA(int fd, double ra); int setObjectDEC(int fd, double dec); int setCalenderDate(int fd, int dd, int mm, int yy); int setUTCOffset(int fd, double hours); int setTrackFreq(int fd, double trackF); int setSiteLongitude(int fd, double Long); int setSiteLatitude(int fd, double Lat); int setObjAz(int fd, double az); int setObjAlt(int fd, double alt); int setSiteName(int fd, char *siteName, int siteNum); int setMaxSlewRate(int fd, int slewRate); int setFocuserMotion(int fd, int motionType); int setFocuserSpeedMode(int fd, int speedMode); int setMinElevationLimit(int fd, int min); int setMaxElevationLimit(int fd, int max); int Slew(int fd); int Sync(int fd, char *matchedObject); int abortSlew(int fd); int MoveTo(int fd, int direction); int HaltMovement(int fd, int direction); int selectTrackingMode(int fd, int trackMode); int SendPulseCmd(int fd, int direction, uint32_t duration_msec); int checkLX200Format(int fd); int selectSite(int fd, int siteNum); int selectCatalogObject(int fd, int catalog, int NNNN); int selectSubCatalog(int fd, int catalog, int subCatalog); int check_lx200_connection(int in_fd) if (in_fd <= 0) if (write(in_fd, ack, 1) < 0) tty_read(in_fd, MountAlign, 1, LX200_TIMEOUT, &nbytes_read); char ACK(int fd) nbytes_write = write(fd, ack, 1); error_type = tty_read(fd, MountAlign, 1, LX200_TIMEOUT, &nbytes_read); int getCommandSexa(int fd, double *value, const char *cmd) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer,RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); tcflush(fd, TCIFLUSH); int getCommandInt(int fd, int *value, const char *cmd) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer,RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getCommandString(int fd, char *data, const char *cmd) if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, data, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int isSlewComplete(int fd) if ((error_type = tty_write_string(fd, cmd, &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, data, 8, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIOFLUSH); int getCalendarDate(int fd, char *date) if ((error_type = getCommandString(fd, date, ":GC#"))) int getTimeFormat(int fd, int *format) if ((error_type = tty_write_string(fd, ":Gc#", &nbytes_write)) != TTY_OK) if ((error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read)) != TTY_OK) tcflush(fd, TCIFLUSH); int getSiteName(int fd, char *siteName, int siteNum) if ((error_type = tty_write_string(fd, ":GM#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":GN#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":GO#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":GP#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, siteName, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getSiteLatitude(int fd, int *dd, int *mm) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, ":Gt#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getSiteLongitude(int fd, int *ddd, int *mm) if ((error_type = tty_write_string(fd, ":Gg#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getTrackFreq(int fd, double *value) if ((error_type = tty_write_string(fd, ":GT#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getHomeSearchStatus(int fd, int *status) if ((error_type = tty_write_string(fd, ":h?#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int getOTATemp(int fd, double *value) if ((error_type = tty_write_string(fd, ":fT#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); int setStandardProcedure(int fd, const char *data) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, data, &nbytes_write)) != TTY_OK) error_type = tty_read(fd, bool_return, 1, LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int setCommandInt(int fd, int data, const char *cmd) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, read_buffer, &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setMinElevationLimit(int fd, int min) return (setStandardProcedure(fd, read_buffer)); int setMaxElevationLimit(int fd, int max) return (setStandardProcedure(fd, read_buffer)); int setMaxSlewRate(int fd, int slewRate) return (setStandardProcedure(fd, read_buffer)); int setObjectRA(int fd, double ra) return (setStandardProcedure(fd, read_buffer)); int setObjectDEC(int fd, double dec) return (setStandardProcedure(fd, read_buffer)); int setCommandXYZ(int fd, int x, int y, int z, const char *cmd) return (setStandardProcedure(fd, read_buffer)); int setAlignmentMode(int fd, unsigned int alignMode) if ((error_type = tty_write_string(fd, ":AP#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":AA#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":AL#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setCalenderDate(int fd, int dd, int mm, int yy) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, read_buffer, &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tty_nread_section(fd, dummy_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); tcflush(fd, TCIFLUSH); int setUTCOffset(int fd, double hours) return (setStandardProcedure(fd, read_buffer)); int setSiteLongitude(int fd, double Long) return (setStandardProcedure(fd, read_buffer)); int setSiteLatitude(int fd, double Lat) return (setStandardProcedure(fd, read_buffer)); int setObjAz(int fd, double az) return (setStandardProcedure(fd, read_buffer)); int setObjAlt(int fd, double alt) return (setStandardProcedure(fd, read_buffer)); int setSiteName(int fd, char *siteName, int siteNum) return (setStandardProcedure(fd, read_buffer)); int setSlewMode(int fd, int slewMode) if ((error_type = tty_write_string(fd, ":RS#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":RM#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":RC#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":RG#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setFocuserMotion(int fd, int motionType) if ((error_type = tty_write_string(fd, ":F+#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":F-#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setFocuserSpeedMode(int fd, int speedMode) if ((error_type = tty_write_string(fd, ":FQ#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":FS#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":FF#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setGPSFocuserSpeed(int fd, int speed) if ((error_type = tty_write_string(fd, ":FQ#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, speed_str, &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int setTrackFreq(int fd, double trackF) return (setStandardProcedure(fd, read_buffer)); int setPreciseTrackFreq(int fd, double trackF) return (setStandardProcedure(fd, read_buffer)); int Slew(int fd) if ((error_type = tty_write_string(fd, ":MS#", &nbytes_write)) != TTY_OK) error_type = tty_read(fd, slewNum, 1, LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int MoveTo(int fd, int direction) tty_write_string(fd, ":Mn#", &nbytes_write); tty_write_string(fd, ":Mw#", &nbytes_write); tty_write_string(fd, ":Me#", &nbytes_write); tty_write_string(fd, ":Ms#", &nbytes_write); tcflush(fd, TCIFLUSH); int SendPulseCmd(int fd, int direction, int duration_msec) tty_write_string(fd, cmd, &nbytes_write); tcflush(fd, TCIFLUSH); int HaltMovement(int fd, int direction) if ((error_type = tty_write_string(fd, ":Qn#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":Qw#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":Qe#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":Qs#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":Q#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int abortSlew(int fd) if ((error_type = tty_write_string(fd, ":Q#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int Sync(int fd, char *matchedObject) if ((error_type = tty_write_string(fd, ":CM#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, matchedObject, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int selectSite(int fd, int siteNum) if ((error_type = tty_write_string(fd, ":W0#", &nbytes_write)) != TTY_OK) //azwing index starts at 0 not 1 if ((error_type = tty_write_string(fd, ":W1#", &nbytes_write)) != TTY_OK) //azwing index starts at 0 not 1 if ((error_type = tty_write_string(fd, ":W2#", &nbytes_write)) != TTY_OK) //azwing index starts at 0 not 1 if ((error_type = tty_write_string(fd, ":W3#", &nbytes_write)) != TTY_OK) //azwing index starts at 0 not 1 tcflush(fd, TCIFLUSH); int selectCatalogObject(int fd, int catalog, int NNNN) if ((error_type = tty_write_string(fd, read_buffer, &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); int selectSubCatalog(int fd, int catalog, int subCatalog) return (setStandardProcedure(fd, read_buffer)); int checkLX200Format(int fd) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, ":GR#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); if ((error_type = tty_write_string(fd, ":U#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH); if ((error_type = tty_write_string(fd, ":GR#", &nbytes_write)) != TTY_OK) error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); tcflush(fd, TCIFLUSH); int selectTrackingMode(int fd, int trackMode) if ((error_type = tty_write_string(fd, ":TQ#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":TS#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":TL#", &nbytes_write)) != TTY_OK) if ((error_type = tty_write_string(fd, ":TM#", &nbytes_write)) != TTY_OK) tcflush(fd, TCIFLUSH);