32static std::unique_ptr<Rainbow> scope(
new Rainbow());
77 IUFillSwitch(&SaveAlignBeforeSyncS[STAR_ALIGNMENT_ENABLED],
"STAR_ALIGNMENT_ENABLED",
"Enabled",
ISS_OFF);
78 IUFillSwitch(&SaveAlignBeforeSyncS[STAR_ALIGNMENT_DISABLED],
"STAR_ALIGNMENT_DISABLED",
"Disabled",
ISS_ON);
83 IUFillText(&RSTVersionsT[FIRMWARE],
"FIRMWARE",
"Firmware Version",
"");
84 IUFillText(&RSTVersionsT[SERIALNUMBER],
"SERIALNUMBER",
"Serial Number",
"");
89 IUFillSwitch(&PullVoltTempS[PULL_VOLTTEMP_ENABLED],
"PULL_VOLTTEMP_ENABLED",
"Enabled",
ISS_OFF);
90 IUFillSwitch(&PullVoltTempS[PULL_VOLTTEMP_DISABLED],
"PULL_VOLTTEMP_DISABLED",
"Disabled",
ISS_ON);
95 IUFillNumber(&RSTVoltTempN[VOLTAGE],
"VOLTAGE",
"Input Voltage (V)",
"%2.1f", 0, 20., 0., 0.);
96 IUFillNumber(&RSTVoltTempN[BOARD_TEMPERATURE],
"BOARD_TEMPERATURE",
"Board Temp. (°C)",
"%2.1f", -50, 70., 0., 0.);
97 IUFillNumber(&RSTVoltTempN[RA_M_TEMPERATURE],
"RA_M_TEMPERATURE",
"RA-Motor Temp. (°C)",
"%2.1f", -50, 70., 0., 0.);
98 IUFillNumber(&RSTVoltTempN[DE_M_TEMPERATURE],
"DE_M_TEMPERATURE",
"DEC-Motor Temp. (°C)",
"%2.1f", -50, 70., 0., 0.);
104 IUFillNumber(&RSTMotorPowN[RA_M_POWER],
"RA_M_POWER",
"RA-Motor (%)",
"%3.1f", 0, 100., 0., 0.);
105 IUFillNumber(&RSTMotorPowN[DE_M_POWER],
"DE_M_POWER",
"DE-Motor (%)",
"%3.1f", 0, 100., 0., 0.);
121 IUFillNumber(&GuideRateN[0],
"GUIDE_RATE",
"x Sidereal",
"%g", 0.1, 1.0, 0.1, 0.5);
125 IUFillNumber(&SlewSpeedsN[SLEW_SPEED_MAX],
"SLEW_SPEED_MAX",
"Max (x Siderial)",
"%g", 0, 2000, 0, 0);
126 IUFillNumber(&SlewSpeedsN[SLEW_SPEED_FIND],
"SLEW_SPEED_FIND",
"Find (x Siderial)",
"%g", 0, 2000, 0, 0);
127 IUFillNumber(&SlewSpeedsN[SLEW_SPEED_CENTERING],
"SLEW_SPEED_CENTERING",
"Centering (x Siderial)",
"%g", 0, 2000, 0, 0);
195 if (!strcmp(name, HorizontalCoordsNP.
name))
198 double newAlt = -1, newAz = -1;
201 for (nset = i = 0; i < n; i++)
203 if (horp == &HorizontalCoordsN[
AXIS_ALT])
206 nset += newAlt >= -90. && newAlt <= 90.0;
208 else if (horp == &HorizontalCoordsN[
AXIS_AZ])
211 nset += newAz >= 0. && newAz <= 360.0;
217 if (slewToHorizontalCoords(newAz, newAlt))
228 LOG_ERROR(
"Failed to slew to target coordinates.");
235 IDSetNumber(&HorizontalCoordsNP,
"Altitude or Azimuth missing or invalid");
240 else if (!strcmp(name, GuideRateNP.
name))
246 LOGF_INFO(
"Guide rate updated to %.2fX sidereal rate.", values[0]);
255 else if (!strcmp(name, SlewSpeedsNP.
name))
258 if (setSlewSpeedVal(SLEW_SPEED_MAX, values[SLEW_SPEED_MAX])
259 && setSlewSpeedVal(SLEW_SPEED_FIND, values[SLEW_SPEED_FIND])
260 && setSlewSpeedVal(SLEW_SPEED_CENTERING, values[SLEW_SPEED_CENTERING])
287 if (!strcmp(SaveAlignBeforeSyncSP.
name, name))
291 SaveAlignBeforeSyncSP.
s =
IPS_OK;
297 else if (!strcmp(PullVoltTempSP.
name, name))
300 if (PullVoltTempS[PULL_VOLTTEMP_DISABLED].s ==
ISS_ON)
302 RSTVoltTempN[VOLTAGE].value = 0.;
303 RSTVoltTempN[BOARD_TEMPERATURE].value = 0.;
304 RSTVoltTempN[RA_M_TEMPERATURE].value = 0.;
305 RSTVoltTempN[DE_M_TEMPERATURE].value = 0.;
306 RSTMotorPowN[RA_M_POWER].value = 0.;
307 RSTMotorPowN[DE_M_POWER].value = 0.;
313 LOG_INFO(
"Pulling RST's Voltage and Temperatures set to: off");
318 LOG_INFO(
"Pulling RST's Voltage and Temperatures set to: on");
335 LOGF_INFO(
"Detected firmware %s", m_Version.c_str());
341 if (getSlewSpeedVal(SLEW_SPEED_MAX) && (getSlewSpeedVal(SLEW_SPEED_FIND) && getSlewSpeedVal(SLEW_SPEED_CENTERING)))
344 double longitude = 0, latitude = 90;
375 char cmd[DRIVER_LEN] = {0};
376 int degrees, minutes, seconds;
388 snprintf(
cmd, DRIVER_LEN,
":Sg%c%03d*%02d'%02d#", longitude >= 0 ?
'+' :
'-', std::abs(degrees), minutes, seconds);
395 snprintf(
cmd, DRIVER_LEN,
":St%c%02d*%02d'%02d#", latitude >= 0 ?
'+' :
'-', std::abs(degrees), minutes, seconds);
421 char res[DRIVER_LEN] = {0};
427 m_Version = std::string(res + 3);
432 char fw[16] = {0}, sn[16] = {0};
433 sscanf(res + 3,
"%6s", fw);
434 memset(res, 0,
sizeof res);
439 sscanf(res + 3,
"%6s", sn);
453 char cmd[DRIVER_LEN] = {0};
454 snprintf(
cmd, DRIVER_LEN,
":Ct%c#", enabled ?
'A' :
'L');
463 char res[DRIVER_LEN] = {0};
492 char cmd[DRIVER_LEN] = {0};
493 snprintf(
cmd, DRIVER_LEN,
":Cu0=%3.1f#", rate);
502 char res[DRIVER_LEN] = {0};
508 memcpy(rate, res + 5, 3);
510 GuideRateN[0].value = std::stod(rate);
518bool Rainbow::setSlewSpeedVal(
int speedtype,
double rate)
520 char cmd[DRIVER_LEN] = {0};
521 snprintf(
cmd, DRIVER_LEN,
":Cu%d=%g#", speedtype == SLEW_SPEED_MAX ? 3 : (speedtype == SLEW_SPEED_FIND ? 2 : 1), rate);
522 LOGF_INFO(
"slew speed set to enum %d and value %g", speedtype, rate);
529bool Rainbow::getSlewSpeedVal(
int speedtype)
531 char res[DRIVER_LEN] = {0};
533 char cmd[DRIVER_LEN] = {0};
534 snprintf(
cmd, DRIVER_LEN,
":CU%d#", speedtype == SLEW_SPEED_MAX ? 3 : (speedtype == SLEW_SPEED_FIND ? 2 : 1));
537 memcpy(rate, res + 5, 4);
538 SlewSpeedsN[speedtype].value = std::stod(rate);
577 if (slewToHorizontalCoords(parkAZ, parkAlt))
582 LOG_INFO(
"Parking is in progress...");
614 char res[DRIVER_LEN] = {0};
619 if (!strcmp(res,
":MM0#") || !strcmp(res,
":CHO#"))
624 else if (!strcmp(res,
":MML#"))
628 else if (!strcmp(res,
":MMU#"))
632 else if (!strcmp(res,
":MME#"))
636 else if (!strcmp(res,
":CH0#"))
640 else if (!strcmp(res,
":CH<#"))
668 LOG_INFO(
"Homing completed successfully.");
680 LOG_INFO(
"Slew is complete. Tracking...");
683 else if (m_SlewErrorCode > 0)
696 LOGF_ERROR(
"Homing error: %s", getSlewErrorString(m_SlewErrorCode).c_str());
702 LOGF_ERROR(
"Slewing error: %s", getSlewErrorString(m_SlewErrorCode).c_str());
714 else if (m_SlewErrorCode > 0)
720 LOGF_ERROR(
"Parking error: %s", getSlewErrorString(m_SlewErrorCode).c_str());
735 if (!getAZ() || !getAL())
741 HorizontalCoordsN[
AXIS_AZ].value = m_CurrentAZ;
742 HorizontalCoordsN[
AXIS_ALT].value = m_CurrentAL;
750 if (PullVoltTempS[PULL_VOLTTEMP_ENABLED].s ==
ISS_ON)
753 char res[DRIVER_LEN] = {0};
757 sscanf(res + 3,
"%f", &v);
758 memset(res, 0,
sizeof res);
759 RSTVoltTempN[VOLTAGE].value = v;
762 sscanf(res + 3,
"%f|%f|%f", &bT, &rT, &dT);
763 memset(res, 0,
sizeof res);
764 RSTVoltTempN[BOARD_TEMPERATURE].value = bT;
765 RSTVoltTempN[RA_M_TEMPERATURE].value = rT;
766 RSTVoltTempN[DE_M_TEMPERATURE].value = dT;
774 sscanf(res + 3,
"%f|%f", &dP, &rP);
775 memset(res, 0,
sizeof res);
776 RSTMotorPowN[RA_M_POWER].value = rP;
777 RSTMotorPowN[DE_M_POWER].value = dP;
789 const struct timespec timeout = {0, 100000000L};
791 char RAStr[64] = {0}, DecStr[64] = {0};
824 nanosleep(&timeout,
nullptr);
829 LOGF_ERROR(
"Error Slewing to JNow RA %s - DEC %s", RAStr, DecStr);
834 LOGF_INFO(
"Slewing to RA: %s - DE: %s", RAStr, DecStr);
848 char res[DRIVER_LEN] = {0};
853 return (
f_scansexa(res + 3, &m_CurrentRA) == 0);
861 char res[DRIVER_LEN] = {0};
866 return (
f_scansexa(res + 3, &m_CurrentDE) == 0);
875 char cmd[DRIVER_LEN] = {0};
876 char res[DRIVER_LEN] = {0};
877 int degrees, minutes;
882 snprintf(
cmd, DRIVER_LEN,
":Sr%02d:%02d:%04.1f#", degrees, minutes, seconds);
887 return res[0] ==
'1';
895 char cmd[DRIVER_LEN] = {0};
896 char res[DRIVER_LEN] = {0};
897 int degrees, minutes;
902 snprintf(
cmd, DRIVER_LEN,
":Sd%c%02d*%02d:%04.1f#", de >= 0 ?
'+' :
'-', std::abs(degrees), minutes, seconds);
907 return res[0] ==
'1';
920 char RAStr[16], DEStr[16];
923 LOGF_DEBUG(
"Slewing to RA (%s) DE (%s)...", RAStr, DEStr);
936 char res[DRIVER_LEN] = {0};
941 return (
f_scansexa(res + 3, &m_CurrentAZ) == 0);
949 char res[DRIVER_LEN] = {0};
954 return (
f_scansexa(res + 3, &m_CurrentAL) == 0);
960bool Rainbow::setAZ(
double azimuth)
962 char cmd[DRIVER_LEN] = {0};
963 int degrees, minutes;
968 snprintf(
cmd, DRIVER_LEN,
":Sz%03d*%02d:%04.1f#", degrees, minutes, seconds);
976bool Rainbow::setAL(
double altitude)
978 char cmd[DRIVER_LEN] = {0};
979 int degrees, minutes;
984 snprintf(
cmd, DRIVER_LEN,
":Sa%c%02d*%02d:%04.1f#", degrees >= 0 ?
'+' :
'-',
std::abs(degrees), minutes, seconds);
992bool Rainbow::slewToHorizontalCoords(
double azimuth,
double altitude)
994 if (!setAZ(azimuth) || !setAL(altitude))
999 char AzStr[16], AltStr[16];
1000 fs_sexa(AzStr, azimuth, 2, 36000);
1001 fs_sexa(AltStr, altitude, 2, 36000);
1002 LOGF_DEBUG(
"Slewing to Az (%s) Alt (%s)...", AzStr, AltStr);
1020 LOG_ERROR(
"Error setting N/S motion direction.");
1030 LOG_ERROR(
"Error stopping N/S motion.");
1051 LOG_ERROR(
"Error setting W/E motion direction.");
1061 LOG_ERROR(
"Error stopping W/E motion.");
1114 char cmd[DRIVER_LEN] = {0};
1115 if (SaveAlignBeforeSyncS[STAR_ALIGNMENT_ENABLED].s ==
ISS_ON)
1117 snprintf(
cmd, DRIVER_LEN,
":CN%07.3f%c%06.3f#",
ra * 15.0,
dec >= 0 ?
'+' :
'-', std::fabs(
dec));
1121 snprintf(
cmd, DRIVER_LEN,
":Ck%07.3f%c%06.3f#",
ra * 15.0,
dec >= 0 ?
'+' :
'-', std::fabs(
dec));
1126 char RAStr[64] = {0}, DecStr[64] = {0};
1129 LOGF_INFO(
"Synced to RA %s DE %s%s", RAStr, DecStr,
1130 SaveAlignBeforeSyncS[STAR_ALIGNMENT_ENABLED].s ==
ISS_ON ?
", and saved as alignment point." :
"");
1179const std::string Rainbow::getSlewErrorString(uint8_t code)
1184 return "The altitude of the target is lower than lower limit.";
1186 return "The altitude of the target is higher than upper limit.";
1188 return "Slewing was canceled by user";
1190 return "RA Axis homing failed.";
1192 return "DE Axis homing failed.";
1195 return "Unknown error";
1237 char cmd[DRIVER_LEN] = {0};
1241 int* guideTID = &m_GuideNSTID;
1250 guideTID = &m_GuideNSTID;
1254 guideTID = &m_GuideNSTID;
1259 guideTID = &m_GuideWETID;
1263 guideTID = &m_GuideWETID;
1270 LOG_ERROR(
"Cannot guide while moving.");
1277 if (directionProperty.getState() ==
IPS_BUSY)
1297 LOG_INFO(
"Tracking mode switched to guide.");
1310 directionProperty[index].setState(
ISS_ON);
1311 snprintf(
cmd, DRIVER_LEN,
":M%c#", std::tolower(dc));
1362 char cmd[DRIVER_LEN] = {0};
1374 snprintf(
cmd, DRIVER_LEN,
":Q%c#", direction ==
North ?
'n' :
's');
1385 snprintf(
cmd, DRIVER_LEN,
":Q%c#", direction ==
East ?
'e' :
'w');
1389 LOGF_DEBUG(
"Guide %c finished",
"NSWE"[direction]);
1421 time_t now = time (
nullptr);
1422 strftime(timeString,
MAXINDINAME,
"%T", localtime(&now));
1427 char response[DRIVER_LEN] = {0};
1431 if (sscanf(response + 3,
"%d:%d:%d", &h, &m, &s) != 3)
1433 LOG_WARN(
"Failed to get time from device.");
1436 snprintf(timeString,
MAXINDINAME,
"%02d:%02d:%02d", h, m, s);
1449 time_t now = time (
nullptr);
1450 strftime(dateString,
MAXINDINAME,
"%F", localtime(&now));
1455 char response[DRIVER_LEN] = {0};
1456 char mell_prefix[3] = {0};
1460 if (sscanf(response + 3,
"%d%*c%d%*c%d", &mm, &dd, &yy) != 3)
1462 LOG_WARN(
"Failed to get date from device.");
1468 strncpy(mell_prefix,
"19", 3);
1470 strncpy(mell_prefix,
"20", 3);
1472 snprintf(dateString, 32,
"%s%02d-%02d-%02d", mell_prefix, yy, mm, dd);
1490 int rst135_utc_offset = 0;
1492 char response[DRIVER_LEN] = {0};
1496 if (sscanf(response + 3,
"%d", &rst135_utc_offset) != 1)
1498 LOG_WARN(
"Failed to get UTC offset from device.");
1503 *offset = rst135_utc_offset * -1;
1517 memset(<m, 0,
sizeof(ltm));
1518 memset(&utm, 0,
sizeof(utm));
1525 char utcStr[8] = {0};
1526 snprintf(utcStr, 8,
"%.2f", offset);
1531 LOG_WARN(
"Could not obtain UTC offset from mount!");
1537 LOG_WARN(
"Could not obtain local time from mount!");
1543 LOG_WARN(
"Could not obtain local date from mount!");
1549 snprintf(datetime,
MAXINDINAME,
"%sT%s", cdate, ctime);
1552 if (strptime(datetime,
"%FT%T", <m) ==
nullptr)
1554 LOGF_WARN(
"Could not process mount date and time: %s", datetime);
1560 time_epoch = mktime(<m);
1563 time_epoch -=
static_cast<int>(offset * 3600.0);
1566 localtime_r(&time_epoch, &utm);
1569 strftime(cdate,
MAXINDINAME,
"%Y-%m-%dT%H:%M:%S", &utm);
1587 double longitude {0}, latitude {0};
1588 double dd = 0, mm = 0, ssf = 0;
1589 char response[DRIVER_LEN] = {0};
1605 if (sscanf(response + 3,
"%lf%*[^0-9]%lf%*[^0-9]%lf", &dd, &mm, &ssf) != 3)
1607 LOG_WARN(
"Failed to get site latitude from device.");
1613 latitude = dd + mm / 60.0 + ssf / 3600.0;
1615 latitude = dd - mm / 60.0 - ssf / 3600.0;
1622 if (sscanf(response + 3,
"%lf%*[^0-9]%lf%*[^0-9]%lf", &dd, &mm, &ssf) != 3)
1624 LOG_WARN(
"Failed to get site longitude from device.");
1630 longitude = 360.0 - (dd + mm / 60.0 + ssf / 3600.0);
1632 longitude = (dd - mm / 60.0 - ssf / 3600.0) * -1.0;
1657 float decAxisAlignmentOffset {0}, decAxis {0};
1658 char cyResponse[DRIVER_LEN] = {0}, cg3Response[DRIVER_LEN] = {0};
1663 sscanf(cg3Response + 4,
"%f", &decAxisAlignmentOffset);
1668 char rotationAngle[16] = {0};
1670 snprintf(rotationAngle,
sizeof(rotationAngle),
"%.7s", cyResponse + 3);
1672 sscanf(rotationAngle,
"%f", &decAxis);
1674 auto offset = decAxis - decAxisAlignmentOffset;
1687 int nbytes_written = 0, nbytes_read = 0, rc = -1;
1689 tcflush(
PortFD, TCIOFLUSH);
1693 char hex_cmd[DRIVER_LEN * 3] = {0};
1702 char formatted_command[DRIVER_LEN] = {0};
1703 snprintf(formatted_command, DRIVER_LEN,
"%s\r",
cmd);
1711 LOGF_ERROR(
"Serial write error: %s.", errstr);
1719 rc =
tty_read(
PortFD, res, res_len, DRIVER_TIMEOUT, &nbytes_read);
1727 LOGF_ERROR(
"Serial read error: %s.", errstr);
1733 char hex_res[DRIVER_LEN * 3] = {0};
1734 hexDump(hex_res, res, res_len);
1740 res[nbytes_read - 1] = 0;
1744 tcflush(
PortFD, TCIOFLUSH);
1754 for (
int i = 0; i < size; i++)
1755 sprintf(buf + 3 * i,
"%02X ",
static_cast<uint8_t
>(data[i]));
1758 buf[3 * size - 1] =
'\0';
1764std::vector<std::string>
Rainbow::split(
const std::string &input,
const std::string ®ex)
1767 std::regex re(regex);
1768 std::sregex_token_iterator
1769 first{input.begin(), input.end(), re, -1},
1771 return {first, last};
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
INDI::PropertyText getText(const char *name) const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_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 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
uint32_t getDriverInterface() const
void addDebugControl()
Add Debug control to the driver.
INDI::PropertyNumber GuideNSNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
INDI::PropertyNumber GuideWENP
void initProperties(const char *groupName)
Initialize guider properties. It is recommended to call this function within initProperties() of your...
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
const char * getName() const
int findOnSwitchIndex() const
TelescopeStatus TrackState
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
void SetAxis1ParkDefault(double steps)
SetRAPark Set default RA/AZ parking position.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
double GetAxis1Park() const
double GetAxis2Park() const
virtual int AddTrackMode(const char *name, const char *label, bool isDefault=false)
AddTrackMode.
Connection::Serial * serialConnection
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_HAS_TRACK_MODE
@ TELESCOPE_CAN_CONTROL_TRACK
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
void setPierSide(TelescopePierSide side)
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
void SetAxis2Park(double steps)
SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData....
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void SetParkDataType(TelescopeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
virtual bool Sync(double ra, double dec) override
Sync.
virtual IPState GuideNorth(uint32_t ms) override
Guiding.
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Execute a homing action.
void guideTimeout(Direction direction)
Guide Timeout.
static void guideTimeoutHelperN(void *p)
Guide Timeout North.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool Goto(double ra, double dec) override
Slew RA/DE.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool SetSlewRate(int index) override
Set Slew Rate.
virtual IPState GuideEast(uint32_t ms) override
Guide East.
virtual bool SetTrackMode(uint8_t mode) override
Set Track Mode.
virtual IPState GuideWest(uint32_t ms) override
Guide West.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Abort.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Location & Time.
virtual bool SetTrackEnabled(bool enabled) override
Tracking Functions.
void getStartupStatus()
Query Functions.
void hexDump(char *buf, const char *data, int size)
bool getFirmwareVersion()
const char * getDefaultName() override
virtual bool Park() override
Parking & Homing.
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
bool sendScopeLocation()
Get Location from mount.
bool sendScopeTime()
Location & Time.
static void guideTimeoutHelperS(void *p)
Guide Timeout South.
bool getLocalDate(char *dateString)
Get Date from mount.
bool sendCommand(const char *cmd, char *res=nullptr, int cmd_len=-1, int res_len=-1)
Communication Functions.
IPState guide(Direction direction, uint32_t ms)
Guide universal function.
TelescopePierSide getSideOfPier()
Send Command.
static void guideTimeoutHelperW(void *p)
Guide Timeout West.
std::vector< std::string > split(const std::string &input, const std::string ®ex)
static void guideTimeoutHelperE(void *p)
Guide Timeout East.
virtual bool UnPark() override
Unparking.
bool setRA(double ra)
Set Target RA.
bool getLocalTime(char *timeString)
Get Time from mount.
void addGuideTimer(Direction direction, uint32_t ms)
Add guide timer.
bool getUTFOffset(double *offset)
GET UTC offset from mount.
bool setDE(double de)
Set Target Altitude.
virtual IPState GuideSouth(uint32_t ms) override
Guide South.
virtual bool Abort() override
Abort.
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
W/E Motion.
bool slewToEquatorialCoords(double ra, double de)
Slew to Equatorial Coordinates.
virtual bool isSlewComplete()
Motion Functions.
bool setGuideRate(double rate)
virtual bool ReadScopeStatus() override
Read telescope status.
Class to provide general functionality of a telescope device.
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.
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 AbortSP
INDI::PropertySwitch MovementNSSP
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch HomeSP
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertyText TimeTP
INDI::PropertySwitch MovementWESP
INDI::PropertyNumber LocationNP
void getSexComponentsIID(double value, int *d, int *m, double *s)
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_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
void getSexComponents(double value, int *d, int *m, int *s)
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.
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[].
int tty_nread_section(int fd, char *buf, int nsize, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Implementations for common driver routines.
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.
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,...)
#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,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.