50 #include <libnova/transform.h>
66 #define MAX_LX200AP_PULSE_LEN 999
87 return "AstroPhysics V2";
93 if (!activeConnection->
name().compare(
"CONNECTION_TCP"))
143 IUFillSwitchVector(&
SwapSP,
SwapS, 2,
getDeviceName(),
"SWAP",
"Swap buttons",
MOTION_TAB,
IP_RW,
ISR_1OFMANY, 0,
171 IUFillSwitchVector(&
ParkToSP,
ParkToS, 6,
getDeviceName(),
"PARK_TO",
"Park To?",
MAIN_CONTROL_TAB,
IP_RW,
ISR_1OFMANY, 0,
213 void LX200AstroPhysicsV2::initRateLabels()
238 std::string standard_rates[4][5] =
240 {
"600",
"1200",
"600",
"900",
"1200" },
241 {
"500",
"900",
"400",
"650",
"900" },
242 {
"400",
"600",
"300",
"450",
"600" },
243 {
"600",
"1200",
"600",
"1000",
"1800" }
289 LOG_INFO(
"ISGetProperties: Not Connected");
336 bool LX200AstroPhysicsV2::getWormPosition()
358 void LX200AstroPhysicsV2::processMountStatus(
const char *statusString)
373 if (strlen(statusString) < 10)
375 const char pecChar = statusString[9];
454 void LX200AstroPhysicsV2::setMajorMinorVersions(
char *version)
459 const std::string v = version;
460 std::regex rgx(
".*-(\\w+)-(\\w+)");
463 if (std::regex_search(v.begin(), v.end(), match, rgx))
465 std::string major = match.str(1);
466 std::string minor = match.str(2);
468 std::string majorStripped = std::regex_replace(major, std::regex(R
"([\D])"), "");
469 std::string minorStripped = std::regex_replace(minor, std::regex(R
"([\D])"), "");
471 if (majorStripped.size() > 0)
472 majorVersion = stoi(majorStripped);
473 if (minorStripped.size() > 0)
474 minorVersion = stoi(minorStripped);
478 bool LX200AstroPhysicsV2::getFirmwareVersion()
482 char versionString[128];
489 strncpy(versionString,
"VCP4-P01-01", 128);
497 if (strstr(versionString,
"VCP4"))
499 firmwareVersion =
MCV_V;
503 setMajorMinorVersions(versionString);
505 else if (strstr(versionString,
"VCP5"))
508 firmwareVersion =
MCV_V;
511 setMajorMinorVersions(versionString);
514 else if (strlen(versionString) == 1 || strlen(versionString) == 2)
518 int typeIndex =
VersionT[0].text[0] -
'D';
522 LOGF_DEBUG(
"Firmware version index: %d", typeIndex);
523 if (firmwareVersion <
MCV_G)
528 strncpy(rev, versionString, 8);
540 LOGF_INFO(
"Servo Box Controller: GTOCP%d.", servoType);
541 LOGF_INFO(
"Firmware Version: '%s'", versionString);
542 if (majorVersion && minorVersion)
543 LOGF_INFO(
"Firmware Major Version: %d Minor Version %d", majorVersion, minorVersion);
569 LOGF_ERROR(
"Error setting UTC offset (%d).", err);
588 bool success =
false;
595 success = APSync(
ra,
dec,
true);
612 bool LX200AstroPhysicsV2::ApInitialize()
617 LOG_ERROR(
"This driver requires at least version T firmware");
622 char status_string[256];
636 double longitude = -1000, latitude = -1000;
640 if (longitude != -1000 && latitude != -1000)
641 updateAPLocation(latitude, longitude, 0);
643 bool isAPParked =
false;
644 if (!IsMountParked(&isAPParked))
649 LOG_DEBUG(
"could not load config data for UnparkFromSP.name");
651 LOG_DEBUG(
"could not load config data for ParkTo.name");
653 LOG_INFO(
"Driver's config 'Unpark From ?' is set to Last Parked");
660 LOG_INFO(
"ApInitialize, not parked.");
685 LOGF_ERROR(
"ApInitialize: Error setting tracking mode (%d).", err);
697 LOGF_ERROR(
"ApInitialize: Error setting move rate (%d).", err);
708 LOGF_ERROR(
"ApInitialize: Error setting slew to rate (%d).", err);
723 char versionString[64];
751 LOGF_ERROR(
"Error swapping buttons (%d).", err);
772 LOGF_ERROR(
"Error setting move to rate (%d).", err);
791 LOGF_ERROR(
"Error setting guiding to rate (%d).", err);
813 LOGF_ERROR(
"Error setting PEC state (%d).", err);
837 LOGF_ERROR(
"Error setting PEC state RECORD (%d).", err);
858 double unparkAlt, unparkAz;
859 if (!calcParkPosition(unparkPos, &unparkAlt, &unparkAz))
861 LOG_WARN(
"Error calculating unpark position!");
891 double parkAz, parkAlt;
892 if (calcParkPosition(parkPos, &parkAlt, &parkAz))
894 LOGF_INFO(
"Set predefined park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
898 LOGF_ERROR(
"Unable to set predefined park position %d!!", parkPos);
903 LOG_WARN(
"ISNewSwitch: park custom/current not supported");
921 if (!alreadyConnected)
925 if (!activeConnection->
name().compare(
"CONNECTION_TCP"))
934 LOG_ERROR(
"Connect failed for Manual Park");
942 LOG_ERROR(
"ParkInternal failed for Manual Park");
944 if (!alreadyConnected)
947 LOG_ERROR(
"Disconnect failed for Manual Park");
972 static char idleStr[] =
"Idle";
975 static char slewStr[] =
"Slewing";
978 static char trackStr[] =
"Tracking";
981 static char parkingStr[] =
"Parking";
984 static char parkStr[] =
"Parked";
987 static char emptyStr[] =
"???";
995 LOGF_DEBUG(
"APStatus: Not ready--Checked %s Initialized %s Time updated %s Location Updated %s",
996 apInitializationChecked ?
"Y" :
"N", apIsInitialized ?
"Y" :
"N",
997 apTimeInitialized ?
"Y" :
"N", apLocationInitialized ?
"Y" :
"N");
1007 LOG_ERROR(
"Reading sidereal time failed");
1010 std::string sTimeStr;
1011 if (val >= 0 && val <= 24.0)
1035 char apStatusString[256];
1044 processMountStatus(apStatusString);
1062 LOGF_DEBUG(
"APStatus: %s %s stime: %s RA/DEC: %.3f %.3f",
1067 const double dx = fabs(lastRA -
currentRA);
1075 if (dx < 1e-3 && dy < 1e-3)
1078 LOG_INFO(
"Slew is complete. Tracking...");
1087 bool slewcomplete =
false;
1088 double PARKTHRES = 0.1;
1091 slewcomplete =
true;
1101 const double dx = fabs(lastAZ - currentAz);
1102 const double dy = fabs(lastAL - currentAlt);
1103 LOGF_DEBUG(
"Parking... currentAz: %g dx: %g currentAlt: %g dy: %g", currentAz, dx, currentAlt, dy);
1108 if (slewcomplete && (dx > PARKTHRES || dy > PARKTHRES))
1110 LOG_WARN(
"Parking... slew status indicates mount stopped by dx/dy too far from mount - continuing!");
1111 slewcomplete =
false;
1118 LOG_DEBUG(
"Parking slew is complete. Asking astrophysics mount to park...");
1119 if (!parkInternal())
1127 lastAL = currentAlt;
1137 bool LX200AstroPhysicsV2::parkInternal()
1150 bool LX200AstroPhysicsV2::IsMountParked(
bool * isAPParked)
1165 *isAPParked = (parkStatus ==
'P');
1176 const struct timespec timeout = {0, 100000000L};
1181 char RAStr[64], DecStr[64];
1212 nanosleep(&timeout,
nullptr);
1230 IDSetNumber(&
EqNP,
"Error Slewing to JNow RA %s - DEC %s\n", RAStr, DecStr);
1241 LOGF_INFO(
"Slewing to RA: %s - DEC: %s", RAStr, DecStr);
1256 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1288 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1320 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1352 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1398 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutWE() pulse guide simul = %d", simul);
1416 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutNS() pulse guide simul = %d", simul);
1441 LOG_INFO(
"Simulated Astrophysics is online. Retrieving basic data...");
1442 getFirmwareVersion();
1450 LOGF_ERROR(
"Error clearing the buffer (%d): %s", err, strerror(err));
1455 LOG_INFO(
"Setting generic udp format (1)");
1463 LOGF_ERROR(
"Error setting backlash compensation (%d): %s.", err, strerror(err));
1470 rc = getFirmwareVersion();
1475 LOG_ERROR(
"Firmware detection failed or is unknown. This driver requires at least version T firmware");
1482 LOGF_ERROR(
"Handshake: Error setting tracking mode to zero (%d).", err);
1493 apIsInitialized =
false;
1494 apInitializationChecked =
false;
1495 apLocationInitialized =
false;
1496 apTimeInitialized =
false;
1504 apInitializationChecked =
true;
1510 bool LX200AstroPhysicsV2::isAPReady()
1512 if (!apInitializationChecked)
1516 if (apIsInitialized)
1522 if (apLocationInitialized && apTimeInitialized)
1524 bool commWorked =
true;
1525 char statusString[256];
1544 bool mountOk =
false;
1550 if (commWorked && mountOk)
1552 apIsInitialized =
true;
1570 apIsInitialized =
true;
1575 LOG_ERROR(
"Could not initialize mount.");
1586 apIsInitialized =
false;
1587 apLocationInitialized =
false;
1588 apTimeInitialized =
false;
1589 apInitializationChecked =
false;
1594 bool LX200AstroPhysicsV2::APSync(
double ra,
double dec,
bool recalibrate)
1596 char syncString[256] =
"";
1630 LOGF_DEBUG(
"%s Synchronization successful %s", (recalibrate ?
"CMR" :
"CM"), syncString);
1642 return APSync(
ra,
dec,
true);
1649 struct ln_zonedate ltm;
1651 ln_date_to_zonedate(utc, <m, utc_offset * 3600.0);
1652 JD = ln_get_julian_day(utc);
1653 LOGF_DEBUG(
"New JD is %f, local time: %d, %d, %d, utc offset: %f",
JD, ltm.hours, ltm.minutes, (
int)ltm.seconds,
1662 LOGF_DEBUG(
"Set Local Time %02d:%02d:%02d is successful.", ltm.hours, ltm.minutes,
1670 LOGF_DEBUG(
"Set Local Date %02d/%02d/%02d is successful.", ltm.days, ltm.months, ltm.years);
1679 double ap_utc_offset = - utc_offset;
1689 LOGF_DEBUG(
"Set UTC Offset %g as AP UTC Offset %g is successful.", utc_offset, ap_utc_offset);
1690 apTimeInitialized =
true;
1694 bool LX200AstroPhysicsV2::updateAPLocation(
double latitude,
double longitude,
double elevation)
1697 LOG_DEBUG(
"LX200AstroPhysicsV2::updateLocation entry");
1699 if ((latitude == 0.) && (longitude == 0.))
1701 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1706 double apLongitude = 360 - longitude ;
1707 while (apLongitude < 0)
1709 while (apLongitude > 360)
1712 LOGF_DEBUG(
"Setting site longitude coordinates, %f %f", longitude, apLongitude);
1716 LOG_ERROR(
"Error setting site longitude coordinates");
1722 LOG_ERROR(
"Error setting site latitude coordinates");
1727 fs_sexa(l, latitude, 3, 3600);
1728 fs_sexa(L, longitude, 4, 3600);
1730 LOGF_DEBUG(
"Site location updated to Lat %.32s - Long %.32s, deg: %f, %f", l, L, latitude, longitude);
1731 apLocationInitialized =
true;
1737 if ((latitude == 0.) && (longitude == 0.))
1739 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1744 return updateAPLocation(latitude, longitude, elevation);
1773 double parkAz {90}, parkAlt {0};
1776 LOG_DEBUG(
"PARK_CURRENT not implemented");
1778 else if (calcParkPosition(parkPos, &parkAlt, &parkAz))
1780 LOGF_DEBUG(
"Set park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
1784 LOGF_ERROR(
"Unable to set park position %d!!", parkPos);
1787 char AzStr[16] = {0}, AltStr[16] = {0};
1788 fs_sexa(AzStr, parkAz, 2, 3600);
1789 fs_sexa(AltStr, parkAlt, 2, 3600);
1790 LOGF_INFO(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1805 Goto(equatorialCoords.rightascension, equatorialCoords.declination);
1820 LOGF_ERROR(
"Error Slewing to Az %s - Alt %s", AzStr, AltStr);
1830 LOG_INFO(
"Parking is in progress...");
1835 bool LX200AstroPhysicsV2::calcParkPosition(ParkPosition pos,
double * parkAlt,
double * parkAz)
1841 LOG_ERROR(
"Called calcParkPosition with PARK_CUSTOM or PARK_LAST!");
1846 LOG_ERROR(
"Called calcParkPosition with PARK_CURRENT!");
1854 LOG_INFO(
"Computing PARK1 position...");
1863 LOG_INFO(
"Computing PARK2 position...");
1876 LOG_INFO(
"Computing PARK3 position");
1883 LOG_INFO(
"Computing PARK4 position...");
1894 LOGF_DEBUG(
"calcParkPosition: parkPos=%d parkAlt=%f parkAz=%f", pos, *parkAlt, *parkAz);
1903 double unparkAlt = 0, unparkAz = 0;
1905 if (!unpark_from_last_config)
1908 LOGF_DEBUG(
"UnPark: park position = %d from current driver", unparkfromPos);
1909 if (!calcParkPosition(unparkfromPos, &unparkAlt, &unparkAz))
1911 LOG_ERROR(
"UnPark: Error calculating unpark position!");
1916 LOGF_DEBUG(
"UnPark: parkPos=%d parkAlt=%f parkAz=%f", unparkfromPos, unparkAlt, unparkAz);
1919 bool isAPParked =
true;
1922 if (!IsMountParked(&isAPParked))
1924 LOG_WARN(
"UnPark:could not determine AP park status");
1932 LOG_WARN(
"UnPark: AP mount status: unparked, park first");
1944 LOG_ERROR(
"UnParking AP mount failed.");
1969 if (!unpark_from_last_config)
1975 char AzStr[16], AltStr[16];
1976 fs_sexa(AzStr, unparkAz, 2, 3600);
1977 fs_sexa(AltStr, unparkAlt, 2, 3600);
1978 char RaStr[16], DecStr[16];
1979 fs_sexa(RaStr, equatorialCoords.rightascension, 2, 3600);
1980 fs_sexa(DecStr, equatorialCoords.declination, 2, 3600);
1986 LOGF_INFO(
"UnPark: Current parking position Az (%s) Alt (%s), HA (%s) RA (%s) Dec (%s)", AzStr, AltStr, HaStr,
1997 bool success = APSync(equatorialCoords.rightascension, equatorialCoords.declination,
false);
2005 LOGF_INFO(
"UnPark: Sync'd (:CM) to RA/DEC: %f %f", equatorialCoords.rightascension, equatorialCoords.declination);
2027 LOGF_ERROR(
"Error setting center (MoveTo) rate (%d).", err);
2038 LOGF_ERROR(
"Error setting slew to rate (%d).", err);
2045 LOG_DEBUG(
"UnPark: Mount unparked successfully");
2060 void LX200AstroPhysicsV2::syncSideOfPier()
2062 const char *
cmd =
"#:pS#";
2064 char response[16] = { 0 };
2065 int rc = 0, nbytes_read = 0, nbytes_written = 0;
2069 tcflush(
PortFD, TCIOFLUSH);
2075 LOGF_ERROR(
"Error writing to device %s (%d)", errmsg, rc);
2084 LOGF_ERROR(
"Error reading from device %s (%d)", errmsg, rc);
2088 response[nbytes_read - 1] =
'\0';
2090 tcflush(
PortFD, TCIOFLUSH);
2094 if (!strcmp(response,
"East"))
2096 else if (!strcmp(response,
"West"))
2099 LOGF_ERROR(
"Invalid pier side response from device-> %s", response);
2119 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode(%d)", mode);
2125 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2134 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2145 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackEnabled(%d)", enabled);
2149 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode() returned %d", rc);
2198 states[rememberSlewRate] =
ISS_ON;
2203 rememberSlewRate = -1;
2216 states[rememberSlewRate] =
ISS_ON;
2221 rememberSlewRate = -1;
The Interface class is the base class for all INDI connection plugins.
virtual std::string name()=0
const char * getDeviceName() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool Disconnect()
Disconnect from device.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
bool isSimulation() const
Connection::Interface * getActiveConnection()
virtual bool Connect()
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
INumberVectorProperty GuideNSNP
INumberVectorProperty GuideWENP
TelescopeStatus TrackState
ISwitchVectorProperty TrackStateSP
ISwitchVectorProperty MovementNSSP
ISwitchVectorProperty AbortSP
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
ISwitchVectorProperty CoordSP
ISwitchVectorProperty PECStateSP
ISwitchVectorProperty TrackModeSP
ISwitchVectorProperty SlewRateSP
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
INumberVectorProperty EqNP
@ TELESCOPE_HAS_TRACK_RATE
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_CONTROL_TRACK
void setPECState(TelescopePECState state)
ISwitchVectorProperty ParkSP
IGeographicCoordinates m_Location
uint32_t GetTelescopeCapability() const
GetTelescopeCapability returns the capability of the Telescope.
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
void setPierSide(TelescopePierSide side)
ISwitchVectorProperty MovementWESP
TelescopePECState getPECState()
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
ITextVectorProperty APMountStatusTP
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
ISwitchVectorProperty APSlewSpeedSP
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
INumber HorizontalCoordsN[2]
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual bool Handshake() override
perform handshake with device to check communication
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
INumberVectorProperty HourangleCoordsNP
ISwitchVectorProperty ParkToSP
void AstroPhysicsGuideTimeoutNS(bool simul)
ITextVectorProperty APPECStateTP
ITextVectorProperty VersionTP
INumberVectorProperty HorizontalCoordsNP
virtual bool GuideNS(INDI_DIR_NS dir, TelescopeMotionCommand command)
ISwitch HomeAndReSyncS[1]
virtual bool Park() override
Park the telescope to its home position.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
static void pulseGuideTimeoutHelperWE(void *p)
INumberVectorProperty APSiderealTimeNP
virtual bool getUTFOffset(double *offset) override
INumberVectorProperty APUTCOffsetNP
INumber APSiderealTimeN[1]
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
static void pulseGuideTimeoutHelperNS(void *p)
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
ISwitchVectorProperty SwapSP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
ISwitchVectorProperty APGuideSpeedSP
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
static void simulGuideTimeoutHelperNS(void *p)
ISwitchVectorProperty ManualSetParkedSP
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
APRateTableState rateTable
ISwitchVectorProperty APPECRecordSP
bool homeAndReSyncEnabled
ISwitchVectorProperty UnparkFromSP
virtual bool ReadScopeStatus() override
Read telescope status.
ISwitchVectorProperty HomeAndReSyncSP
virtual bool Disconnect() override
Disconnect from device.
void AstroPhysicsGuideTimeoutWE(bool simul)
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
INumber HourangleCoordsN[2]
INumberVectorProperty APWormPositionNP
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool GuideWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
static void simulGuideTimeoutHelperWE(void *p)
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
ISwitch ManualSetParkedS[1]
INumber APWormPositionN[1]
virtual const char * getDefaultName() override
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual void slewError(int slewCode)
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
@ LX200_HAS_PULSE_GUIDING
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void setLX200Capability(uint32_t cap)
const char * GUIDE_TAB
GUIDE_TAB Where all the properties for guiding are located.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
void IERmTimer(int timerid)
Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer().
int IEAddTimer(int millisecs, IE_TCF *fp, void *p)
Register a new single-shot timer function, fp, to be called with ud as argument after ms.
#define setLocalTime(fd, x, y, z)
void tty_set_generic_udp_format(int enabled)
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
int fs_sexa(char *out, double a, int w, int fracbase)
Converts a sexagesimal number to a string. sprint the variable a in sexagesimal format into out[].
void tty_clr_trailing_read_lf(int enabled)
double get_local_hour_angle(double sideral_time, double ra)
get_local_hour_angle Returns local hour angle of an object
Implementations for common driver routines.
double get_local_sidereal_time(double longitude)
get_local_sidereal_time Returns local sideral time given longitude and system clock.
#define TRACKRATE_SIDEREAL
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
ISwitch * IUFindSwitch(const ISwitchVectorProperty *svp, const char *name)
Find an ISwitch member in a vector switch property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUGetConfigNumber(const char *dev, const char *property, const char *member, double *value)
IUGetConfigNumber Opens configuration file and reads single number property.
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
int IUGetConfigSwitch(const char *dev, const char *property, const char *member, ISState *value)
IUGetConfigSwitch Opens configuration file and reads single switch property.
#define LOGF_INFO(fmt,...)
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
char * trackStateString(INDI::Telescope::TelescopeStatus state)
#define MAX_LX200AP_PULSE_LEN
bool apStatusParked(const char *statusString)
int setAPUTCOffset(int fd, double hours)
int setAPSiteLatitude(int fd, double Lat)
int getAPWormPosition(int fd, int *position)
void set_lx200ap_name(const char *deviceName, unsigned int debug_level)
int setAPRATrackRate(int fd, double rate)
int apHomeAndSync(int fd)
int setAPObjectRA(int fd, double ra)
int APSyncCMR(int fd, char *matchedObject)
int setAPObjectAlt(int fd, double alt)
int swapAPButtons(int fd, int currentSwap)
int setAPObjectDEC(int fd, double dec)
int isAPInitialized(int fd, bool *isInitialized)
int APSendPulseCmd(int fd, int direction, int duration_msec)
const char * apMountStatus(const char *statusString)
int selectAPSlewRate(int fd, int slewIndex)
int getApStatusString(int fd, char *statusString)
int check_lx200ap_status(int fd, char *parkStatus, char *slewStatus)
int APUnParkMount(int fd)
int selectAPPECState(int fd, int pecstate)
int selectAPGuideRate(int fd, int guideRate)
APRateTableState apRateTable(const char *statusString)
int setAPObjectAZ(int fd, double az)
int APSyncCM(int fd, char *matchedObject)
int getAPUTCOffset(int fd, double *value)
int setAPDETrackRate(int fd, double rate)
bool apStatusSlewing(const char *statusString)
int setAPSiteLongitude(int fd, double Long)
int selectAPV2CenterRate(int fd, int centerIndex, APRateTableState rateTable)
int selectAPTrackingMode(int fd, int trackMode)
#define setAPBackLashCompensation(fd, x, y, z)
#define getAPVersionNumber(fd, x)
#define setAPClearBuffer(fd)
#define AP_TRACKING_SIDEREAL
int checkLX200EquatorialFormat(int fd)
int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace)
#define getLX200DEC(fd, x)
#define getLX200RA(fd, x)
#define getLX200Alt(fd, x)
#define getLX200Az(fd, x)
void HorizontalToEquatorial(IHorizontalCoordinates *object, IGeographicCoordinates *observer, double JD, IEquatorialCoordinates *position)
HorizontalToEquatorial Calculate Equatorial EOD Coordinates from horizontal coordinates.
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
char device[MAXINDIDEVICE]