3 Copyright (C) 2003 - 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
5 This library is free software;
6 you can redistribute it and / or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation;
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT
ANY WARRANTY;
14 without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License
for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with
this library;
20 if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
23 Version with experimental pulse guide support. GC 04.12.2015
31 #include <libnova/transform.h>
48 #define FINE_SLEW_RATE 0.1
49 #define GOTO_LIMIT 5.5
51 #define FINE_SLEW_LIMIT 0.5
53 #define MOUNTINFO_TAB "Mount Info"
55 static std::unique_ptr<CelestronGPS> telescope(
new CelestronGPS());
85 bool CelestronGPS::checkMinVersion(
double minVersion,
const char *feature,
bool debug)
93 LOGF_DEBUG(
"Firmware v%3.2f does not support %s. Minimum required version is %3.2f",
96 LOGF_WARN(
"Firmware v%3.2f does not support %s. Minimum required version is %3.2f",
106 return "Celestron GPS";
195 IUFillSwitchVector(&DSTSettingSP, DSTSettingS, 1,
getDeviceName(),
"DST_STATE",
"DST",
SITE_TAB,
IP_RW,
ISR_NOFMANY, 60,
233 IUFillNumber(&FocusMinPosN[0],
"FOCUS_MIN_VALUE",
"Steps",
"%.f", 0, 40000., 1., 0.);
242 static bool configLoaded =
false;
251 if (configLoaded ==
false)
271 canAuxGuide = (atof(fwInfo.
RAFirmware.c_str()) >= 6.12 && atof(fwInfo.
DEFirmware.c_str()) >= 6.12);
275 usePreciseCoords = (checkMinVersion(2.2,
"usePreciseCoords"));
282 LOG_WARN(
"Failed to retrieve firmware information.");
288 if (checkMinVersion(2.3,
"park"))
291 if (checkMinVersion(4.1,
"sync"))
294 if (checkMinVersion(2.3,
"updating time and location settings"))
302 if (checkMinVersion(2.3,
"track on/off"))
305 LOG_WARN(
"Mount firmware does not support track on off.");
307 if (fwInfo.
isGem && checkMinVersion(4.15,
"Pier Side",
true))
310 LOG_WARN(
"Mount firmware does not support getting pier side.");
314 if (checkMinVersion(2.3,
"track mode"))
355 LOG_WARN(
"Mount firmware does not support track mode.");
362 if (fwInfo.
Version !=
"Invalid")
413 LOG_DEBUG(
"Unable to get guide rates from mount.");
418 LOG_INFO(
"Mount supports guiding.");
421 LOG_INFO(
"Mount does not support guiding. Tracking mode must be set in handset to either EQ-North or EQ-South.");
429 if (checkMinVersion(2.3,
"date and time setting"))
432 int yy, dd, mm, hh, minute, ss;
436 if (driver.
get_utc_date_time(&utc_offset, &yy, &mm, &dd, &hh, &minute, &ss, &dst, precise))
438 char isoDateTime[32];
441 snprintf(isoDateTime, 32,
"%04d-%02d-%02dT%02d:%02d:%02d", yy, mm, dd, hh, minute, ss);
442 snprintf(utcOffset, 8,
"%4.2f", utc_offset);
450 LOGF_INFO(
"Mount UTC offset: %s. UTC time: %s. DST: %s", utcOffset, isoDateTime, dst ?
"On" :
"Off");
457 double longitude, latitude;
464 LOGF_DEBUG(
"Mount latitude %8.4f longitude %8.4f", latitude, longitude);
468 LOG_WARN(
"Mount does not support retrieval of date, time and location.");
496 if (focusReadLimits())
507 LOG_INFO(
"Auxiliary focuser is connected.");
509 if (!focuserIsCalibrated)
511 LOG_WARN(
"Focuser not calibrated, moves will not be allowed");
538 if (fwInfo.
Version !=
"Invalid")
557 if (driver.
slew_radec(targetRA + SlewOffsetRa, targetDEC, usePreciseCoords) ==
false)
559 LOG_ERROR(
"Failed to slew telescope in RA/DEC.");
565 char RAStr[32], DecStr[32];
566 fs_sexa(RAStr, targetRA, 2, 3600);
567 fs_sexa(DecStr, targetDEC, 2, 3600);
568 LOGF_INFO(
"Slewing to JNOW RA %s - DEC %s SlewOffsetRa %4.1f arcsec", RAStr, DecStr, SlewOffsetRa * 3600 * 15);
575 if (!checkMinVersion(4.1,
"sync"))
578 if (driver.
sync(
ra,
dec, usePreciseCoords) ==
false)
587 char RAStr[32], DecStr[32];
588 fs_sexa(RAStr, targetRA, 2, 3600);
589 fs_sexa(DecStr, targetDEC, 2, 3600);
590 LOGF_INFO(
"Sync to %s, %s successful.", RAStr, DecStr);
660 LOG_ERROR(
"Error setting N/S motion direction.");
691 LOG_ERROR(
"Error setting W/E motion direction.");
719 if (driver.
get_radec(¤tRA, ¤tDEC, usePreciseCoords) ==
false)
721 LOG_ERROR(
"Failed to read RA/DEC values.");
758 if (currentDEC > 89.999 || currentDEC < -89.999)
765 LOGF_DEBUG(
"latitude %g, sop %c, PierSide %c",
790 LOG_WARN(
"This mount does not have index switches, the alignment assumes it is at the index position.");
826 LOG_INFO(
"Slew complete, tracking...");
829 double raoffset = targetRA - currentRA + SlewOffsetRa;
830 if (raoffset > 0.0 || raoffset < 10.0 / 3600.0)
833 SlewOffsetRa = SlewOffsetRa > 0 ? (SlewOffsetRa + raoffset) / 2 : raoffset;
835 LOGF_DEBUG(
"raoffset %4.1f, SlewOffsetRa %4.1f arcsec", raoffset * 3600 * 15, SlewOffsetRa * 3600 * 15);
855 LOG_INFO(
"Mount hibernated. Please disconnect now and turn off your mount.");
876 static size_t lastPecIndex = 1000;
877 static size_t numRecordPoints;
886 size_t pecIndex = driver.
pecIndex();
888 if (pecIndex != lastPecIndex)
893 lastPecIndex = pecIndex;
914 switch (lastPecState)
921 LOG_INFO(
"PEC index Seek completed.");
932 LOGF_DEBUG(
"PEC record stopped, %d records", numRecordPoints);
934 if (numRecordPoints >= numPecBins)
975 if (focusBacklashMove)
977 focusBacklashMove =
false;
979 LOGF_INFO(
"Focus final move %i", focusPosition);
989 LOG_INFO(
"Focuser reached requested position.");
1031 return driver.
abort();
1049 LOG_ERROR(
"Failed to communicate with the mount, check the logs for details.");
1066 if (
UseHibernateS[0].s ==
ISS_ON && (checkMinVersion(4.22,
"hibernation",
true) ==
false))
1087 if (name && std::string(name) == LastAlignSP.
name)
1092 LOG_WARN(
"This mount does not have index switches, make sure that it is at the index position.");
1118 LOG_DEBUG(
" stop PEC record or playback");
1133 LOG_WARN(
"Incorrect state to stop PEC Playback or Record");
1156 LOG_WARN(
"Incorrect state to start PEC Playback");
1161 if (
TrackState != TelescopeStatus::SCOPE_TRACKING)
1163 LOG_WARN(
"Mount must be Tracking to record PEC");
1181 LOG_WARN(
"Incorrect state to start PEC Recording");
1188 LOG_INFO(
"PEC index already found");
1197 LOG_INFO(
"Seek PEC index started");
1212 if (strstr(name,
"FOCUS"))
1226 if (strcmp(name,
"GUIDE_RATE") == 0)
1238 LOG_WARN(
"Changing guide rates may require recalibration of guiding.");
1245 if (strstr(name,
"FOCUS_"))
1260 LOGF_DEBUG(
"ISNewText name %s, text %s, names %s, n %d", name, texts[0], names[0], n);
1262 if (name && std::string(name) ==
"PEC_LOAD")
1279 if (!pecData.
Save(&driver))
1302 static struct timeval ltv;
1304 double dt, dx, da_ra = 0, da_dec = 0;
1308 gettimeofday(&tv,
nullptr);
1310 if (ltv.tv_sec == 0 && ltv.tv_usec == 0)
1313 dt = tv.tv_sec - ltv.tv_sec + (tv.tv_usec - ltv.tv_usec) / 1e6;
1410 if (fabs(dx) <= da_ra)
1426 if (fabs(dx) <= da_dec)
1465 LOG_DEBUG(
"updateLocation called before we are connected");
1469 if (!checkMinVersion(2.3,
"updating location"))
1475 LOG_INFO(
"Update location - check_aligned failed");
1481 LOG_INFO(
"Updating location is not necessary since mount is already aligned.");
1485 LOGF_DEBUG(
"Update location %8.3f, %8.3f, %4.0f", latitude, longitude, elevation);
1494 LOG_DEBUG(
"updateTime called before we are connected");
1498 if (!checkMinVersion(2.3,
"updating time"))
1505 LOG_INFO(
"UpdateTime - check_aligned failed");
1510 LOG_INFO(
"Updating time is not necessary since mount is already aligned.");
1517 bool dst = DSTSettingS[0].s ==
ISS_ON;
1519 LOGF_DEBUG(
"Update time: offset %f %s UTC %i-%02i-%02iT%02i:%02i:%02.0f", utc_offset, dst ?
"DST" :
"", utc->years,
1520 utc->months, utc->days,
1521 utc->hours, utc->minutes, utc->seconds);
1523 return (driver.
set_datetime(utc, utc_offset, dst, precise));
1531 char AzStr[16], AltStr[16];
1532 fs_sexa(AzStr, parkAZ, 2, 3600);
1533 fs_sexa(AltStr, parkAlt, 2, 3600);
1539 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1541 if (driver.
slew_azalt(parkAZ, parkAlt, usePreciseCoords))
1544 LOG_INFO(
"Parking is in progress...");
1564 LOG_ERROR(
"Waking up mount failed! Make sure mount is powered and connected. "
1565 "Hibernate requires firmware version >= 5.21");
1596 if (driver.
get_azalt(¤tAZ, ¤tALT, usePreciseCoords) ==
false)
1598 LOG_ERROR(
"Failed to read AZ/ALT values.");
1602 double parkAZ = currentAZ;
1603 double parkAlt = currentALT;
1605 char AzStr[16], AltStr[16];
1606 fs_sexa(AzStr, parkAZ, 2, 3600);
1607 fs_sexa(AltStr, parkAlt, 2, 3600);
1609 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr,
1745 LOGF_DEBUG(
"GUIDE CMD: %c %u ms, %s guide", dc, ms, canAuxGuide ?
"Aux" :
"Time");
1749 LOG_ERROR(
"Cannot guide while moving.");
1780 ms = ms > 2550 ? 2550 : ms;
1852 LOGF_DEBUG(
"guideTimer dir %c, ticks %i, rate %i",
"NSWE"[dirn], *ticks, rate);
1865 int dt = (*ticks > 255) ? 255 : *ticks;
1866 driver.
send_pulse(dirn, rate,
static_cast<uint8_t
>(dt));
1876 LOGF_ERROR(
"StopMotion failed dir %c",
"NSWE"[dirn]);
1902 LOGF_DEBUG(
"Guide %c finished",
"NSWE"[dirn]);
1966 void CelestronGPS::checkAlignment()
1972 LOG_WARN(
"Mount is NOT aligned. You must align the mount first before you can use it. Disconnect, align the mount, and reconnect again.");
1975 bool CelestronGPS::savePecData()
1980 char ts_date[32], ts_time[32];
1986 strftime(ts_date,
sizeof(ts_date),
"%Y-%m-%d", tp);
1987 strftime(ts_time,
sizeof(ts_time),
"%H:%M", tp);
1990 snprintf(dir,
MAXRBUF,
"%s/PEC_Data/%s", getenv(
"HOME"), ts_date);
1999 snprintf(pecFileBuf,
MAXRBUF,
"%s/pecData_%s.csv", dir, ts_time);
2008 if (!pecdata.
Load(&driver))
2010 LOG_DEBUG(
"Load PEC from mount failed");
2015 if (!pecdata.
Save(pecFileBuf))
2017 LOGF_DEBUG(
"Save PEC file %s failed", pecFileBuf);
2020 LOGF_INFO(
"PEC data saved to %s", pecFileBuf);
2027 uint32_t position = targetTicks;
2029 if (!focuserIsCalibrated)
2031 LOG_ERROR(
"Move is not allowed because the focuser is not calibrated");
2036 int delta =
static_cast<int>(targetTicks -
FocusAbsPosN[0].value);
2041 focusBacklashMove =
true;
2042 focusPosition = position;
2046 LOGF_INFO(
"Focus %s move %d", focusBacklashMove ?
"backlash" :
"direct", position);
2056 uint32_t newPosition = 0;
2059 newPosition =
static_cast<uint32_t
>(
FocusAbsPosN[0].value) - ticks;
2061 newPosition =
static_cast<uint32_t
>(
FocusAbsPosN[0].value) + ticks;
2074 bool CelestronGPS::focusReadLimits()
2088 FocusMinPosN[0].value = low;
2092 focuserIsCalibrated = valid;
2094 LOGF_INFO(
"Focus Limits: Maximum (%i) Minimum (%i) steps.", high, low);
@ PEC_SEEKING
The PEC index is being searched for, goes to PEC_INDEXED when found
@ PEC_AVAILABLE
PEC is available but inactive, can seek index Seek index is only available command
@ PEC_PLAYBACK
PEC is being played back, stays in this state until stopped equivalent to TelescopePECState PEC_ON
@ PEC_RECORDING
PEC is being recorded, goes to PEC_INDEXED when completed
@ PEC_INDEXED
the PEC index has been found, can go to Playback or Recording this is equivalent to TelescopePECState...
bool slew_radec(double ra, double dec, bool precise)
bool get_azalt(double *az, double *alt, bool precise)
bool set_guide_rate(CELESTRON_AXIS axis, uint8_t rate)
void set_port_fd(int port_fd)
bool indexreached(bool *atIndex)
bool check_aligned(bool *isAligned)
bool set_datetime(struct ln_date *utc, double utc_offset, bool dst=false, bool precise=false)
bool set_location(double longitude, double latitude)
bool stop_motion(CELESTRON_DIRECTION dir)
const char * PecStateStr(PEC_STATE)
void set_sim_track_mode(CELESTRON_TRACK_MODE val)
bool get_firmware(FirmwareInfo *info)
bool sync(double ra, double dec, bool precise)
bool foc_limits(int *low, int *high)
bool PecPlayback(bool start)
size_t send_pulse(CELESTRON_DIRECTION direction, unsigned char rate, unsigned char duration_msec)
bool get_radec(double *ra, double *dec, bool precise)
bool get_track_mode(CELESTRON_TRACK_MODE *mode)
void set_device(const char *name)
void set_simulation(bool enable)
bool set_track_rate(CELESTRON_TRACK_RATE rate, CELESTRON_TRACK_MODE mode)
bool set_track_mode(CELESTRON_TRACK_MODE mode)
bool PecRecord(bool start)
bool isPecAtIndex(bool force=false)
bool get_location(double *longitude, double *latitude)
void set_sim_ra(double ra)
bool get_pulse_status(CELESTRON_DIRECTION direction)
void set_sim_slewing(bool isSlewing)
PEC_STATE updatePecState()
bool get_guide_rate(CELESTRON_AXIS axis, uint8_t *rate)
void set_sim_dec(double dec)
bool slew_azalt(double az, double alt, bool precise)
void set_sim_slew_rate(CELESTRON_SLEW_RATE val)
bool foc_move(uint32_t steps)
bool get_pier_side(char *sop)
bool is_slewing(bool *slewing)
bool get_utc_date_time(double *utc_hours, int *yy, int *mm, int *dd, int *hh, int *minute, int *ss, bool *dst, bool precise)
bool start_motion(CELESTRON_DIRECTION dir, CELESTRON_SLEW_RATE rate)
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
ITextVectorProperty PecFileNameTP
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ISwitchVectorProperty PecControlSP
static void guideTimerHelperE(void *p)
static void guideTimerHelperS(void *p)
virtual bool UnPark() override
Unpark the telescope if already parked.
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.
ITextVectorProperty FirmwareTP
void guideTimer(CELESTRON_DIRECTION dirn)
static void guideTimerHelperW(void *p)
IPState Guide(CELESTRON_DIRECTION dirn, uint32_t ms)
void AddGuideTimer(CELESTRON_DIRECTION dirn, int ms)
bool AbortFocuser() override
AbortFocuser all focus motion.
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
INumberVectorProperty GuideRateNP
virtual const char * getDefaultName() override
ITextVectorProperty PecInfoTP
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool Park() override
Park the telescope to its home position.
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
ISwitchVectorProperty CelestronTrackModeSP
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
ISwitchVectorProperty UseHibernateSP
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
static void guideTimerHelperN(void *p)
ISwitch CelestronTrackModeS[4]
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
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...
Class to provide general functionality of a GPS device.
const char * getDeviceName() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
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
void syncDriverInfo()
syncDriverInfo sends the current driver information to the client.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
uint16_t getDriverInterface() const
Provides interface to implement focuser functionality.
INumberVectorProperty FocusAbsPosNP
INumberVectorProperty FocusRelPosNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
INumber FocusBacklashN[1]
void initProperties(const char *groupName)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
INumberVectorProperty FocusMaxPosNP
INumberVectorProperty GuideNSNP
void initGuiderProperties(const char *deviceName, const char *groupName)
Initilize guider properties. It is recommended to call this function within initProperties() of your ...
INumberVectorProperty GuideWENP
void processGuiderProperties(const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
TelescopeStatus TrackState
ISwitchVectorProperty TrackStateSP
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
TelescopePierSide currentPierSide
ISwitchVectorProperty MovementNSSP
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.
INumberVectorProperty LocationNP
virtual bool initProperties() override
Called to initialize basic properties required all the time.
ITextVectorProperty TimeTP
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
double GetAxis1Park() const
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...
double GetAxis2Park() const
bool isParked()
isParked is mount currently parked?
virtual int AddTrackMode(const char *name, const char *label, bool isDefault=false)
AddTrackMode.
ISwitchVectorProperty SlewRateSP
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....
INumberVectorProperty EqNP
const char * LoadParkData()
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...
ISwitchVectorProperty MovementWESP
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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.
bool Load(CelestronDriver *driver)
bool Save(const char *filename)
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.
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
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.
double range24(double r)
range24 Limits a number to be between 0-24 range.
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.
#define TRACKRATE_SIDEREAL
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
ISwitch * IUFindOnSwitch(const ISwitchVectorProperty *svp)
Returns the first ON switch it finds in the vector switch property.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
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.
IText * IUFindText(const ITextVectorProperty *tvp, const char *name)
Find an IText member in a vector text property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
void IUUpdateMinMax(const INumberVectorProperty *nvp)
Function to update the min and max elements of a number in the client.
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,...)
int mkpath(std::string s, mode_t mode)
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
CELESTRON_TRACK_MODE celestronTrackMode
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
int addDebugLevel(const char *debugLevelName, const char *LoggingLevelName)
Adds a new debugging level to the driver.
Switch vector property descriptor.