40#include <libnova/libnova.h>
42#define PRODUCT_TAB "Product"
43#define ALIGNMENT_TAB "Alignment"
44#define LX200_TIMEOUT 5
47#define REFRACTION_MODEL_TEMPERATURE "REFRACTION_MODEL_TEMPERATURE"
48#define REFRACTION_MODEL_PRESSURE "REFRACTION_MODEL_PRESSURE"
49#define MODEL_COUNT "MODEL_COUNT"
50#define ALIGNMENT_POINTS "ALIGNMENT_POINTS"
51#define ALIGNMENT_STATE "Alignment"
52#define MINIMAL_NEW_ALIGNMENT_POINT_RO "MINIMAL_NEW_ALIGNMENT_POINT_RO"
53#define MINIMAL_NEW_ALIGNMENT_POINT "MINIMAL_NEW_ALIGNMENT_POINT"
54#define NEW_ALIGNMENT_POINT "NEW_ALIGNMENT_POINT"
55#define NEW_ALIGNMENT_POINTS "NEW_ALIGNMENT_POINTS"
56#define NEW_MODEL_NAME "NEW_MODEL_NAME"
57#define PRODUCT_INFO "PRODUCT_INFO"
58#define TLE_TEXT "TLE_TEXT"
59#define TLE_NUMBER "TLE_NUMBER"
60#define TRAJECTORY_TIME "TRAJECTORY_TIME"
61#define SAT_TRACKING_STAT "SAT_TRACKING_STAT"
62#define UNATTENDED_FLIP "UNATTENDED_FLIP"
63#define WAKE_ON_LAN_MAC "WAKE_ON_LAN_MAC"
64#define WAKE_ON_LAN_SEND "WAKE_ON_LAN_SEND"
65#define MOUNT_SHUTDOWN "MOUNT_SHUTDOWN"
66#define MERIDIAN_LIMITS "MERIDIAN_LIMITS"
67#define TRACKING_END "TRACKING_END"
68#define ALLOWED_MERIDIAN_SIDE "ALLOWED_MERIDIAN_SIDE"
69#define TARGET_PIER_SIDE "TARGET_PIER_SIDE"
70#define SLEW_SETTLE_TIME "SLEW_SETTLE_TIME"
72#define SLEW_SETTLE_TIME_MAX_IN_S 60
116 LOG_INFO(
"Setting Ultra Precision Mode.");
124 LOG_ERROR(
"Failed to set Ultra Precision Mode.");
205 char wolMacBuf[128] = {};
221 "%.0f", 0, 30, 1, 0);
223 "Tracking limit (deg), Flip Guide Tolerance, >= slew limit",
"%.0f", 2, 30, 1, 2);
226 TrackingEndNP[0].fill(
"TIME_TO_END_IN_S",
"Time to tracking end (s), estimate in whole minutes",
227 "%.0f", 0, 999999, 0, 0);
299 updateMeridianValues(
true);
317 LOGF_INFO(
"Unattended Flip from config and mount are %s",
323 LOGF_INFO(
"Could not read Unattended Flip from the mount, applying %s from config",
326 LOGF_INFO(
"Read Unattended Flip %s from config while mount has %s, updating mount",
338 LOG_INFO(
"Did not find an Unattended Flip setting in the config file. "
339 "Specify desired behaviour in Motion Control tab and save config in Options tab.");
385 LOG_WARN(
"Failed to get tracking frequency from device.");
394 char RefractionModelTemperature[80] = {0};
397 && sscanf(RefractionModelTemperature,
"%f", &rmtemp) == 1)
400 LOGF_INFO(
"RefractionModelTemperature is %0+6.1f degrees C", rmtemp);
405 LOG_WARN(
"Failed to read the refraction model temperature.");
410 char RefractionModelPressure[80] = {0};
413 && sscanf(RefractionModelPressure,
"%f", &rmpres) == 1)
416 LOGF_INFO(
"RefractionModelPressure is %06.1f hPa", rmpres);
421 LOG_WARN(
"Failed to read the refraction model pressure.");
430 LOGF_INFO(
"%d Alignment Models", ModelCount);
436 LOG_WARN(
"Failed to read the number of alignment models.");
441 int AlignmentPoints = 0;
445 LOGF_INFO(
"%d Alignment Stars in active model", AlignmentPoints);
451 LOG_WARN(
"Failed to read the number of alignment stars in the active model.");
461 LOG_INFO(
"sendLocationOnStartup is enabled, call sendScopeLocation.");
466 LOG_INFO(
"sendLocationOnStartup is disabled, do not call sendScopeLocation.");
470 LOG_INFO(
"sendTimeOnStartup is enabled, call sendScopeTime.");
475 LOG_INFO(
"sendTimeOnStartup is disabled, do not call sendScopeTime.");
480bool LX200_10MICRON::getMountInfo()
483 char ProductName[80] = {0};
485 char ControlBox[80] = {0};
487 char FirmwareVersion[80] = {0};
489 char FirmwareDate1[80] = {0};
491 char FirmwareDate2[80] = {0};
495 int dd = 0, yyyy = 0;
496 char FirmwareDate[80] = {0};
497 if (sscanf(FirmwareDate1,
"%3s %2d %4d", mon, &dd, &yyyy) == 3 &&
monthToNumber(mon) > 0)
498 snprintf(FirmwareDate,
sizeof(FirmwareDate),
"%04d-%02d-%02dT%s", yyyy,
monthToNumber(mon), dd, FirmwareDate2);
500 snprintf(FirmwareDate,
sizeof(FirmwareDate),
"%s %s", FirmwareDate1, FirmwareDate2);
502 LOGF_INFO(
"Product:%s Control box:%s Firmware:%s of %s", ProductName, ControlBox, FirmwareVersion, FirmwareDate);
553 char cmd[] =
"#:Ginfo#";
557 int nbytes_write = 0, nbytes_read = 0;
564 tcflush(fd, TCIFLUSH);
569 term = strchr(data,
'#');
582 nbytes_read = sscanf(data,
"%g,%g,%c,%g,%g,%g,%d,%d#", &Ginfo.RA_JNOW, &Ginfo.DEC_JNOW, &Ginfo.SideOfPier,
583 &Ginfo.AZ, &Ginfo.ALT, &Ginfo.Jdate, &Ginfo.Gstat, &Ginfo.SlewStatus);
589 if (Ginfo.Gstat != OldGstat)
593 LOGF_INFO(
"Gstat changed from %d to %d", OldGstat, Ginfo.Gstat);
597 LOGF_INFO(
"Gstat initialized at %d", Ginfo.Gstat);
617 LOGF_INFO(
"Gstat %d means the mount is no longer parked.", Ginfo.Gstat);
683 OldGstat = Ginfo.Gstat;
684 NewRaDec(Ginfo.RA_JNOW, Ginfo.DEC_JNOW);
687 if (slewing != MountSlewing)
689 MountSlewing = slewing;
690 updateSlewDependentValues();
694 char LocalSiderealTimeS[80];
696 f_scansexa(LocalSiderealTimeS, &Ginfo.SiderealTime);
703 updateMeridianValues(
false);
763 LOG_ERROR(
"Start tracking command failed");
772 LOG_ERROR(
"Stop tracking command failed");
806 return '1' == guaf[0];
824 LOG_WARN(
"Failed to read the Unattended Flip setting.");
838 LOGF_INFO(
"Unattended Flip is %s.", enabled ?
"enabled" :
"disabled");
840 LOGF_INFO(
"Unattended Flip changed on the mount: %s.", enabled ?
"enabled" :
"disabled");
853 LOG_WARN(
"Unattended Flip was written, but could not be read back.");
857 LOGF_ERROR(
"The mount did not take Unattended Flip %s.",
879 snprintf(data,
sizeof(data),
"#:Suaf%d#", (setting ==
false) ? 0 : 1);
882 if (setting ==
false)
901void LX200_10MICRON::updateSlewDependentValues()
916 LOG_INFO(
"Slew ended, mount settled.");
919 lastMeridianFastPoll = std::chrono::steady_clock::now();
936void LX200_10MICRON::updateMeridianValues(
bool all)
942 MountSlewing =
false;
944 const auto now = std::chrono::steady_clock::now();
946 if (all || (!MountSlewing && now - lastMeridianFastPoll >= std::chrono::seconds(10)))
950 lastMeridianFastPoll = now;
952 if (all || now - lastMeridianSlowPoll >= std::chrono::seconds(60))
962 lastMeridianSlowPoll = now;
995 char slewLimitString[80] = {0}, trackLimitString[80] = {0};
996 int slewLimit = 0, trackLimit = 0;
997 if (
getCommandString(
PortFD, slewLimitString,
"#:Glms#") != 0 || sscanf(slewLimitString,
"%d", &slewLimit) != 1 ||
998 getCommandString(
PortFD, trackLimitString,
"#:Glmt#") != 0 || sscanf(trackLimitString,
"%d", &trackLimit) != 1)
1006 LOG_WARN(
"Failed to read the meridian limits.");
1021 LOGF_INFO(
"Meridian limits are: slew %d, tracking %d degrees.", slewLimit, trackLimit);
1023 LOGF_INFO(
"Meridian limits changed on the mount: slew %d, tracking %d degrees.", slewLimit, trackLimit);
1055 snprintf(data,
sizeof(data),
"#:Slms%02d#", slewLimit);
1059 snprintf(data,
sizeof(data),
"#:Slmt%02d#", trackLimit);
1075 char timeToEndString[80] = {0};
1077 if (
getCommandString(
PortFD, timeToEndString,
"#:Gmte#") != 0 || sscanf(timeToEndString,
"%d", &minutes) != 1)
1081 LOG_WARN(
"Failed to read the time to tracking end.");
1123 char sideString[80] = {0};
1125 if (
getCommandString(
PortFD, sideString,
"#:GMF#") != 0 || sscanf(sideString,
"%d", &side) != 1 || side < 1
1134 LOG_WARN(
"Failed to read the allowed meridian side.");
1140 const int index = side - 1;
1174 snprintf(data,
sizeof(data),
"#:SMF%d#", side + 1);
1199 char sideString[2] = {0};
1203 switch (sideString[0])
1220 LOG_WARN(
"Failed to read the target pier side.");
1250 char settleTimeString[80] = {0};
1252 if (
getCommandString(
PortFD, settleTimeString,
"#:Gstm#") != 0 || sscanf(settleTimeString,
"%lf", &seconds) != 1)
1260 LOG_WARN(
"Failed to read the slew settle time.");
1278 LOGF_INFO(
"Slew settle time changed on the mount: %.3f s, %s 0-%d s.", seconds, range,
1305 snprintf(data,
sizeof(data),
"#:Sstm%09.3f#", seconds);
1325 const char *
cmd =
nullptr;
1369 char rateString[80] = {0};
1379 LOG_WARN(
"Failed to read the track mode.");
1386 if (std::fabs(value - 60.2) < 0.05)
1388 else if (std::fabs(value - 60.3) < 0.05)
1390 else if (std::fabs(value - 62.4) < 0.05)
1417static std::string escapeMountString(
const std::string &text)
1419 std::string escaped;
1420 for (
unsigned char c : text)
1424 else if (c ==
'#' || c ==
',' || c < 0x20 || c > 0x7E)
1427 snprintf(hex,
sizeof(hex),
"$%02X", c);
1431 escaped +=
static_cast<char>(c);
1449 std::string modelName(name);
1450 while (!modelName.empty() && modelName.back() ==
' ')
1451 modelName.pop_back();
1452 if (modelName.empty())
1454 LOG_ERROR(
"Model not saved: the name is empty.");
1457 if (modelName.size() > 15)
1459 LOGF_ERROR(
"Model not saved: the name %s is longer than 15 characters.", modelName.c_str());
1462 const std::string escaped = escapeMountString(modelName);
1463 const std::string
cmd =
"#:modelsv0" + escaped +
"#";
1464 char reply[80] = {0};
1467 LOGF_ERROR(
"Model %s: no reply from the mount to the save command.", modelName.c_str());
1470 if (reply[0] ==
'1')
1472 LOGF_INFO(
"Model saved as %s.", modelName.c_str());
1477 bool exists =
false;
1481 for (
int i = 1; i <= count && !exists; i++)
1484 char listName[80] = {0};
1485 snprintf(listCmd,
sizeof(listCmd),
"#:modelnam%d#", i);
1490 LOGF_ERROR(
"Model not saved: the mount already has a model named %s.", modelName.c_str());
1492 LOGF_ERROR(
"The mount could not save the model as %s.", modelName.c_str());
1512bool LX200_10MICRON::flip()
1526 snprintf(data,
sizeof(data),
"#:FLIP#");
1561 snprintf(data,
sizeof(data),
":SC%04d-%02d-%02d#", years, months, days);
1583 LOGF_INFO(
"The function is called with TLE %s", tle);
1584 if (strlen(tle) > 230)
1589 std::string tle_str;
1590 std::string sep =
"$0a";
1591 std::string search =
"\n";
1592 tle_str = (std::string) tle;
1593 for(
size_t pos = 0; ; pos += sep.length() )
1596 pos = tle_str.find( search, pos );
1597 if( pos == std::string::npos )
break;
1599 tle_str.erase( pos, search.length() );
1600 tle_str.insert( pos, sep );
1603 snprintf(command,
sizeof(command),
":TLEL0%s#", tle_str.c_str());
1614 if (response[0] ==
'E')
1616 LOG_ERROR(
"Invalid formatting of TLE, trying to split:");
1617 char *pch = strtok ((
char*) tle,
"\n");
1618 while (pch !=
nullptr)
1621 pch = strtok (
nullptr,
"\n");
1628 char *pch = strtok ((
char*) tle,
"\n");
1629 while (pch !=
nullptr)
1632 pch = strtok (
nullptr,
"\n");
1649 snprintf(command,
sizeof(command),
":TLEDL%d#", tleN);
1651 LOG_INFO(
"Setting TLE from Database");
1661 if (response[0] ==
'E')
1683 struct ln_date start_pass;
1684 if (
extractISOTime(start_pass_isodatetime.c_str(), &start_pass) == -1)
1686 LOGF_ERROR(
"Date/Time is invalid: %s.", start_pass_isodatetime.c_str());
1690 struct ln_date end_pass;
1691 if (
extractISOTime(end_pass_isodatetime.c_str(), &end_pass) == -1)
1693 LOGF_ERROR(
"Date/Time is invalid: %s.", end_pass_isodatetime.c_str());
1699 JD_start = ln_get_julian_day(&start_pass);
1700 JD_end = ln_get_julian_day(&end_pass);
1701 int nextPassInMinutes =
static_cast<int>(ceil((JD_end - JD_start) * 24 * 60));
1702 int nextPassinMinutesUpTo1440 = std::min(nextPassInMinutes, 1440);
1703 int nextPassinMinutesBetween1and1440 = std::max(nextPassinMinutesUpTo1440, 1);
1706 snprintf(command,
sizeof(command),
":TLEP%7.8f,%01d#", JD_start, nextPassinMinutesBetween1and1440);
1707 LOGF_INFO(
"Julian day %7.8f", JD_start);
1708 LOGF_INFO(
"For the next %01d minutes", nextPassinMinutesBetween1and1440);
1719 if (response[0] ==
'E')
1721 LOG_ERROR(
"TLE not loaded or invalid command");
1724 if (response[0] ==
'N')
1745 snprintf(command,
sizeof(command),
":TLES#");
1755 if (response[0] ==
'E')
1757 LOG_ERROR(
"TLE transit not calculated");
1760 if (response[0] ==
'F')
1765 if (response[0] ==
'V')
1767 LOG_INFO(
"Slewing to start of transit");
1770 if (response[0] ==
'S')
1772 LOG_INFO(
"Slewing to transiting satellite");
1775 if (response[0] ==
'Q')
1793 snprintf(data, 16,
"#:SRTMP%0+6.1f#",
temperature);
1807 snprintf(data, 16,
"#:SRPRS%06.1f#", pressure);
1830 char MRa_str[32], MDec_str[32];
1831 fs_sexa(MRa_str, MRa, 0, 36000);
1832 fs_sexa(MDec_str, MDec, 0, 3600);
1835 (
static_cast<int>(MSide) == 0) ? MSide_char =
'E' : MSide_char =
'W';
1837 char PRa_str[32], PDec_str[32];
1838 fs_sexa(PRa_str, PRa, 0, 36000);
1839 fs_sexa(PDec_str, PDec, 0, 3600);
1841 char SidTime_str[32];
1842 fs_sexa(SidTime_str, SidTime, 0, 36000);
1845 snprintf(command, 80,
"#:newalpt%s,%s,%c,%s,%s,%s#", MRa_str, MDec_str, MSide_char, PRa_str, PDec_str, SidTime_str);
1856 int nbytes_read = sscanf(response,
"%3d#", &points);
1857 if (nbytes_read < 0)
1859 LOGF_ERROR(
"AddSyncPoint response error %d", nbytes_read);
1862 LOGF_INFO(
"AddSyncPoint responded [%4s], there are now %d new alignment points", response, points);
1871 double MSide = (toupper(Ginfo.SideOfPier) ==
'E') ? 0 : 1;
1872 return AddSyncPoint(Ginfo.RA_JNOW, Ginfo.DEC_JNOW, MSide, PRa, PDec, Ginfo.SiderealTime);
1883 for (
int i = 0; i <
n; i++)
1886 slewLimit =
static_cast<int>(std::lround(values[i]));
1888 trackLimit =
static_cast<int>(std::lround(values[i]));
1890 if (trackLimit < slewLimit)
1892 LOGF_ERROR(
"Tracking limit (Flip Guide Tolerance) %d must be >= slew limit (Flip Slew Tolerance) %d, "
1893 "nothing written to the mount.", trackLimit, slewLimit);
1899 bool result =
false;
1902 LOGF_ERROR(
"The mount refused tracking limit %d with slew limit %d.", trackLimit, slewLimit);
1907 LOG_WARN(
"Meridian limits were written, but could not be read back.");
1911 LOGF_INFO(
"Meridian limits set: slew %d, tracking %d degrees.",
1922 for (
int i = 0; i <
n; i++)
1925 seconds = values[i];
1929 LOGF_ERROR(
"Slew settle time %.3f s is outside the range 0-%d s, nothing written to the mount.", seconds,
1936 bool result =
false;
1939 LOGF_ERROR(
"The mount refused slew settle time %.3f s.", seconds);
1944 LOG_WARN(
"Slew settle time was written, but could not be read back.");
1959 LOG_ERROR(
"SetRefractionModelTemperature error");
1974 LOG_ERROR(
"SetRefractionModelPressure error");
2003 LOG_ERROR(
"Cannot add alignment points yet, need to start a new alignment first");
2023 LOG_ERROR(
"Cannot add alignment points yet, need to start a new alignment first");
2048 if (strcmp(name,
"TLE_NUMBER") == 0)
2050 LOG_INFO(
"I am trying to set from Database");
2089 bool result =
false;
2092 LOGF_ERROR(
"The mount refused allowed meridian side %s.", label);
2097 LOG_WARN(
"Allowed meridian side was written, but could not be read back.");
2101 LOGF_ERROR(
"The mount did not take allowed meridian side %s.", label);
2106 LOGF_INFO(
"Allowed meridian side set: %s.", label);
2116 const int previousIndex =
TrackModeSP.findOnSwitchIndex();
2118 const int index =
TrackModeSP.findOnSwitchIndex();
2135 const char *label =
TrackModeSP[index].getLabel();
2136 bool result =
false;
2139 LOGF_ERROR(
"Failed to send track mode %s.", label);
2144 LOG_WARN(
"Track mode was written, but could not be read back.");
2146 else if (
TrackModeSP.findOnSwitchIndex() != index)
2148 LOGF_ERROR(
"The mount did not take track mode %s.", label);
2153 LOGF_INFO(
"Track mode set: %s.", label);
2168 LOG_INFO(
"Alignment state is IDLE");
2215 LOG_ERROR(
"Delete current alignment error");
2220 LOG_INFO(
"Current Alignment deleted");
2269 LOGF_ERROR(
"Unknown tracking modus %d", index);
2283 LOG_ERROR(
"Setting unattended flip failed");
2292 LOG_ERROR(
"Setting unattended flip failed");
2309 if (sendWakeOnLanPacket())
2312 LOG_INFO(
"Wake on LAN packet sent successfully.");
2317 LOG_ERROR(
"Failed to send Wake on LAN packet.");
2328 LOG_WARN(
"Mount must be parked before shutdown.");
2336 LOG_ERROR(
"Mount shutdown command failed.");
2341 LOG_INFO(
"Mount shutdown initiated. Disconnecting before mount powers off.");
2344 m_ShutdownPending =
true;
2365 if (strcmp(name,
"SAT_TLE_TEXT") == 0)
2384 LOG_ERROR(
"TLE was not correctly uploaded");
2388 if (strcmp(name,
"SAT_PASS_WINDOW") == 0)
2403 LOG_ERROR(
"Trajectory could not be calculated");
2427 entry month_table[] = { {
"Jan", 1 }, {
"Feb", 2 }, {
"Mar", 3 }, {
"Apr", 4 }, {
"May", 5 },
2428 {
"Jun", 6 }, {
"Jul", 7 }, {
"Aug", 8 }, {
"Sep", 9 }, {
"Oct", 10 },
2429 {
"Nov", 11 }, {
"Dec", 12 }, {
nullptr, 0 }
2431 entry *p = month_table;
2432 while (p->name !=
nullptr)
2434 if (strcasecmp(p->name, monthName) == 0)
2444 int nbytes_write = 0;
2447 tcflush(fd, TCIFLUSH);
2450 LOGF_ERROR(
"CMD <%s> write ERROR %d", data, error_type);
2453 tcflush(fd, TCIFLUSH);
2459 char bool_return[2];
2461 int nbytes_write = 0, nbytes_read = 0;
2464 tcflush(fd, TCIFLUSH);
2467 LOGF_ERROR(
"CMD <%s> write ERROR %d", data, error_type);
2471 tcflush(fd, TCIFLUSH);
2473 if (nbytes_read < 1)
2475 LOGF_ERROR(
"CMD <%s> read ERROR %d", data, error_type);
2479 if (bool_return[0] != expect[0])
2493 int nbytes_write = 0, nbytes_read = 0;
2496 tcflush(fd, TCIFLUSH);
2499 LOGF_ERROR(
"CMD <%s> write ERROR %d", data, error_type);
2503 tcflush(fd, TCIFLUSH);
2505 if (nbytes_read < 1)
2507 LOGF_ERROR(
"CMD <%s> read ERROR %d", data, error_type);
2516 if (m_ShutdownPending)
2518 m_ShutdownPending =
false;
2528bool LX200_10MICRON::sendWakeOnLanPacket()
2530 const char *macStr =
WoLMacT[0].text;
2531 if (!macStr || macStr[0] ==
'\0')
2533 LOG_ERROR(
"WoL: MAC address not configured.");
2537 std::string
cmd =
"wakeonlan " + std::string(macStr);
2538 int ret = system(
cmd.c_str());
2541 LOGF_INFO(
"WoL: magic packet sent to %s", macStr);
2546 LOG_ERROR(
"WoL: wakeonlan tool not found. Please install it on your system.");
2549 LOG_ERROR(
"WoL: wakeonlan failed to send the packet.");
INDI::PropertyText getText(const char *name) const
virtual bool Disconnect()
Disconnect from device.
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg=nullptr)
Set connection switch status in the client.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual void TimerHit()
Callback function to be called once SetTimer duration elapses.
bool isSimulation() const
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
TelescopeStatus TrackState
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
bool isParked()
isParked is mount currently parked?
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
void setPierSide(TelescopePierSide side)
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
@ TELESCOPE_HAS_TRACK_RATE
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_TRACK_SATELLITE
@ TELESCOPE_HAS_TRACK_MODE
@ TELESCOPE_CAN_CONTROL_TRACK
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool sendScopeLocation()
bool sendLocationOnStartup
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
INumberVectorProperty TrackFreqNP
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 ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool sendScopeTime()
void setLX200Capability(uint32_t cap)
@ LX200_HAS_PULSE_GUIDING
@ LX200_HAS_TRACKING_FREQ
INDI::PropertyNumber MeridianLimitsNP
INumber RefractionModelTemperatureN[1]
INDI::PropertySwitch AllowedMeridianSideSP
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
void getBasicData() override
bool Handshake() override
perform handshake with device to check communication
bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
INumberVectorProperty ModelCountNP
INumberVectorProperty NewAlignmentPointsNP
ISwitchVectorProperty AlignmentStateSP
ITextVectorProperty NewModelNameTP
bool CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime)
INumberVectorProperty NewAlpNP
INumber NewAlignmentPointsN[1]
bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
int setStandardProcedureAndExpectChar(int fd, const char *data, const char *expect)
ITextVectorProperty WoLMacTP
bool getSlewSettleTime(LX200_10MICRON_READ_CONTEXT context)
@ UNATTENDED_FLIP_DISABLED
@ UNATTENDED_FLIP_ENABLED
bool UnPark() override
Unpark the telescope if already parked.
void updateUnattendedFlipSetting(LX200_10MICRON_READ_CONTEXT context)
int monthToNumber(const char *monthName)
INumberVectorProperty RefractionModelPressureNP
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool getAllowedMeridianSide(LX200_10MICRON_READ_CONTEXT context)
int setStandardProcedureWithoutRead(int fd, const char *data)
bool setAllowedMeridianSide(int side)
INumberVectorProperty RefractionModelTemperatureNP
bool SetTLEtoFollow(const char *tle)
ISwitchVectorProperty WoLSendSP
bool getTimeToTrackingEnd()
bool getUnattendedFlipSetting()
INDI::PropertyNumber SlewSettleTimeNP
bool getTrackMode(LX200_10MICRON_READ_CONTEXT context)
INDI::PropertyNumber TrackingEndNP
ITextVectorProperty ProductTP
bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
INDI::PropertySwitch TargetPierSideSP
const char * getDefaultName() override
virtual int SetRefractionModelPressure(double pressure)
INumber MiniNewAlpN[MALP_COUNT]
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
bool getMeridianLimits(LX200_10MICRON_READ_CONTEXT context)
bool setSlewSettleTime(double seconds)
INumberVectorProperty TLEfromDatabaseNP
INumber NewAlpN[ALP_COUNT]
int setStandardProcedureAndReturnResponse(int fd, const char *data, char *response, int max_response_length)
@ GSTAT_SLEWING_OR_STOPPING
@ GSTAT_TRACKING_OUTSIDE_LIMITS
@ GSTAT_FOLLOWING_SATELLITE
@ GSTAT_NOT_TRACKING_AND_NOT_MOVING
bool ReadScopeStatus() override
Read telescope status.
LX200_10MICRON_READ_CONTEXT
ISwitch UnattendedFlipS[UNATTENDED_FLIP_COUNT]
bool initProperties() override
Called to initialize basic properties required all the time.
INDI::PropertySwitch MountShutdownSP
INumber MiniNewAlpRON[MALPRO_COUNT]
bool setMeridianLimits(int slewLimit, int trackLimit)
bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual int SetRefractionModelTemperature(double temperature)
bool saveModel(const char *name)
bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
bool Park() override
Park the telescope to its home position.
bool SyncConfigBehaviour(bool cmcfg)
@ PRODUCT_FIRMWARE_VERSION
INumberVectorProperty MiniNewAlpRONP
ISwitchVectorProperty UnattendedFlipSP
bool Flip(double ra, double dec) override
Move and flip the scope to the supplied RA and DEC coordinates.
INumber TLEfromDatabaseN[1]
@ MERIDIAN_SIDE_EAST_ONLY
@ MERIDIAN_SIDE_WEST_ONLY
INumber AlignmentPointsN[1]
int AddSyncPoint(double MRa, double MDec, double MSide, double PRa, double PDec, double SidTime)
INumberVectorProperty MiniNewAlpNP
ISwitch AlignmentStateS[ALIGN_COUNT]
bool confirmUnattendedFlipSetting(int wanted)
INumberVectorProperty AlignmentPointsNP
bool SetTLEfromDatabase(int tleN)
int AddSyncPointHere(double PRa, double PDec)
bool setUnattendedFlipSetting(bool setting)
INumber RefractionModelPressureN[1]
const char * CONNECTION_TAB
CONNECTION_TAB Where all device connection settings (serial, usb, ethernet) are defined and controlle...
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * SATELLITE_TAB
SATELLITE_TAB.
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
INDI::PropertySwitch ParkSP
INDI::PropertyText TLEtoTrackTP
Text Vector property defining the orbital elements of an artificial satellite (TLE)....
INDI::PropertyText SatPassWindowTP
Text Vector property defining the start and end of a satellite pass (window contains pass)....
INDI::PropertySwitch TrackSatSP
Switch Vector property defining the state of the satellite tracking of the mount. Example implementat...
INDI::PropertySwitch TrackModeSP
@ SAT_HALT
Halt signal (abort).
@ SAT_PASS_WINDOW_END
Index for end of the window.
@ SAT_PASS_WINDOW_START
Index for start of the window.
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int f_scansexa(const char *str0, double *dp)
convert sexagesimal string str AxBxC to double. x can be anything non-numeric. Any missing A,...
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
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[].
Implementations for common driver routines.
int extractISOTime(const char *timestr, struct ln_date *iso_date)
Extract ISO 8601 time and store it in a tm struct.
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 IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
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 IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
int IUGetConfigText(const char *dev, const char *property, const char *member, char *value, int len)
IUGetConfigText Opens configuration file and reads single text 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 LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
#define DEBUGFDEVICE(device, priority, msg,...)
#define NEW_ALIGNMENT_POINT
#define MINIMAL_NEW_ALIGNMENT_POINT
#define REFRACTION_MODEL_PRESSURE
#define NEW_ALIGNMENT_POINTS
#define ALLOWED_MERIDIAN_SIDE
#define MINIMAL_NEW_ALIGNMENT_POINT_RO
#define SLEW_SETTLE_TIME_MAX_IN_S
#define REFRACTION_MODEL_TEMPERATURE
int getCommandInt(int fd, int *value, const char *cmd)
int setStandardProcedure(int fd, const char *data)
int checkLX200EquatorialFormat(int fd)
int setCommandInt(int fd, int data, const char *cmd)
int getTrackFreq(int fd, double *value)
int getCommandString(int fd, char *data, const char *cmd)