Instrument Neutral Distributed Interface INDI
1.9.5
|
Go to the documentation of this file.
29 #include <libnova/transform.h>
35 const int LX200SS2000PC::ShortTimeOut = 2;
36 const int LX200SS2000PC::LongTimeOut = 10;
56 IUFillNumber(&SlewAccuracyN[0],
"SlewRA",
"RA (arcmin)",
"%10.6m", 0., 60., 1., 3.0);
57 IUFillNumber(&SlewAccuracyN[1],
"SlewDEC",
"Dec (arcmin)",
"%10.6m", 0., 60., 1., 3.0);
86 if (!strcmp(
name, SlewAccuracyNP.
name))
93 if (SlewAccuracyN[0].value < 3 || SlewAccuracyN[1].value < 3)
94 IDSetNumber(&SlewAccuracyNP,
"Warning: Setting the slew accuracy too low may result in a dead lock");
115 return const_cast<const char *
>(
"SkySensor2000PC");
128 struct ln_zonedate ltm;
129 ln_date_to_zonedate(utc, <m,
static_cast<long>(utc_offset * 3600.0 + 0.5));
130 LOGF_DEBUG(
"New zonetime is %04d-%02d-%02d %02d:%02d:%06.3f (offset=%ld)", ltm.years,
131 ltm.months, ltm.days, ltm.hours, ltm.minutes, ltm.seconds, ltm.gmtoff);
132 JD = ln_get_julian_day(utc);
134 if (
setLocalTime(
PortFD, ltm.hours, ltm.minutes,
static_cast<int>(ltm.seconds + 0.5)) < 0)
169 return fabs(dx) <= (SlewAccuracyN[0].value / (900.0)) && fabs(dy) <= (SlewAccuracyN[1].value / 60.0);
172 bool LX200SS2000PC::getCalendarDate(
int &year,
int &month,
int &day)
176 LOGF_DEBUG(
"LX200SS2000PC::getCalendarDate():: Date string from telescope: %s", date);
179 result = (sscanf(date,
"%d%*c%d%*c%d", &month, &day, &year) == 3);
180 LOGF_DEBUG(
"setCalenderDate: Date retrieved from telescope: %02d/%02d/%02d.", month, day,
190 bool LX200SS2000PC::setCalenderDate(
int year,
int month,
int day)
198 int ss_year = 0, ss_month = 0, ss_day = 0;
199 const bool send_to_skysensor =
200 (!
getCalendarDate(ss_year, ss_month, ss_day) || year != ss_year || month != ss_month || day != ss_day);
201 LOGF_DEBUG(
"LX200SS2000PC::setCalenderDate(): Driver date %02d/%02d/%02d, SS2000PC date %02d/%02d/%02d.", month, day,
202 year, ss_month, ss_day, ss_year);
203 if (send_to_skysensor)
206 int nbytes_written = 0;
208 snprintf(
buffer,
sizeof(
buffer),
":SC %02d/%02d/%02d#", month, day, (year % 100));
214 && nbytes_read == 1 &&
219 strncmp(
buffer,
"Updating planetary data#", 24) != 0)
222 "LX200SS2000PC::setCalenderDate(): Received unexpected first line '%s'.",
buffer);
226 strncmp(
buffer,
" #", 24) != 0)
229 "LX200SS2000PC::setCalenderDate(): Received unexpected second line '%s'.",
buffer);
242 const bool send_to_skysensor = (
getUTCOffset(
PortFD, &ss_timezone) != 0 || offset != ss_timezone);
243 if (send_to_skysensor)
246 snprintf(temp_string,
sizeof(temp_string),
":SG %+03d#",
static_cast<int>(offset));
259 if (latitude == 0.0 && longitude == 0.0)
264 LOG_ERROR(
"Error setting site latitude coordinates");
269 LOG_ERROR(
"Error setting site longitude coordinates");
274 fs_sexa(slat, latitude, 3, 3600);
275 fs_sexa(slong, longitude, 4, 3600);
277 LOGF_INFO(
"Site location updated to Latitude: %.32s - Longitude: %.32s", slat, slong);
285 int LX200SS2000PC::setSiteLatitude(
int fd,
double Lat)
298 snprintf(temp_string,
sizeof(temp_string),
":St %c%03d*%02d#", sign, d, m);
306 int LX200SS2000PC::setSiteLongitude(
int fd,
double Long)
313 snprintf(temp_string,
sizeof(temp_string),
":Sg %03d*%02d#", d, m);
323 char AzStr[16], AltStr[16];
324 fs_sexa(AzStr, parkAz, 2, 3600);
325 fs_sexa(AltStr, parkAlt, 2, 3600);
326 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
334 Goto(equatorialCoords.rightascension, equatorialCoords.declination);
349 LOGF_ERROR(
"Error Slewing to Az %s - Alt %s", AzStr, AltStr);
357 LOG_INFO(
"Parking is in progress...");
378 char AzStr[16], AltStr[16];
379 fs_sexa(AzStr, parkAz, 2, 3600);
380 fs_sexa(AltStr, parkAlt, 2, 3600);
381 LOGF_DEBUG(
"Syncing to parked coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
388 currentRA = equatorialCoords.rightascension;
399 char syncString[256];
416 double parkAZ = horizontalCoords.azimuth;
417 double parkAlt = horizontalCoords.altitude;
419 char AzStr[16], AltStr[16];
420 fs_sexa(AzStr, parkAZ, 2, 3600);
421 fs_sexa(AltStr, parkAlt, 2, 3600);
423 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
467 LOG_INFO(
"Slew is complete. Tracking...");
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
#define getUTCOffset(fd, x)
int setSiteLatitude(int fd, double Lat)
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
int setObjAz(int fd, double az)
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
#define LOGF_ERROR(fmt,...)
Implementations for common driver routines.
#define NARRAY(a)
Handy macro to find the number of elements in array a[]. Must be used with actual array,...
void getSexComponents(double value, int *d, int *m, int *s)
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
bool isSimulation() const
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 defineProperty(INumberVectorProperty *property)
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
virtual bool isSlewComplete(void) override
virtual const char * getDefaultName(void) override
double GetAxis1Park() const
virtual bool Park() override
Park the telescope to its home position.
void SetAxis2Park(double steps)
SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData....
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
#define getLX200DEC(fd, x)
const char * getDeviceName() const
int getCalendarDate(int fd, char *date)
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
INumberVectorProperty EqNP
IGeographicCoordinates m_Location
virtual bool sendScopeLocation()
virtual bool setUTCOffset(double offset) override
int setObjAlt(int fd, double alt)
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
TelescopeStatus TrackState
virtual bool sendScopeTime()
int setSiteLongitude(int fd, double CartographicLongitude)
virtual bool ReadScopeStatus() override
Read telescope status.
#define LOGF_DEBUG(fmt,...)
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual void slewError(int slewCode)
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
#define setLocalTime(fd, x, y, z)
virtual bool initProperties() override
Called to initialize basic properties required all the time.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount=0)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.
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.
virtual void getBasicData(void) override
virtual bool initProperties() override
Called to initialize basic properties required all the time.
int setStandardProcedure(int fd, const char *writeData)
#define getLX200RA(fd, x)
@ LX200_HAS_PULSE_GUIDING
virtual bool UnPark() override
Unpark the telescope if already parked.
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
void HorizontalToEquatorial(IHorizontalCoordinates *object, IGeographicCoordinates *observer, double JD, IEquatorialCoordinates *position)
HorizontalToEquatorial Calculate Equatorial EOD Coordinates from horizontal coordinates.
#define LOGF_INFO(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
void SetParkDataType(TelescopeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
int setCalenderDate(int fd, int dd, int mm, int yy)
void setLX200Capability(uint32_t cap)
int setAlignmentMode(int fd, unsigned int alignMode)
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
ISwitchVectorProperty SlewRateSP
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
int fs_sexa(char *out, double a, int w, int fracbase)
Converts a sexagesimal number to a string.
int getCommandString(int fd, char *data, const char *cmd)
int checkLX200EquatorialFormat(int fd)
double GetAxis2Park() const
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
void void void IDSetNumber(const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing number vector property.
void void void void void IDSetSwitch(const ISwitchVectorProperty *s, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing switch vector property.
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.
std::vector< uint8_t > buffer