Instrument Neutral Distributed Interface INDI 2.2.5
lx200classic.cpp
Go to the documentation of this file.
1/*
2 LX200 Classoc
3 Copyright (C) 2003 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21#include "lx200classic.h"
22#include "lx200driver.h"
23#include "indicom.h"
24
25#include <cstring>
26
27#include <libnova/transform.h>
28
29#define LIBRARY_TAB "Library"
30
37
39{
40 return "LX200 Classic";
41}
42
44{
47
48 IUFillText(&ObjectInfoT[0], "Info", "", "");
49 IUFillTextVector(&ObjectInfoTP, ObjectInfoT, 1, getDeviceName(), "Object Info", "", MAIN_CONTROL_TAB, IP_RO, 0,
50 IPS_IDLE);
51
52 IUFillSwitch(&StarCatalogS[0], "Star", "", ISS_ON);
53 IUFillSwitch(&StarCatalogS[1], "SAO", "", ISS_OFF);
54 IUFillSwitch(&StarCatalogS[2], "GCVS", "", ISS_OFF);
55 IUFillSwitchVector(&StarCatalogSP, StarCatalogS, 3, getDeviceName(), "Star Catalogs", "", LIBRARY_TAB, IP_RW,
57
58 IUFillSwitch(&DeepSkyCatalogS[0], "NGC", "", ISS_ON);
59 IUFillSwitch(&DeepSkyCatalogS[1], "IC", "", ISS_OFF);
60 IUFillSwitch(&DeepSkyCatalogS[2], "UGC", "", ISS_OFF);
61 IUFillSwitch(&DeepSkyCatalogS[3], "Caldwell", "", ISS_OFF);
62 IUFillSwitch(&DeepSkyCatalogS[4], "Arp", "", ISS_OFF);
63 IUFillSwitch(&DeepSkyCatalogS[5], "Abell", "", ISS_OFF);
64 IUFillSwitch(&DeepSkyCatalogS[6], "Messier", "", ISS_OFF);
65 IUFillSwitchVector(&DeepSkyCatalogSP, DeepSkyCatalogS, 7, getDeviceName(), "Deep Sky Catalogs", "", LIBRARY_TAB,
67
68 IUFillSwitch(&SolarS[0], "Select", "Select item", ISS_ON);
69 IUFillSwitch(&SolarS[1], "1", "Mercury", ISS_OFF);
70 IUFillSwitch(&SolarS[2], "2", "Venus", ISS_OFF);
71 IUFillSwitch(&SolarS[3], "3", "Moon", ISS_OFF);
72 IUFillSwitch(&SolarS[4], "4", "Mars", ISS_OFF);
73 IUFillSwitch(&SolarS[5], "5", "Jupiter", ISS_OFF);
74 IUFillSwitch(&SolarS[6], "6", "Saturn", ISS_OFF);
75 IUFillSwitch(&SolarS[7], "7", "Uranus", ISS_OFF);
76 IUFillSwitch(&SolarS[8], "8", "Neptune", ISS_OFF);
77 IUFillSwitch(&SolarS[9], "9", "Pluto", ISS_OFF);
78 IUFillSwitchVector(&SolarSP, SolarS, 10, getDeviceName(), "SOLAR_SYSTEM", "Solar System", LIBRARY_TAB, IP_RW,
80
81 IUFillNumber(&ObjectNoN[0], "ObjectN", "Number", "%+03f", 1.0, 1000.0, 1.0, 0);
82 IUFillNumberVector(&ObjectNoNP, ObjectNoN, 1, getDeviceName(), "Object Number", "", LIBRARY_TAB, IP_RW, 0,
83 IPS_IDLE);
84
85 IUFillNumber(&MaxSlewRateN[0], "RATE", "Rate", "%.2f", 2.0, 9.0, 1.0, 9.0);
86 IUFillNumberVector(&MaxSlewRateNP, MaxSlewRateN, 1, getDeviceName(), "TELESCOPE_MAX_SLEW_RATE", "Slew Rate", MOTION_TAB,
87 IP_RW, 0, IPS_IDLE);
88
89 IUFillNumber(&ElevationLimitN[0], "MIN_ALT", "Min Alt.", "%+.2f", -90.0, 90.0, 0.0, 0.0);
90 IUFillNumber(&ElevationLimitN[1], "MAX_ALT", "Max Alt", "%+.2f", -90.0, 90.0, 0.0, 0.0);
91 IUFillNumberVector(&ElevationLimitNP, ElevationLimitN, 2, getDeviceName(), "TELESCOPE_ELEVATION_SLEW_LIMIT",
92 "Slew elevation Limit", MAIN_CONTROL_TAB, IP_RW, 0, IPS_IDLE);
93
94 IUFillSwitch(&UnparkAlignmentS[0], "Polar", "", ISS_ON);
95 IUFillSwitch(&UnparkAlignmentS[1], "AltAz", "", ISS_OFF);
96 IUFillSwitch(&UnparkAlignmentS[2], "Land", "", ISS_OFF);
97 IUFillSwitchVector(&UnparkAlignmentSP, UnparkAlignmentS, 3, getDeviceName(), "Unpark Mode", "", SITE_TAB, IP_RW,
99
101
102 return true;
103}
104
106{
108
109 if (isConnected())
110 {
111 defineProperty(&ElevationLimitNP);
112 defineProperty(&ObjectInfoTP);
113 defineProperty(&SolarSP);
114 defineProperty(&StarCatalogSP);
115 defineProperty(&DeepSkyCatalogSP);
116 defineProperty(&ObjectNoNP);
117 defineProperty(&MaxSlewRateNP);
118 defineProperty(&UnparkAlignmentSP);
119
120 if (InitPark())
121 {
122 // If loading parking data is successful, we just set the default parking values.
123 // Default values are poinitng to North or South Pole in AltAz coordinates.
124 SetAxis1ParkDefault(LocationNP[LOCATION_LATITUDE].getValue() >= 0 ? 0 : 180);
126 }
127 else
128 {
129 // Otherwise, we set all parking data to default in case no parking data is found.
130 SetAxis1Park(LocationNP[LOCATION_LATITUDE].getValue() >= 0 ? 0 : 180);
132
133 SetAxis1ParkDefault(LocationNP[LOCATION_LATITUDE].getValue() >= 0 ? 0 : 180);
135 }
136
137 return true;
138 }
139 else
140 {
141 deleteProperty(ElevationLimitNP.name);
142 deleteProperty(ObjectInfoTP.name);
143 deleteProperty(SolarSP.name);
144 deleteProperty(StarCatalogSP.name);
145 deleteProperty(DeepSkyCatalogSP.name);
146 deleteProperty(ObjectNoNP.name);
147 deleteProperty(MaxSlewRateNP.name);
148 deleteProperty(UnparkAlignmentSP.name);
149
150 return true;
151 }
152}
153
154bool LX200Classic::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
155{
156 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
157 {
158 if (!strcmp(name, ObjectNoNP.name))
159 {
160 char object_name[256] = {0};
161
162 if (selectCatalogObject(PortFD, currentCatalog, (int)values[0]) < 0)
163 {
164 ObjectNoNP.s = IPS_ALERT;
165 IDSetNumber(&ObjectNoNP, "Failed to select catalog object.");
166 return false;
167 }
168
171
172 ObjectNoNP.s = IPS_OK;
173 IDSetNumber(&ObjectNoNP, "Object updated.");
174
175 if (getObjectInfo(PortFD, object_name) < 0)
176 IDMessage(getDeviceName(), "Getting object info failed.");
177 else
178 {
179 IUSaveText(&ObjectInfoTP.tp[0], object_name);
180 IDSetText(&ObjectInfoTP, nullptr);
181 }
182
184 return true;
185 }
186
187 if (!strcmp(name, MaxSlewRateNP.name))
188 {
189 if (setMaxSlewRate(PortFD, (int)values[0]) < 0)
190 {
191 MaxSlewRateNP.s = IPS_ALERT;
192 IDSetNumber(&MaxSlewRateNP, "Error setting maximum slew rate.");
193 return false;
194 }
195
196 MaxSlewRateNP.s = IPS_OK;
197 MaxSlewRateNP.np[0].value = values[0];
198 IDSetNumber(&MaxSlewRateNP, nullptr);
199 return true;
200 }
201
202 if (!strcmp(name, ElevationLimitNP.name))
203 {
204 // new elevation limits
205 double minAlt = 0, maxAlt = 0;
206 int i, nset;
207
208 for (nset = i = 0; i < n; i++)
209 {
210 INumber *altp = IUFindNumber(&ElevationLimitNP, names[i]);
211 if (altp == &ElevationLimitN[0])
212 {
213 minAlt = values[i];
214 nset += minAlt >= -90.0 && minAlt <= 90.0;
215 }
216 else if (altp == &ElevationLimitN[1])
217 {
218 maxAlt = values[i];
219 nset += maxAlt >= -90.0 && maxAlt <= 90.0;
220 }
221 }
222 if (nset == 2)
223 {
224 if (setMinElevationLimit(PortFD, (int)minAlt) < 0)
225 {
226 ElevationLimitNP.s = IPS_ALERT;
227 IDSetNumber(&ElevationLimitNP, "Error setting elevation limit.");
228 return false;
229 }
230
231 setMaxElevationLimit(PortFD, (int)maxAlt);
232 ElevationLimitNP.np[0].value = minAlt;
233 ElevationLimitNP.np[1].value = maxAlt;
234 ElevationLimitNP.s = IPS_OK;
235 IDSetNumber(&ElevationLimitNP, nullptr);
236 return true;
237 }
238 else
239 {
240 ElevationLimitNP.s = IPS_IDLE;
241 IDSetNumber(&ElevationLimitNP, "elevation limit missing or invalid.");
242 return false;
243 }
244 }
245 }
246
247 return LX200Generic::ISNewNumber(dev, name, values, names, n);
248}
249
250bool LX200Classic::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
251{
252 int index = 0;
253
254 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
255 {
256 // Star Catalog
257 if (!strcmp(name, StarCatalogSP.name))
258 {
259 IUResetSwitch(&StarCatalogSP);
260 IUUpdateSwitch(&StarCatalogSP, states, names, n);
261 index = IUFindOnSwitchIndex(&StarCatalogSP);
262
263 currentCatalog = LX200_STAR_C;
264
265 if (selectSubCatalog(PortFD, currentCatalog, index))
266 {
267 currentSubCatalog = index;
268 StarCatalogSP.s = IPS_OK;
269 IDSetSwitch(&StarCatalogSP, nullptr);
270 return true;
271 }
272 else
273 {
274 StarCatalogSP.s = IPS_IDLE;
275 IDSetSwitch(&StarCatalogSP, "Catalog unavailable.");
276 return false;
277 }
278 }
279
280 // Deep sky catalog
281 if (!strcmp(name, DeepSkyCatalogSP.name))
282 {
283 IUResetSwitch(&DeepSkyCatalogSP);
284 IUUpdateSwitch(&DeepSkyCatalogSP, states, names, n);
285 index = IUFindOnSwitchIndex(&DeepSkyCatalogSP);
286
287 if (index == LX200_MESSIER_C)
288 {
289 currentCatalog = index;
290 DeepSkyCatalogSP.s = IPS_OK;
291 IDSetSwitch(&DeepSkyCatalogSP, nullptr);
292 }
293 else
294 currentCatalog = LX200_DEEPSKY_C;
295
296 if (selectSubCatalog(PortFD, currentCatalog, index))
297 {
298 currentSubCatalog = index;
299 DeepSkyCatalogSP.s = IPS_OK;
300 IDSetSwitch(&DeepSkyCatalogSP, nullptr);
301 }
302 else
303 {
304 DeepSkyCatalogSP.s = IPS_IDLE;
305 IDSetSwitch(&DeepSkyCatalogSP, "Catalog unavailable");
306 return false;
307 }
308
309 return true;
310 }
311
312 // Solar system
313 if (!strcmp(name, SolarSP.name))
314 {
315 if (IUUpdateSwitch(&SolarSP, states, names, n) < 0)
316 return false;
317
318 index = IUFindOnSwitchIndex(&SolarSP);
319
320 // We ignore the first option : "Select item"
321 if (index == 0)
322 {
323 SolarSP.s = IPS_IDLE;
324 IDSetSwitch(&SolarSP, nullptr);
325 return true;
326 }
327
330
331 ObjectNoNP.s = IPS_OK;
332 SolarSP.s = IPS_OK;
333
334 getObjectInfo(PortFD, ObjectInfoTP.tp[0].text);
335 IDSetNumber(&ObjectNoNP, "Object updated.");
336 IDSetSwitch(&SolarSP, nullptr);
337
338 if (currentCatalog == LX200_STAR_C || currentCatalog == LX200_DEEPSKY_C)
339 selectSubCatalog(PortFD, currentCatalog, currentSubCatalog);
340
343
345
346 return true;
347 }
348
349 // Unpark Alignment Mode
350 if (!strcmp(name, UnparkAlignmentSP.name))
351 {
352 IUUpdateSwitch(&UnparkAlignmentSP, states, names, n);
353 UnparkAlignmentSP.s = IPS_OK;
354 IDSetSwitch(&UnparkAlignmentSP, nullptr);
355
356 return true;
357 }
358
359 }
360
361 return LX200Generic::ISNewSwitch(dev, name, states, names, n);
362}
363
365{
367
368 IUSaveConfigNumber(fp, &MaxSlewRateNP);
369 IUSaveConfigNumber(fp, &ElevationLimitNP);
370
371 IUSaveConfigSwitch(fp, &UnparkAlignmentSP);
372
373 return true;
374}
375
376//Parking
378{
379 double parkAz = GetAxis1Park();
380 double parkAlt = GetAxis2Park();
381
382 char AzStr[16], AltStr[16];
383 fs_sexa(AzStr, parkAz, 2, 3600);
384 fs_sexa(AltStr, parkAlt, 2, 3600);
385 LOGF_DEBUG("Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
386
387 INDI::IEquatorialCoordinates equatorialCoords {0, 0};
388 INDI::IHorizontalCoordinates horizontalCoords {parkAz, parkAlt};
389 INDI::HorizontalToEquatorial(&horizontalCoords, &m_Location, ln_get_julian_from_sys(), &equatorialCoords);
390
391 //save the current AlignmentMode to UnparkAlignment
393 int curAlignment = IUFindOnSwitchIndex(&AlignmentSP);
394 IUResetSwitch(&UnparkAlignmentSP);
395 UnparkAlignmentS[curAlignment].s = ISS_ON;
396 UnparkAlignmentSP.s = IPS_OK;
397 IDSetSwitch(&UnparkAlignmentSP, nullptr);
398 saveConfig(true, UnparkAlignmentSP.name);
399
400 if (!Goto(equatorialCoords.rightascension, equatorialCoords.declination))
401 {
402 ParkSP.setState(IPS_ALERT);
403 LOG_ERROR("Parking Failed.");
404 ParkSP.apply();
405 return false;
406 }
407
408 EqNP.setState(IPS_BUSY);
410 LOG_INFO("Parking is in progress...");
411
412 return true;
413}
414
416{
417 if (isSimulation() == false)
418 {
419 // Parked in Land alignment. Restore previous mode.
420 if (setAlignmentMode(PortFD, IUFindOnSwitchIndex(&UnparkAlignmentSP)) < 0)
421 {
422 LOG_ERROR("UnParking Failed.");
424 IDSetSwitch(&AlignmentSP, "Error setting alignment mode.");
425 return false;
426 }
427 //Update the UI
429 }
430
431 // Then we sync with to our last stored position
432 double parkAz = GetAxis1Park();
433 double parkAlt = GetAxis2Park();
434
435 char AzStr[16], AltStr[16];
436 fs_sexa(AzStr, parkAz, 2, 3600);
437 fs_sexa(AltStr, parkAlt, 2, 3600);
438 LOGF_DEBUG("Syncing to parked coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
439
440 double parkRA = 0.0;
441 double parkDEC = 0.0;
442 //azAltToRaDecNow(parkAz, parkAlt, parkRA, parkDEC);
443 INDI::IEquatorialCoordinates equatorialCoords {parkRA, parkDEC};
444 INDI::IHorizontalCoordinates horizontalCoords {parkAz, parkAlt};
445 INDI::HorizontalToEquatorial(&horizontalCoords, &m_Location, ln_get_julian_from_sys(), &equatorialCoords);
446
447 if (isSimulation())
448 {
449 currentRA = parkRA;
450 currentDEC = parkDEC;
451 }
452 else
453 {
454 if ((setObjectRA(PortFD, parkRA) < 0) || (setObjectDEC(PortFD, parkDEC) < 0))
455 {
456 LOG_ERROR("Error setting Unpark RA/Dec.");
457 return false;
458 }
459
460 char syncString[256];
461 if (::Sync(PortFD, syncString) < 0)
462 {
463 LOG_WARN("Unpark Sync failed.");
464 return false;
465 }
466 }
467
468 SetParked(false);
469 return true;
470}
471
473{
475 INDI::IHorizontalCoordinates horizontalCoords {0, 0};
476 INDI::EquatorialToHorizontal(&equatorialCoords, &m_Location, ln_get_julian_from_sys(), &horizontalCoords);
477
478 char AzStr[16], AltStr[16];
479 fs_sexa(AzStr, horizontalCoords.azimuth, 2, 3600);
480 fs_sexa(AltStr, horizontalCoords.altitude, 2, 3600);
481 LOGF_DEBUG("Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
482
483 SetAxis1Park(horizontalCoords.azimuth);
484 SetAxis2Park(horizontalCoords.altitude);
485
486 return true;
487}
488
490{
491 // Az = 0 for North hemisphere
492 SetAxis1Park(LocationNP[LOCATION_LATITUDE].getValue() > 0 ? 0 : 180);
493
494 // Alt = Latitude
496
497 return true;
498}
499
501{
502 int curTrackState = TrackState;
503 static int settling = -1;
504
505 if (settling >= 0) settling--;
506
507 if ((TrackState == SCOPE_PARKED) && (settling == 0) && !isSimulation())
508 {
509 settling = -1;
511 {
512 LOG_ERROR("Parking Failed.");
514 IDSetSwitch(&AlignmentSP, "Error setting alignment mode.");
515 return false;
516 }
517 //Update the UI
519 LOG_DEBUG("Mount Land mode set. Parking completed.");
520 }
521
523 {
524 if ((TrackState == SCOPE_PARKED) && (curTrackState == SCOPE_PARKING) && !isSimulation())
525 {
526 //allow scope to make internal state change to settled on target.
527 //otherwise changing to landmode slews the scope to same
528 //coordinates interpreted in landmode.
529 //Between isSlewComplete() and the beep there is nearly 3 seconds!
530 settling = 3; //n iterations of default 1000ms
531 }
532 }
533
534 return true;
535}
536
bool isConnected() 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 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
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.
double GetAxis1Park() const
double GetAxis2Park() const
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
IGeographicCoordinates m_Location
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....
void setMountType(TelescopeMountType type)
setMountType Report the mount type in TELESCOPE_MOUNT_TYPE. Drivers call it when the type is fixed by...
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 ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool Park() override
Park the telescope to its home position.
bool initProperties() override
Called to initialize basic properties required all the time.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
const char * getDefaultName() override
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
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 ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ISwitchVectorProperty AlignmentSP
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
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.
INDI::PropertySwitch ParkSP
INDI::PropertyNumber EqNP
INDI::PropertyNumber LocationNP
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
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[].
Definition indicom.c:130
Implementations for common driver routines.
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
Definition indidevapi.c:33
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.
Definition indidevapi.c:490
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
Definition indidevapi.c:337
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
Definition indidevapi.c:366
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.
Definition indidevapi.c:509
INumber * IUFindNumber(const INumberVectorProperty *nvp, const char *name)
Find an INumber member in a number text property.
Definition indidevapi.c:275
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition indidevapi.c:44
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition indidevapi.c:23
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.
Definition indidevapi.c:376
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.
Definition indidevapi.c:416
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.
Definition indidevapi.c:398
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.
Definition indidevapi.c:453
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,...)
void IDMessage(const char *dev, const char *fmt,...)
Definition indidriver.c:983
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
*brief user defined string literal for JSON values *sa std::size_t n
#define LOG_DEBUG(txt)
Definition indilogger.h:75
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition indilogger.h:72
#define LOG_INFO(txt)
Definition indilogger.h:74
#define getDeviceName
#define LIBRARY_TAB
int setAlignmentMode(int fd, unsigned int alignMode)
int setMinElevationLimit(int fd, int min)
int setMaxSlewRate(int fd, int slewRate)
int setMaxElevationLimit(int fd, int max)
int setObjectRA(int fd, double ra, bool addSpace)
int selectSubCatalog(int fd, int catalog, int subCatalog)
int setObjectDEC(int fd, double dec, bool addSpace)
int selectCatalogObject(int fd, int catalog, int NNNN)
#define getObjectDEC(fd, x)
@ LX200_ALIGN_LAND
Definition lx200driver.h:36
#define getObjectInfo(fd, x)
#define getLX200DEC(fd, x)
@ LX200_DEEPSKY_C
Definition lx200driver.h:84
@ LX200_STAR_C
Definition lx200driver.h:83
#define getLX200RA(fd, x)
@ LX200_MESSIER_C
#define getObjectRA(fd, x)
@ LX200_STAR
Definition lx200driver.h:89
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.
Definition libastro.cpp:141
void HorizontalToEquatorial(IHorizontalCoordinates *object, IGeographicCoordinates *observer, double JD, IEquatorialCoordinates *position)
HorizontalToEquatorial Calculate Equatorial EOD Coordinates from horizontal coordinates.
Definition libastro.cpp:161
One number descriptor.