50#include <libnova/transform.h>
66#define MAX_LX200AP_PULSE_LEN 999u
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,
215void LX200AstroPhysicsV2::initRateLabels()
240 std::string standard_rates[4][5] =
242 {
"600",
"1200",
"600",
"900",
"1200" },
243 {
"500",
"900",
"400",
"650",
"900" },
244 {
"400",
"600",
"300",
"450",
"600" },
245 {
"600",
"1200",
"600",
"1000",
"1800" }
334bool LX200AstroPhysicsV2::getWormPosition()
356void LX200AstroPhysicsV2::processMountStatus(
const char *statusString)
371 if (strlen(statusString) < 10)
373 const char pecChar = statusString[9];
452void LX200AstroPhysicsV2::setMajorMinorVersions(
char *version)
457 const std::string v = version;
458 std::regex rgx(
".*-(\\w+)-(\\w+)");
461 if (std::regex_search(v.begin(), v.end(), match, rgx))
463 std::string major = match.str(1);
464 std::string minor = match.str(2);
466 std::string majorStripped = std::regex_replace(major, std::regex(R
"([\D])"), "");
467 std::string minorStripped = std::regex_replace(minor, std::regex(R
"([\D])"), "");
469 if (majorStripped.size() > 0)
470 majorVersion = stoi(majorStripped);
471 if (minorStripped.size() > 0)
472 minorVersion = stoi(minorStripped);
476bool LX200AstroPhysicsV2::getFirmwareVersion()
479 char versionString[128];
486 strncpy(versionString,
"VCP4-P01-01", 128);
494 if (strstr(versionString,
"VCP4"))
496 firmwareVersion =
MCV_V;
499 setMajorMinorVersions(versionString);
501 else if (strstr(versionString,
"VCP5"))
504 firmwareVersion =
MCV_V;
506 setMajorMinorVersions(versionString);
509 else if (strlen(versionString) == 1 || strlen(versionString) == 2)
513 int typeIndex =
VersionT[0].text[0] -
'D';
517 LOGF_DEBUG(
"Firmware version index: %d", typeIndex);
518 if (firmwareVersion <
MCV_G)
533 LOGF_INFO(
"Servo Box Controller: GTOCP%d.", servoType);
534 LOGF_INFO(
"Firmware Version: '%s'", versionString);
535 if (majorVersion && minorVersion)
536 LOGF_INFO(
"Firmware Major Version: %d Minor Version %d", majorVersion, minorVersion);
562 LOGF_ERROR(
"Error setting UTC offset (%d).", err);
581 bool success =
false;
588 success = APSync(
ra,
dec,
true);
605bool LX200AstroPhysicsV2::ApInitialize()
610 LOG_ERROR(
"This driver requires at least version T firmware");
615 char status_string[256];
629 double longitude = -1000, latitude = -1000;
633 if (longitude != -1000 && latitude != -1000)
634 updateAPLocation(latitude, longitude, 0);
636 bool isAPParked =
false;
637 if (!IsMountParked(&isAPParked))
642 LOG_DEBUG(
"could not load config data for UnparkFromSP.name");
644 LOG_DEBUG(
"could not load config data for ParkTo.name");
646 LOG_INFO(
"Driver's config 'Unpark From ?' is set to Last Parked");
653 LOG_INFO(
"ApInitialize, not parked.");
678 LOGF_ERROR(
"ApInitialize: Error setting tracking mode (%d).", err);
690 LOGF_ERROR(
"ApInitialize: Error setting move rate (%d).", err);
701 LOGF_ERROR(
"ApInitialize: Error setting slew to rate (%d).", err);
716 char versionString[64];
744 LOGF_ERROR(
"Error swapping buttons (%d).", err);
765 LOGF_ERROR(
"Error setting move to rate (%d).", err);
784 LOGF_ERROR(
"Error setting guiding to rate (%d).", err);
806 LOGF_ERROR(
"Error setting PEC state (%d).", err);
830 LOGF_ERROR(
"Error setting PEC state RECORD (%d).", err);
851 double unparkAlt, unparkAz;
852 if (!calcParkPosition(unparkPos, &unparkAlt, &unparkAz))
854 LOG_WARN(
"Error calculating unpark position!");
884 double parkAz, parkAlt;
885 if (calcParkPosition(parkPos, &parkAlt, &parkAz))
887 LOGF_INFO(
"Set predefined park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
891 LOGF_ERROR(
"Unable to set predefined park position %d!!", parkPos);
896 LOG_WARN(
"ISNewSwitch: park custom/current not supported");
914 if (!alreadyConnected)
918 if (!activeConnection->
name().compare(
"CONNECTION_TCP"))
927 LOG_ERROR(
"Connect failed for Manual Park");
935 LOG_ERROR(
"ParkInternal failed for Manual Park");
937 if (!alreadyConnected)
940 LOG_ERROR(
"Disconnect failed for Manual Park");
965 static char idleStr[] =
"Idle";
968 static char slewStr[] =
"Slewing";
971 static char trackStr[] =
"Tracking";
974 static char parkingStr[] =
"Parking";
977 static char parkStr[] =
"Parked";
980 static char emptyStr[] =
"???";
988 LOGF_DEBUG(
"APStatus: Not ready--Checked %s Initialized %s Time updated %s Location Updated %s",
989 apInitializationChecked ?
"Y" :
"N", apIsInitialized ?
"Y" :
"N",
990 apTimeInitialized ?
"Y" :
"N", apLocationInitialized ?
"Y" :
"N");
1000 LOG_ERROR(
"Reading sidereal time failed");
1003 std::string sTimeStr;
1004 if (val >= 0 && val <= 24.0)
1005 sTimeStr = std::to_string(val);
1029 char apStatusString[256];
1038 processMountStatus(apStatusString);
1056 LOGF_DEBUG(
"APStatus: %s %s stime: %s RA/DEC: %.3f %.3f",
1061 const double dx = fabs(lastRA -
currentRA);
1069 if (dx < 1e-3 && dy < 1e-3)
1072 LOG_INFO(
"Slew is complete. Tracking...");
1081 bool slewcomplete =
false;
1082 double PARKTHRES = 0.1;
1085 slewcomplete =
true;
1096 const double dx = fabs(lastAZ - currentAz);
1097 const double dy = fabs(lastAL - currentAlt);
1098 LOGF_DEBUG(
"Parking... currentAz: %g dx: %g currentAlt: %g dy: %g", currentAz, dx, currentAlt, dy);
1103 if (slewcomplete && (dx > PARKTHRES || dy > PARKTHRES))
1105 LOG_WARN(
"Parking... slew status indicates mount stopped by dx/dy too far from mount - continuing!");
1106 slewcomplete =
false;
1113 LOG_DEBUG(
"Parking slew is complete. Asking astrophysics mount to park...");
1114 if (!parkInternal())
1122 lastAL = currentAlt;
1132bool LX200AstroPhysicsV2::parkInternal()
1145bool LX200AstroPhysicsV2::IsMountParked(
bool * isAPParked)
1160 *isAPParked = (parkStatus ==
'P');
1171 const struct timespec timeout = {0, 100000000L};
1176 char RAStr[64], DecStr[64];
1209 nanosleep(&timeout,
nullptr);
1228 LOGF_ERROR(
"Error Slewing to JNow RA %s - DEC %s\n", RAStr, DecStr);
1240 LOGF_INFO(
"Slewing to RA: %s - DEC: %s", RAStr, DecStr);
1255 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1284 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1314 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1344 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1388 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutWE() pulse guide simul = %d", simul);
1406 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutNS() pulse guide simul = %d", simul);
1431 LOG_INFO(
"Simulated Astrophysics is online. Retrieving basic data...");
1432 getFirmwareVersion();
1440 LOGF_ERROR(
"Error clearing the buffer (%d): %s", err, strerror(err));
1445 LOG_INFO(
"Setting generic udp format (1)");
1453 LOGF_ERROR(
"Error setting backlash compensation (%d): %s.", err, strerror(err));
1460 rc = getFirmwareVersion();
1465 LOG_ERROR(
"Firmware detection failed or is unknown. This driver requires at least version T firmware");
1472 LOGF_ERROR(
"Handshake: Error setting tracking mode to zero (%d).", err);
1483 apIsInitialized =
false;
1484 apInitializationChecked =
false;
1485 apLocationInitialized =
false;
1486 apTimeInitialized =
false;
1494 apInitializationChecked =
true;
1500bool LX200AstroPhysicsV2::isAPReady()
1502 if (!apInitializationChecked)
1506 if (apIsInitialized)
1512 if (apLocationInitialized && apTimeInitialized)
1514 bool commWorked =
true;
1515 char statusString[256];
1534 bool mountOk =
false;
1540 if (commWorked && mountOk)
1542 apIsInitialized =
true;
1560 apIsInitialized =
true;
1565 LOG_ERROR(
"Could not initialize mount.");
1576 apIsInitialized =
false;
1577 apLocationInitialized =
false;
1578 apTimeInitialized =
false;
1579 apInitializationChecked =
false;
1584bool LX200AstroPhysicsV2::APSync(
double ra,
double dec,
bool recalibrate)
1586 char syncString[256] =
"";
1593 LOG_ERROR(
"Error setting RA/DEC. Unable to Sync.");
1622 LOGF_DEBUG(
"%s Synchronization successful %s", (recalibrate ?
"CMR" :
"CM"), syncString);
1634 return APSync(
ra,
dec,
true);
1641 struct ln_zonedate ltm;
1643 ln_date_to_zonedate(utc, <m, utc_offset * 3600.0);
1644 JD = ln_get_julian_day(utc);
1645 LOGF_DEBUG(
"New JD is %f, local time: %d, %d, %d, utc offset: %f",
JD, ltm.hours, ltm.minutes, (
int)ltm.seconds,
1654 LOGF_DEBUG(
"Set Local Time %02d:%02d:%02d is successful.", ltm.hours, ltm.minutes,
1662 LOGF_DEBUG(
"Set Local Date %02d/%02d/%02d is successful.", ltm.days, ltm.months, ltm.years);
1671 double ap_utc_offset = - utc_offset;
1681 LOGF_DEBUG(
"Set UTC Offset %g as AP UTC Offset %g is successful.", utc_offset, ap_utc_offset);
1682 apTimeInitialized =
true;
1686bool LX200AstroPhysicsV2::updateAPLocation(
double latitude,
double longitude,
double elevation)
1689 LOG_DEBUG(
"LX200AstroPhysicsV2::updateLocation entry");
1691 if ((latitude == 0.) && (longitude == 0.))
1693 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1698 double apLongitude = 360 - longitude ;
1699 while (apLongitude < 0)
1701 while (apLongitude > 360)
1704 LOGF_DEBUG(
"Setting site longitude coordinates, %f %f", longitude, apLongitude);
1708 LOG_ERROR(
"Error setting site longitude coordinates");
1714 LOG_ERROR(
"Error setting site latitude coordinates");
1719 fs_sexa(l, latitude, 3, 3600);
1720 fs_sexa(L, longitude, 4, 3600);
1722 LOGF_DEBUG(
"Site location updated to Lat %.32s - Long %.32s, deg: %f, %f", l, L, latitude, longitude);
1723 apLocationInitialized =
true;
1729 if ((latitude == 0.) && (longitude == 0.))
1731 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1736 return updateAPLocation(latitude, longitude, elevation);
1765 double parkAz {90}, parkAlt {0};
1768 LOG_DEBUG(
"PARK_CURRENT not implemented");
1770 else if (calcParkPosition(parkPos, &parkAlt, &parkAz))
1772 LOGF_DEBUG(
"Set park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
1776 LOGF_ERROR(
"Unable to set park position %d!!", parkPos);
1779 char AzStr[16] = {0}, AltStr[16] = {0};
1780 fs_sexa(AzStr, parkAz, 2, 3600);
1781 fs_sexa(AltStr, parkAlt, 2, 3600);
1782 LOGF_INFO(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1797 Goto(equatorialCoords.rightascension, equatorialCoords.declination);
1812 LOGF_ERROR(
"Error Slewing to Az %s - Alt %s", AzStr, AltStr);
1822 LOG_INFO(
"Parking is in progress...");
1827bool LX200AstroPhysicsV2::calcParkPosition(ParkPosition pos,
double * parkAlt,
double * parkAz)
1833 LOG_ERROR(
"Called calcParkPosition with PARK_CUSTOM or PARK_LAST!");
1838 LOG_ERROR(
"Called calcParkPosition with PARK_CURRENT!");
1846 LOG_INFO(
"Computing PARK1 position...");
1855 LOG_INFO(
"Computing PARK2 position...");
1868 LOG_INFO(
"Computing PARK3 position");
1875 LOG_INFO(
"Computing PARK4 position...");
1886 LOGF_DEBUG(
"calcParkPosition: parkPos=%d parkAlt=%f parkAz=%f", pos, *parkAlt, *parkAz);
1895 double unparkAlt = 0, unparkAz = 0;
1897 if (!unpark_from_last_config)
1900 LOGF_DEBUG(
"UnPark: park position = %d from current driver", unparkfromPos);
1901 if (!calcParkPosition(unparkfromPos, &unparkAlt, &unparkAz))
1903 LOG_ERROR(
"UnPark: Error calculating unpark position!");
1908 LOGF_DEBUG(
"UnPark: parkPos=%d parkAlt=%f parkAz=%f", unparkfromPos, unparkAlt, unparkAz);
1911 bool isAPParked =
true;
1914 if (!IsMountParked(&isAPParked))
1916 LOG_WARN(
"UnPark:could not determine AP park status");
1924 LOG_WARN(
"UnPark: AP mount status: unparked, park first");
1936 LOG_ERROR(
"UnParking AP mount failed.");
1961 if (!unpark_from_last_config)
1967 char AzStr[16], AltStr[16];
1968 fs_sexa(AzStr, unparkAz, 2, 3600);
1969 fs_sexa(AltStr, unparkAlt, 2, 3600);
1970 char RaStr[16], DecStr[16];
1971 fs_sexa(RaStr, equatorialCoords.rightascension, 2, 3600);
1972 fs_sexa(DecStr, equatorialCoords.declination, 2, 3600);
1978 LOGF_INFO(
"UnPark: Current parking position Az (%s) Alt (%s), HA (%s) RA (%s) Dec (%s)", AzStr, AltStr, HaStr,
1989 bool success = APSync(equatorialCoords.rightascension, equatorialCoords.declination,
false);
1997 LOGF_INFO(
"UnPark: Sync'd (:CM) to RA/DEC: %f %f", equatorialCoords.rightascension, equatorialCoords.declination);
2019 LOGF_ERROR(
"Error setting center (MoveTo) rate (%d).", err);
2030 LOGF_ERROR(
"Error setting slew to rate (%d).", err);
2037 LOG_DEBUG(
"UnPark: Mount unparked successfully");
2052void LX200AstroPhysicsV2::syncSideOfPier()
2054 const char *
cmd =
"#:pS#";
2056 char response[16] = { 0 };
2057 int rc = 0, nbytes_read = 0, nbytes_written = 0;
2061 tcflush(
PortFD, TCIOFLUSH);
2067 LOGF_ERROR(
"Error writing to device %s (%d)", errmsg, rc);
2076 LOGF_ERROR(
"Error reading from device %s (%d)", errmsg, rc);
2080 response[nbytes_read - 1] =
'\0';
2082 tcflush(
PortFD, TCIOFLUSH);
2086 if (!strcmp(response,
"East"))
2088 else if (!strcmp(response,
"West"))
2091 LOGF_ERROR(
"Invalid pier side response from device-> %s", response);
2111 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode(%d)", mode);
2117 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2126 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2137 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackEnabled(%d)", enabled);
2141 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode() returned %d", rc);
2190 states[rememberSlewRate] =
ISS_ON;
2195 rememberSlewRate = -1;
2208 states[rememberSlewRate] =
ISS_ON;
2213 rememberSlewRate = -1;
The Interface class is the base class for all INDI connection plugins.
virtual std::string name()=0
void setConnectionType(int type)
TODO should be renamed to setDefaultConnectionType.
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...
INDI::PropertyNumber GuideNSNP
INDI::PropertyNumber GuideWENP
void setState(IPState state)
const char * getDeviceName() const
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
const char * getName() const
bool isNameMatch(const char *otherName) const
bool isSwitchOn(const std::string &name) const
bool update(const ISState states[], const char *const names[], int n)
int findOnSwitchIndex() const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
TelescopeStatus TrackState
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
Connection::TCP * tcpConnection
void setPECState(TelescopePECState state)
IGeographicCoordinates m_Location
@ TELESCOPE_HAS_TRACK_RATE
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_CONTROL_TRACK
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)
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.
@ LX200_HAS_PULSE_GUIDING
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...
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.
INDI::PropertySwitch ParkSP
INDI::PropertySwitch AbortSP
INDI::PropertyNumber TrackRateNP
INDI::PropertySwitch MovementNSSP
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch PECStateSP
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertySwitch MovementWESP
INDI::PropertySwitch CoordSP
INDI::PropertyNumber LocationNP
#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 sidereal time given longitude and system clock.
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.
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,...)
#define TRACKRATE_SIDEREAL
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)
int selectAPSlewRate(int fd, int slewIndex)
const char * apMountStatus(const char *statusString)
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.