Instrument Neutral Distributed Interface INDI 2.2.5
toup_sh20.cpp
Go to the documentation of this file.
1#include "toup_sh20.h"
3#include "lx200driver.h"
4#include "indicom.h"
5
6#include <libnova/transform.h>
7#include <cmath>
8#include <cstring>
9#include <stdio.h>
10#include <termios.h>
11#include <unistd.h>
12
33
35{
37
40
41 // The last known mount type decides the pier side capability before connecting.
42 if (!MountTypeSP.load())
43 {
44 // Older configurations stored it in MOUNT_TYPE (0 = Alt-Az, 1 = Equatorial).
45 int legacyType = 1;
46 if (IUGetConfigOnSwitchIndex(getDeviceName(), "MOUNT_TYPE", &legacyType) == 0 && legacyType == 0)
48 }
51
52 // Slew Rates
53 SlewRateSP[0].setLabel("0.25x");
54 SlewRateSP[1].setLabel("0.5x");
55 SlewRateSP[2].setLabel("1x");
56 SlewRateSP[3].setLabel("2x");
57 SlewRateSP[4].setLabel("4x");
58 SlewRateSP[5].setLabel("8x");
59 SlewRateSP[6].setLabel("20x");
60 SlewRateSP[7].setLabel("60x");
61 SlewRateSP[8].setLabel("720x");
62 SlewRateSP[9].setLabel("1440x");
63 SlewRateSP.reset();
64 SlewRateSP[9].setState(ISS_ON);
65
66 // Guide Rate
67 GuideRateNP[0].fill("RATE", "Rate", "%.2f", 0.1, 0.9, 0.1, 0.5);
68 GuideRateNP.fill(getDeviceName(), "GUIDE_RATE", "Guiding Rate", MOTION_TAB, IP_RW, 60, IPS_IDLE);
69 GuideRateNP.load();
70
71 // Buzzer
72 BuzzerSP[BUZZER_OFF].fill("OFF", "Off", ISS_OFF);
73 BuzzerSP[BUZZER_LOW].fill("LOW", "Low", ISS_OFF);
74 BuzzerSP[BUZZER_HIGH].fill("HIGH", "High", ISS_ON);
75 BuzzerSP.fill(getDeviceName(), "BUZZER", "Buzzer", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
76 BuzzerSP.onUpdate([this]
77 {
78 if (setBuzzer(BuzzerSP.findOnSwitchIndex()))
79 {
80 BuzzerSP.setState(IPState::IPS_OK);
81 }
82 else
83 {
84 BuzzerSP.setState(IPState::IPS_ALERT);
85 }
86 BuzzerSP.apply();
87 });
88
89 // Meridian Flip Enable
90 MeridianFlipSP[INDI_ENABLED].fill("INDI_ENABLED", "Enabled", ISS_ON);
91 MeridianFlipSP[INDI_DISABLED].fill("INDI_DISABLED", "Disabled", ISS_OFF);
92 MeridianFlipSP.fill(getDeviceName(), "MERIDIAN_FLIP", "Meridian Flip", "Meridian Flip", IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
93 MeridianFlipSP.load();
94
95 // Meridian Flip Track
96 MeridianTrackSP[MERIDIAN_TRACK].fill("TRACK", "Track", ISS_ON);
97 MeridianTrackSP[MERIDIAN_STOP].fill("STOP", "Stop", ISS_OFF);
98 MeridianTrackSP.fill(getDeviceName(), "MERIDIAN_TRACK", "After Meridian", "Meridian Flip", IP_RW, ISR_1OFMANY,
99 60, IPS_IDLE);
100 MeridianTrackSP.load();
101
102 // Meridian Flip Limit
103 MeridianLimitNP[0].fill("LIMIT", "LIMIT (deg)", "%.f", -15, 15, 1, 0);
104 MeridianLimitNP.fill(getDeviceName(), "MERIDIAN_LIMIT", "Meridian Limit", "Meridian Flip", IP_RW, 60, IPS_IDLE);
105 MeridianLimitNP.load();
106
107 return true;
108}
109
111{
113
114 if (isConnected())
115 {
116 getStartupData();
117
118 defineProperty(GuideRateNP);
119 defineProperty(BuzzerSP);
120 if (getMountType() != MOUNT_ALTAZ)
121 {
122 defineProperty(MeridianFlipSP);
123 defineProperty(MeridianTrackSP);
124 defineProperty(MeridianLimitNP);
125 }
126 }
127 else
128 {
129 deleteProperty(GuideRateNP);
130 deleteProperty(BuzzerSP);
131 if (getMountType() != MOUNT_ALTAZ)
132 {
133 deleteProperty(MeridianFlipSP);
134 deleteProperty(MeridianTrackSP);
135 deleteProperty(MeridianLimitNP);
136 }
137 }
138
139 return true;
140}
141
142bool ToupSH20::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
143{
144 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
145 {
146 // Meridian Flip Enable
147 if (MeridianFlipSP.isNameMatch(name))
148 {
149 MeridianFlipSP.update(states, names, n);
150 auto rc = setMeridianFlipSettings(MeridianFlipSP[INDI_ENABLED].getState() == ISS_ON,
151 MeridianTrackSP[MERIDIAN_TRACK].getState() == ISS_ON,
152 MeridianLimitNP[0].getValue());
153 MeridianFlipSP.setState(rc ? IPS_OK : IPS_ALERT);
154 MeridianFlipSP.apply();
155 saveConfig(MeridianFlipSP);
156 return true;
157 }
158
159 // Meridian Flip Track
160 if (MeridianTrackSP.isNameMatch(name))
161 {
162 MeridianTrackSP.update(states, names, n);
163 auto rc = setMeridianFlipSettings(MeridianFlipSP[INDI_ENABLED].getState() == ISS_ON,
164 MeridianTrackSP[MERIDIAN_TRACK].getState() == ISS_ON,
165 MeridianLimitNP[0].getValue());
166 MeridianTrackSP.setState(rc ? IPS_OK : IPS_ALERT);
167 MeridianTrackSP.apply();
168 saveConfig(MeridianTrackSP);
169 return true;
170 }
171 }
172
173 return LX200Generic::ISNewSwitch(dev, name, states, names, n);
174}
175
176bool ToupSH20::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
177{
178 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
179 {
180 // Guide Rate
181 if (GuideRateNP.isNameMatch(name))
182 {
183 GuideRateNP.update(values, names, n);
184 GuideRateNP.setState(setGuideRate(GuideRateNP[0].getValue()) ? IPS_OK : IPS_ALERT);
185 GuideRateNP.apply();
186 return true;
187 }
188
189 // Meridian FLip Limit
190 if (MeridianLimitNP.isNameMatch(name))
191 {
192 MeridianLimitNP.update(values, names, n);
193 auto rc = setMeridianFlipSettings(MeridianFlipSP[INDI_ENABLED].getState() == ISS_ON,
194 MeridianTrackSP[MERIDIAN_TRACK].getState() == ISS_ON,
195 MeridianLimitNP[0].getValue());
196 MeridianLimitNP.setState(rc ? IPS_OK : IPS_ALERT);
197 MeridianLimitNP.apply();
198 saveConfig(MeridianLimitNP);
199 return true;
200 }
201 }
202
203 return LX200Generic::ISNewNumber(dev, name, values, names, n);
204}
205
207{
208 return "TOUPTEK SH20";
209}
210
212{
213 LOG_DEBUG("Checking SH20 connection...");
214
215 double targetRA = 0;
216 for (int i = 0; i < 2; i++)
217 {
218 if (getLX200RA(PortFD, &targetRA) == 0)
219 return true;
220
221 const struct timespec timeout = {0, 250000000L};
222 nanosleep(&timeout, NULL);
223 }
224
225 return false;
226}
227
228
230{
231 if (!isConnected())
232 return false;
233
234 bool isNotMove = true, isAtHome = false;
235
236 char status[DRIVER_LEN] = {0};
237 if (sendCommand(":GU#", status))
238 {
239 isNotMove = strchr(status, 'N');
240 isAtHome = strchr(status, 'H');
241 }
242
243 if (HomeSP.getState() == IPS_BUSY && isAtHome)
244 {
245 HomeSP.reset();
246 HomeSP.setState(IPS_OK);
247 LOG_INFO("At home position now.");
248 HomeSP.apply();
250 }
251 else if (TrackState == SCOPE_SLEWING)
252 {
253 // Check if LX200 is done slewing
254 if (isNotMove)
255 {
257 LOG_INFO("Slew is complete. Tracking...");
258 }
259 }
260 else if (TrackState == SCOPE_PARKING)
261 {
262 if (isNotMove)
263 {
264 SetParked(true);
265 }
266 }
267 else
268 {
269 char response[DRIVER_LEN] = {0};
270 if (sendCommand(":GTS#", response))
271 {
272 auto wasTracking = TrackStateSP[INDI_ENABLED].getState() == ISS_ON;
273 auto nowTracking = response[0] == '1';
274 if (wasTracking != nowTracking)
275 TrackState = nowTracking ? SCOPE_TRACKING : SCOPE_IDLE;
276 }
277 }
278
280 {
281 EqNP.setState(IPS_ALERT);
282 LOG_ERROR("Error reading RA/DEC.");
283 EqNP.apply();
284 return false;
285 }
286
287 if (HasPierSide())
288 {
289 char response[DRIVER_LEN] = {0};
290 if (sendCommand(":Gm#", response))
291 {
292 if (response[0] == '1')
294 else if (response[0] == '0')
296 else
298 }
299 }
300
302
303 return true;
304}
305
309bool ToupSH20::updateLocation(double latitude, double longitude, double elevation)
310{
311 INDI_UNUSED(elevation);
312 int d = 0, m = 0, s = 0;
313
314 // JM: INDI Longitude is 0 to 360 increasing EAST. Standard East is Positive, West is negative
315 if (longitude > 180)
316 longitude = longitude - 360;
317
318 char command[DRIVER_LEN] = {0};
319 getSexComponents(longitude, &d, &m, &s);
320 snprintf(command, DRIVER_LEN, ":Sg%c%03d*%02d:%02d#", longitude >= 0 ? '+' : '-', std::abs(d), m, s);
321 if (setStandardProcedure(PortFD, command) < 0)
322 {
323 LOG_ERROR("Error setting site longitude coordinates");
324 return false;
325 }
326
327 getSexComponents(latitude, &d, &m, &s);
328 snprintf(command, DRIVER_LEN, ":St%c%02d*%02d:%02d#", latitude >= 0 ? '+' : '-', std::abs(d), m, s);
329 if (setStandardProcedure(PortFD, command) < 0)
330 {
331 LOG_ERROR("Error setting site latitude coordinates");
332 return false;
333 }
334
335 return true;
336}
337
341bool ToupSH20::setUTCOffset(double offset)
342{
343 int h = 0, m = 0, s = 0;
344 char command[DRIVER_LEN] = {0};
345 getSexComponents(offset, &h, &m, &s);
346
347 snprintf(command, DRIVER_LEN, ":SG%c%02d:%02d#", offset >= 0 ? '+' : '-', std::abs(h), m);
348 return setStandardProcedure(PortFD, command) == 0;
349}
350
351bool ToupSH20::setLocalDate(uint8_t days, uint8_t months, uint16_t years)
352{
353 char command[DRIVER_LEN] = {0};
354 snprintf(command, DRIVER_LEN, ":SC%02d/%02d/%02d#", months, days, years % 100);
355 return setStandardProcedure(PortFD, command) == 0;
356}
357
361bool ToupSH20::Goto(double ra, double dec)
362{
363 const struct timespec timeout = {0, 100000000L};
364
365 targetRA = ra;
366 targetDEC = dec;
367 char RAStr[64] = {0}, DecStr[64] = {0};
368 int fracbase = 0;
369
370 switch (getLX200EquatorialFormat())
371 {
373 fracbase = 360000;
374 break;
377 default:
378 fracbase = 3600;
379 break;
380 }
381
382 fs_sexa(RAStr, targetRA, 2, fracbase);
383 fs_sexa(DecStr, targetDEC, 2, fracbase);
384
385 // If moving, let's stop it first.
386 if (EqNP.getState() == IPS_BUSY)
387 {
388 if (!isSimulation() && abortSlew(PortFD) < 0)
389 {
390 AbortSP.setState(IPS_ALERT);
391 LOG_ERROR("Abort slew failed.");
392 AbortSP.apply();
393 return false;
394 }
395
396 AbortSP.setState(IPS_OK);
397 EqNP.setState(IPS_IDLE);
398 LOG_ERROR("Slew aborted.");
399 AbortSP.apply();
400 EqNP.apply();
401
402 if (MovementNSSP.getState() == IPS_BUSY || MovementWESP.getState() == IPS_BUSY)
403 {
404 MovementNSSP.setState(IPS_IDLE);
405 MovementWESP.setState(IPS_IDLE);
406 EqNP.setState(IPS_IDLE);
407 MovementNSSP.reset();
408 MovementWESP.reset();
409 MovementNSSP.apply();
410 MovementWESP.apply();
411 }
412
413 // sleep for 100 mseconds
414 nanosleep(&timeout, nullptr);
415 }
416
417 if (!isSimulation())
418 {
420 {
421 EqNP.setState(IPS_ALERT);
422 LOG_ERROR("Error setting RA/DEC.");
423 EqNP.apply();
424 return false;
425 }
426
427 int err = Slew(PortFD);
428
429 // for sh20 0:failed, 1:success
430 if (err == 0)
431 {
432 LOGF_ERROR("Error Slewing to JNow RA %s - DEC %s", RAStr, DecStr);
433 slewError(err);
434 return false;
435 }
436 }
437
439 //EqNP.s = IPS_BUSY;
440
441 LOGF_INFO("Slewing to RA: %s - DEC: %s", RAStr, DecStr);
442
443 return true;
444}
445
450{
451 char command[DRIVER_LEN] = {0};
452 snprintf(command, DRIVER_LEN, ":R%d#", index);
453 return sendCommand(command);
454}
455
460{
461 char response[DRIVER_LEN] = {0};
462 bool rc = sendCommand(enabled ? ":Te#" : ":Td#", response, 4, 1);
463 return rc && response[0] == '1';
464}
465
470{
471 char response[DRIVER_LEN] = {0};
472 bool rc = sendCommand(":SPc#", response, 5, 1);
473 return rc && response[0] == '1';
474}
475
477{
478 if (!sendCommand(":MP1#"))
479 return false;
481 return true;
482}
483
485{
486 if (!sendCommand(":MP0#"))
487 return false;
489 SetParked(false);
490 return true;
491}
492
497{
498 switch (action)
499 {
500 case HOME_GO:
501 if (goHome())
502 return IPS_BUSY;
503 else
504 return IPS_ALERT;
505
506 case HOME_FIND:
507 if (findHome())
508 return IPS_OK;
509 else
510 return IPS_ALERT;
511
512 default:
513 return IPS_ALERT;
514
515 }
516}
517
521bool ToupSH20::sendCommand(const char * cmd, char * res, int cmd_len, int res_len)
522{
523 int nbytes_written = 0, nbytes_read = 0, rc = -1;
524
525 tcflush(PortFD, TCIOFLUSH);
526
527 if (cmd_len > 0)
528 {
529 char hex_cmd[DRIVER_LEN * 3] = {0};
530 hexDump(hex_cmd, cmd, cmd_len);
531 LOGF_DEBUG("CMD <%s>", hex_cmd);
532 rc = tty_write(PortFD, cmd, cmd_len, &nbytes_written);
533 }
534 else
535 {
536 LOGF_DEBUG("CMD <%s>", cmd);
537 rc = tty_write_string(PortFD, cmd, &nbytes_written);
538 }
539
540 if (rc != TTY_OK)
541 {
542 char errstr[MAXRBUF] = {0};
543 tty_error_msg(rc, errstr, MAXRBUF);
544 LOGF_ERROR("Serial write error: %s.", errstr);
545 return false;
546 }
547
548 if (res == nullptr)
549 {
550 tcdrain(PortFD);
551 return true;
552 }
553
554 if (res_len > 0)
555 rc = tty_read(PortFD, res, res_len, DRIVER_TIMEOUT, &nbytes_read);
556 else
557 rc = tty_nread_section(PortFD, res, DRIVER_LEN, DRIVER_STOP_CHAR, DRIVER_TIMEOUT, &nbytes_read);
558
559 if (rc != TTY_OK)
560 {
561 char errstr[MAXRBUF] = {0};
562 tty_error_msg(rc, errstr, MAXRBUF);
563 LOGF_ERROR("Serial read error: %s.", errstr);
564 return false;
565 }
566
567 if (res_len > 0)
568 {
569 char hex_res[DRIVER_LEN * 3] = {0};
570 hexDump(hex_res, res, res_len);
571 LOGF_DEBUG("RES <%s>", hex_res);
572 }
573 else
574 {
575 LOGF_DEBUG("RES <%s>", res);
576 }
577
578 tcflush(PortFD, TCIOFLUSH);
579
580 return true;
581}
582
583void ToupSH20::hexDump(char * buf, const char * data, int size)
584{
585 for (int i = 0; i < size; i++)
586 sprintf(buf + 3 * i, "%02X ", static_cast<uint8_t>(data[i]));
587
588 if (size > 0)
589 buf[3 * size - 1] = '\0';
590}
591
595void ToupSH20::getStartupData()
596{
597 InitPark();
598 readMountType();
599 getTrackMode();
600 getGuideRate();
601 getBuzzer();
602 if (getMountType() != MOUNT_ALTAZ)
603 getMeridianFlipSettings();
604}
605
610{
611 if (type == MOUNT_EQ_FORK)
612 {
613 LOG_ERROR("SH20 supports Alt-Az and German equatorial modes only.");
614 return false;
615 }
616
617 // When disconnected the selection is only saved.
618 if (!isConnected())
619 return true;
620
621 if (!sendCommand((type == MOUNT_ALTAZ) ? ":AA#" : ":AP#"))
622 return false;
623
624 LOG_WARN("You must reconnect mount for change to take effect.");
625 return true;
626}
627
628bool ToupSH20::readMountType()
629{
630 char response[DRIVER_LEN] = {0};
631 if (!sendCommand(":GU#", response))
632 return false;
633
634 if (strchr(response, 'Z'))
636 else if (strchr(response, 'G'))
638 return true;
639}
640
644bool ToupSH20::goHome()
645{
646 return sendCommand(":MH#");
647}
648
649bool ToupSH20::findHome()
650{
651 const char cmd[] = ":MFH#";
652 char status = '0';
653 return sendCommand(cmd, &status, strlen(cmd), sizeof(status)) && status == '1';
654}
655
659bool ToupSH20::getTrackMode()
660{
661 char response[DRIVER_LEN] = {0};
662 if (sendCommand(":GT#", response))
663 {
664 TrackModeSP.reset();
665 auto onIndex = response[0];
666 TrackModeSP[onIndex].setState(ISS_ON);
667 return true;
668 }
669
670 TrackModeSP.setState(IPS_ALERT);
671 return false;
672
673}
674
678bool ToupSH20::setGuideRate(double value)
679{
680 char command[DRIVER_LEN] = {0};
681 snprintf(command, DRIVER_LEN, ":Sgr%.2f#", value);
682 return sendCommand(command);
683}
684
685bool ToupSH20::getGuideRate()
686{
687 char response[DRIVER_LEN] = {0};
688 if (sendCommand(":Ggr#", response))
689 {
690 double value = 0;
691 if (sscanf(response, "%lf", &value) == 1)
692 {
693 GuideRateNP[0].setValue(value);
694 return true;
695 }
696 }
697 GuideRateNP.setState(IPS_ALERT);
698 return false;
699}
700
704bool ToupSH20::setBuzzer(int value)
705{
706 char command[DRIVER_LEN] = {0};
707 snprintf(command, DRIVER_LEN, ":SBz%d#", value);
708 return sendCommand(command);
709}
710
711bool ToupSH20::getBuzzer()
712{
713 char response[DRIVER_LEN] = {0};
714 if (sendCommand(":GBz#", response))
715 {
716 BuzzerSP.reset();
717 auto onIndex = response[0];
718 BuzzerSP[onIndex].setState(ISS_ON);
719 BuzzerSP.setState(IPS_OK);
720 return true;
721 }
722 else
723 {
724 BuzzerSP.setState(IPS_ALERT);
725 return false;
726 }
727}
728
732bool ToupSH20::setMeridianFlipSettings(bool enabled, bool track, double limit)
733{
734 char command[DRIVER_LEN] = {0};
735 snprintf(command, DRIVER_LEN, ":STa%d%d%c%02d#", enabled ? 1 : 0, track ? 1 : 0,
736 limit >= 0 ? '+' : '-', static_cast<int>(std::abs(limit)));
737 char response[2] = {0};
738 auto rc = sendCommand(command, response, -1, 1);
739 return rc && response[0] == '1';
740}
741
742bool ToupSH20::getMeridianFlipSettings()
743{
744 char response[DRIVER_LEN] = {0};
745 if (sendCommand(":GTa#", response))
746 {
747 if (strlen(response) >= 5)
748 {
749 MeridianFlipSP.reset();
750 MeridianFlipSP[response[0] == '1' ? INDI_ENABLED : INDI_DISABLED].setState(ISS_ON);
751 MeridianFlipSP.setState(IPS_OK);
752
753 MeridianTrackSP.reset();
754 MeridianTrackSP[response[1] == '1' ? MERIDIAN_TRACK : MERIDIAN_STOP].setState(ISS_ON);
755 MeridianTrackSP.setState(IPS_OK);
756
757 char *sign = &response[2];
758 char *limit = &response[3];
759 int limitValue = atoi(limit);
760 if (*sign == '-')
761 limitValue = -limitValue;
762 MeridianLimitNP[0].setValue(limitValue);
763 MeridianLimitNP.setState(IPS_OK);
764
765 return true;
766 }
767 }
768
769 MeridianFlipSP.setState(IPS_ALERT);
770 MeridianTrackSP.setState(IPS_ALERT);
771 MeridianLimitNP.setState(IPS_ALERT);
772 return false;
773}
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
TelescopeMountType getMountType() const
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
TelescopeMountType
Mount geometry reported in the standard TELESCOPE_MOUNT_TYPE property. The values are the indices of ...
uint32_t GetTelescopeCapability() const
GetTelescopeCapability returns the capability of the Telescope.
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 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.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual void slewError(int slewCode)
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void setLX200Capability(uint32_t cap)
virtual bool ReadScopeStatus() override
Read telescope status.
virtual const char * getDefaultName() override
virtual bool Park() override
Park the telescope to its home position.
virtual bool checkConnection() override
virtual bool SetSlewRate(int index) override
Override - Slew rate.
virtual bool SetMountType(TelescopeMountType type) override
Mount Type.
virtual bool Goto(double ra, double dec) override
Override - Goto.
virtual bool SetCurrentPark() override
Override - Park.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Override - Location.
virtual bool setUTCOffset(double offset) override
Override - Date.
virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
virtual bool SetTrackEnabled(bool enabled) override
Override - Track enable.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Override - Home.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition toup_sh20.cpp:34
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
INDI::PropertySwitch AbortSP
INDI::PropertySwitch MovementNSSP
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch HomeSP
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertySwitch MountTypeSP
Standard TELESCOPE_MOUNT_TYPE property, indexed by TelescopeMountType. Writable if the driver sets TE...
INDI::PropertySwitch MovementWESP
double ra
double dec
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
IPState
Property state.
Definition indiapi.h:158
@ 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 tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition indicom.c:418
void getSexComponents(double value, int *d, int *m, int *s)
Definition indicom.c:243
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Definition indicom.c:548
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition indicom.c:473
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Definition indicom.c:1243
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
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
Definition indicom.c:759
Implementations for common driver routines.
@ TTY_OK
Definition indicom.h:54
#define INDI_UNUSED(x)
Definition indidevapi.h:132
#define MAXRBUF
Definition indidriver.c:52
int IUGetConfigOnSwitchIndex(const char *dev, const char *property, int *index)
IUGetConfigOnSwitchIndex Opens configuration file and reads single switch property to find ON switch ...
Definition indidriver.c:719
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
Definition indilogger.h:82
#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 LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
#define getDeviceName
int setObjectRA(int fd, double ra, bool addSpace)
int getLX200EquatorialFormat()
int setStandardProcedure(int fd, const char *data)
int setObjectDEC(int fd, double dec, bool addSpace)
int abortSlew(int fd)
int Slew(int fd)
#define getLX200DEC(fd, x)
@ LX200_24
Definition lx200driver.h:64
#define getLX200RA(fd, x)
@ LX200_EQ_LONGER_FORMAT
Definition lx200driver.h:52
@ LX200_EQ_SHORT_FORMAT
Definition lx200driver.h:50
@ LX200_EQ_LONG_FORMAT
Definition lx200driver.h:51
uint16_t type
Definition pwc-ioctl.h:0
uint8_t cmd[4]
Definition pwc-ioctl.h:2