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" }
258 SlewRateSP[6].fill(standard_rates[i][0].c_str(), standard_rates[i][0].append(
"x").c_str(),
ISS_OFF);
259 SlewRateSP[7].fill(standard_rates[i][1].c_str(), standard_rates[i][1].append(
"x").c_str(),
ISS_OFF);
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"))
503 firmwareVersion =
MCV_V;
505 setMajorMinorVersions(versionString);
508 else if (strstr(versionString,
"VCP6"))
511 firmwareVersion =
MCV_V;
513 setMajorMinorVersions(versionString);
516 else if (strlen(versionString) == 1 || strlen(versionString) == 2)
520 int typeIndex =
VersionT[0].text[0] -
'D';
524 LOGF_DEBUG(
"Firmware version index: %d", typeIndex);
525 if (firmwareVersion <
MCV_G)
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);
612bool 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];
741 if (!strcmp(name,
SwapSP.name))
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);
809 int pecstate =
PECStateSP.findOnSwitchIndex();
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!");
878 if (
ParkSP.isNameMatch(name))
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)
1012 sTimeStr = std::to_string(val);
1036 char apStatusString[256];
1045 processMountStatus(apStatusString);
1063 LOGF_DEBUG(
"APStatus: %s %s stime: %s RA/DEC: %.3f %.3f",
1068 const double dx = fabs(lastRA -
currentRA);
1076 if (dx < 1e-3 && dy < 1e-3)
1079 LOG_INFO(
"Slew is complete. Tracking...");
1088 bool slewcomplete =
false;
1089 double PARKTHRES = 0.1;
1092 slewcomplete =
true;
1103 const double dx = fabs(lastAZ - currentAz);
1104 const double dy = fabs(lastAL - currentAlt);
1105 LOGF_DEBUG(
"Parking... currentAz: %g dx: %g currentAlt: %g dy: %g", currentAz, dx, currentAlt, dy);
1110 if (slewcomplete && (dx > PARKTHRES || dy > PARKTHRES))
1112 LOG_WARN(
"Parking... slew status indicates mount stopped by dx/dy too far from mount - continuing!");
1113 slewcomplete =
false;
1120 LOG_DEBUG(
"Parking slew is complete. Asking astrophysics mount to park...");
1121 if (!parkInternal())
1129 lastAL = currentAlt;
1139bool LX200AstroPhysicsV2::parkInternal()
1152bool LX200AstroPhysicsV2::IsMountParked(
bool * isAPParked)
1167 *isAPParked = (parkStatus ==
'P');
1178 const struct timespec timeout = {0, 100000000L};
1183 char RAStr[64], DecStr[64];
1216 nanosleep(&timeout,
nullptr);
1235 LOGF_ERROR(
"Error Slewing to JNow RA %s - DEC %s\n", RAStr, DecStr);
1247 LOGF_INFO(
"Slewing to RA: %s - DEC: %s", RAStr, DecStr);
1262 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1291 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1321 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1351 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1395 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutWE() pulse guide simul = %d", simul);
1413 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutNS() pulse guide simul = %d", simul);
1438 LOG_INFO(
"Simulated Astrophysics is online. Retrieving basic data...");
1439 getFirmwareVersion();
1447 LOGF_ERROR(
"Error clearing the buffer (%d): %s", err, strerror(err));
1452 LOG_INFO(
"Setting generic udp format (1)");
1460 LOGF_ERROR(
"Error setting backlash compensation (%d): %s.", err, strerror(err));
1467 rc = getFirmwareVersion();
1472 LOG_ERROR(
"Firmware detection failed or is unknown. This driver requires at least version T firmware");
1479 LOGF_ERROR(
"Handshake: Error setting tracking mode to zero (%d).", err);
1490 apIsInitialized =
false;
1491 apInitializationChecked =
false;
1492 apLocationInitialized =
false;
1493 apTimeInitialized =
false;
1501 apInitializationChecked =
true;
1507bool LX200AstroPhysicsV2::isAPReady()
1509 if (!apInitializationChecked)
1513 if (apIsInitialized)
1519 if (apLocationInitialized && apTimeInitialized)
1521 bool commWorked =
true;
1522 char statusString[256];
1541 bool mountOk =
false;
1547 if (commWorked && mountOk)
1549 apIsInitialized =
true;
1567 apIsInitialized =
true;
1572 LOG_ERROR(
"Could not initialize mount.");
1583 apIsInitialized =
false;
1584 apLocationInitialized =
false;
1585 apTimeInitialized =
false;
1586 apInitializationChecked =
false;
1591bool LX200AstroPhysicsV2::APSync(
double ra,
double dec,
bool recalibrate)
1593 char syncString[256] =
"";
1600 LOG_ERROR(
"Error setting RA/DEC. Unable to Sync.");
1629 LOGF_DEBUG(
"%s Synchronization successful %s", (recalibrate ?
"CMR" :
"CM"), syncString);
1641 return APSync(
ra,
dec,
true);
1648 struct ln_zonedate ltm;
1650 ln_date_to_zonedate(utc, <m, utc_offset * 3600.0);
1651 JD = ln_get_julian_day(utc);
1652 LOGF_DEBUG(
"New JD is %f, local time: %d, %d, %d, utc offset: %f",
JD, ltm.hours, ltm.minutes, (
int)ltm.seconds,
1661 LOGF_DEBUG(
"Set Local Time %02d:%02d:%02d is successful.", ltm.hours, ltm.minutes,
1669 LOGF_DEBUG(
"Set Local Date %02d/%02d/%02d is successful.", ltm.days, ltm.months, ltm.years);
1678 double ap_utc_offset = - utc_offset;
1688 LOGF_DEBUG(
"Set UTC Offset %g as AP UTC Offset %g is successful.", utc_offset, ap_utc_offset);
1689 apTimeInitialized =
true;
1693bool LX200AstroPhysicsV2::updateAPLocation(
double latitude,
double longitude,
double elevation)
1696 LOG_DEBUG(
"LX200AstroPhysicsV2::updateLocation entry");
1698 if ((latitude == 0.) && (longitude == 0.))
1700 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1705 double apLongitude = 360 - longitude ;
1706 while (apLongitude < 0)
1708 while (apLongitude > 360)
1711 LOGF_DEBUG(
"Setting site longitude coordinates, %f %f", longitude, apLongitude);
1715 LOG_ERROR(
"Error setting site longitude coordinates");
1721 LOG_ERROR(
"Error setting site latitude coordinates");
1726 fs_sexa(l, latitude, 3, 3600);
1727 fs_sexa(L, longitude, 4, 3600);
1729 LOGF_DEBUG(
"Site location updated to Lat %.32s - Long %.32s, deg: %f, %f", l, L, latitude, longitude);
1730 apLocationInitialized =
true;
1736 if ((latitude == 0.) && (longitude == 0.))
1738 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1743 return updateAPLocation(latitude, longitude, elevation);
1772 double parkAz {90}, parkAlt {0};
1775 LOG_DEBUG(
"PARK_CURRENT not implemented");
1777 else if (calcParkPosition(parkPos, &parkAlt, &parkAz))
1779 LOGF_DEBUG(
"Set park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
1783 LOGF_ERROR(
"Unable to set park position %d!!", parkPos);
1786 char AzStr[16] = {0}, AltStr[16] = {0};
1787 fs_sexa(AzStr, parkAz, 2, 3600);
1788 fs_sexa(AltStr, parkAlt, 2, 3600);
1789 LOGF_INFO(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1819 LOGF_ERROR(
"Error Slewing to Az %s - Alt %s", AzStr, AltStr);
1829 LOG_INFO(
"Parking is in progress...");
1834bool LX200AstroPhysicsV2::calcParkPosition(ParkPosition pos,
double * parkAlt,
double * parkAz)
1840 LOG_ERROR(
"Called calcParkPosition with PARK_CUSTOM or PARK_LAST!");
1845 LOG_ERROR(
"Called calcParkPosition with PARK_CURRENT!");
1853 LOG_INFO(
"Computing PARK1 position...");
1862 LOG_INFO(
"Computing PARK2 position...");
1875 LOG_INFO(
"Computing PARK3 position");
1882 LOG_INFO(
"Computing PARK4 position...");
1893 LOGF_DEBUG(
"calcParkPosition: parkPos=%d parkAlt=%f parkAz=%f", pos, *parkAlt, *parkAz);
1902 double unparkAlt = 0, unparkAz = 0;
1904 if (!unpark_from_last_config)
1907 LOGF_DEBUG(
"UnPark: park position = %d from current driver", unparkfromPos);
1908 if (!calcParkPosition(unparkfromPos, &unparkAlt, &unparkAz))
1910 LOG_ERROR(
"UnPark: Error calculating unpark position!");
1915 LOGF_DEBUG(
"UnPark: parkPos=%d parkAlt=%f parkAz=%f", unparkfromPos, unparkAlt, unparkAz);
1918 bool isAPParked =
true;
1921 if (!IsMountParked(&isAPParked))
1923 LOG_WARN(
"UnPark:could not determine AP park status");
1931 LOG_WARN(
"UnPark: AP mount status: unparked, park first");
1943 LOG_ERROR(
"UnParking AP mount failed.");
1968 if (!unpark_from_last_config)
1974 char AzStr[16], AltStr[16];
1975 fs_sexa(AzStr, unparkAz, 2, 3600);
1976 fs_sexa(AltStr, unparkAlt, 2, 3600);
1977 char RaStr[16], DecStr[16];
1985 LOGF_INFO(
"UnPark: Current parking position Az (%s) Alt (%s), HA (%s) RA (%s) Dec (%s)", AzStr, AltStr, HaStr,
2023 int switch_nr =
SlewRateSP.findOnSwitchIndex();
2026 LOGF_ERROR(
"Error setting center (MoveTo) rate (%d).", err);
2037 LOGF_ERROR(
"Error setting slew to rate (%d).", err);
2044 LOG_DEBUG(
"UnPark: Mount unparked successfully");
2059void LX200AstroPhysicsV2::syncSideOfPier()
2061 const char *
cmd =
"#:pS#";
2063 char response[16] = { 0 };
2064 int rc = 0, nbytes_read = 0, nbytes_written = 0;
2068 tcflush(
PortFD, TCIOFLUSH);
2074 LOGF_ERROR(
"Error writing to device %s (%d)", errmsg, rc);
2083 LOGF_ERROR(
"Error reading from device %s (%d)", errmsg, rc);
2087 response[nbytes_read - 1] =
'\0';
2089 tcflush(
PortFD, TCIOFLUSH);
2093 if (!strcmp(response,
"East"))
2095 else if (!strcmp(response,
"West"))
2098 LOGF_ERROR(
"Invalid pier side response from device-> %s", response);
2118 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode(%d)", mode);
2124 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2133 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2144 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackEnabled(%d)", enabled);
2148 LOGF_DEBUG(
"LX200AstroPhysicsV2::SetTrackMode() returned %d", rc);
2197 states[rememberSlewRate] =
ISS_ON;
2202 rememberSlewRate = -1;
2215 states[rememberSlewRate] =
ISS_ON;
2220 rememberSlewRate = -1;
The Interface class is the base class for all INDI connection plugins.
virtual std::string name()=0
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)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
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
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()
@ TELESCOPE_HAS_TRACK_RATE
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_CONTROL_TRACK
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...
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)
@ LX200_HAS_PULSE_GUIDING
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.
*brief user defined string literal for JSON values *sa std::size_t n
#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.