Instrument Neutral Distributed Interface INDI 2.2.5
rigel_dome.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Rigel Systems Dome INDI Driver
3
4 Copyright(c) 2019 Jasem Mutlaq. All rights reserved.
5
6 Based on Protocol extracted from https://github.com/rpineau/RigelDome
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation.
11 .
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16 .
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*******************************************************************************/
22
23#include "rigel_dome.h"
24#include "indicom.h"
26
27#include <cmath>
28#include <cstring>
29#include <regex>
30#include <memory>
31#include <termios.h>
32
33// We declare an auto pointer to RigelDome.
34static std::unique_ptr<RigelDome> rigelDome(new RigelDome());
35
36#define DOME_CMD 9 /* Dome command in bytes */
37#define DOME_BUF 16 /* Dome command buffer */
38#define DOME_TIMEOUT 3 /* 3 seconds comm timeout */
39
40#define SIM_SHUTTER_TIMER 5.0 /* Simulated Shutter closes/open in 5 seconds */
41#define SIM_FLAP_TIMER 5.0 /* Simulated Flap closes/open in 3 seconds */
42#define SIM_DOME_HI_SPEED 5.0 /* Simulated dome speed 5.0 degrees per second, constant */
43#define SIM_DOME_LO_SPEED 0.5 /* Simulated dome speed 0.5 degrees per second, constant */
44
55
57{
59
60 OperationSP[OPERATION_FIND_HOME].fill("OPERATION_FIND_HOME", "Find Home", ISS_OFF);
61 OperationSP[OPERATION_CALIBRATE].fill("OPERATION_CALIBRATE", "Calibrate", ISS_OFF);
62 OperationSP.fill(getDeviceName(), "OPERATION", "Operation", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE);
63
64 InfoTP[INFO_FIRMWARE].fill("FIRMWARE", "Version", "NA");
65 InfoTP[INFO_MODEL].fill("MODEL", "Model", "NA");
66 InfoTP[INFO_TICKS].fill("TICKS_PER_REV", "Ticks/Rev", "NA");
67 InfoTP[INFO_BATTERY].fill("BATTERY", "Battery", "NA");
68 InfoTP.fill(getDeviceName(), "FIRMWARE_INFO", "Info", INFO_TAB, IP_RO, 60, IPS_IDLE);
69
70 HomePositionNP[AXIS_AZ].fill("HOME_AZ", "AZ D:M:S", "%10.6m", 0.0, 360.0, 0.0, 0);
71 HomePositionNP.fill(getDeviceName(), "DOME_HOME_POSITION", "Home Position", SITE_TAB, IP_RW, 60, IPS_IDLE);
72
76
77 // Initialize Pulsar Dome Drive workaround variables
78 previousAngle = -1;
79 stuckAngleCounter = 0;
80
81 return true;
82}
83
84/************************************************************************************
85 *
86* ***********************************************************************************/
87bool RigelDome::getStartupValues()
88{
89 targetAz = 0;
90
91 InfoTP.setState((readFirmware() && readModel() && readStepsPerRevolution()) ? IPS_OK : IPS_ALERT);
92 if (HasShutter())
93 readBatteryLevels();
94 InfoTP.apply();
95
96 if (readPosition())
98
99 if (readShutterStatus())
101
102 if (readHomePosition())
103 HomePositionNP.apply();
104
105 if (InitPark())
106 {
107 // If loading parking data is successful, we just set the default parking values.
109 }
110 else
111 {
112 // Otherwise, we set all parking data to default in case no parking data is found.
113 SetAxis1Park(0);
115 }
116
117 return true;
118}
119
120/************************************************************************************
121 *
122* ***********************************************************************************/
124{
125 char res[DRIVER_LEN] = {0};
126 sendCommand("PULSAR", res); // send dummy command to flush serial line
127
128 bool rc = readShutterStatus();
129 if (rc)
130 {
131 if (m_rawShutterState != S_NotFitted)
133 }
134
135 return rc;
136}
137
138/************************************************************************************
139 *
140* ***********************************************************************************/
142{
143 return "Rigel Dome";
144}
145
146/************************************************************************************
147 *
148* ***********************************************************************************/
150{
152
153 if (isConnected())
154 {
155 defineProperty(OperationSP);
156 defineProperty(InfoTP);
157 defineProperty(HomePositionNP);
158
159 getStartupValues();
160 }
161 else
162 {
163 deleteProperty(OperationSP);
164 deleteProperty(InfoTP);
165 deleteProperty(HomePositionNP);
166 }
167
168 return true;
169}
170
171/************************************************************************************
172 *
173* ***********************************************************************************/
174bool RigelDome::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
175{
176 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
177 {
178 if (OperationSP.isNameMatch(name))
179 {
180 const char *requestedOperation = IUFindOnSwitchName(states, names, n);
181 if (OperationSP[OPERATION_FIND_HOME].isNameMatch(requestedOperation))
182 {
183 if (home())
184 {
185 OperationSP.reset();
186 OperationSP[OPERATION_FIND_HOME].s = ISS_ON;
187 OperationSP.setState(IPS_BUSY);
188 LOG_INFO("Dome is moving to home position...");
190 }
191 else
192 {
193 OperationSP.setState(IPS_ALERT);
194 }
195 }
196 else if (OperationSP[OPERATION_CALIBRATE].isNameMatch(requestedOperation))
197 {
198 if (calibrate())
199 {
200 OperationSP.reset();
201 OperationSP[OPERATION_CALIBRATE].s = ISS_ON;
202 OperationSP.setState(IPS_BUSY);
203 LOG_INFO("Dome is calibrating...");
205 }
206 else
207 {
208 OperationSP.setState(IPS_ALERT);
209 }
210 }
211
212 OperationSP.apply();
213 return true;
214 }
215 }
216
217 return INDI::Dome::ISNewSwitch(dev, name, states, names, n);
218}
219
220/************************************************************************************
221 *
222* ***********************************************************************************/
223bool RigelDome::ISNewNumber(const char * dev, const char * name, double values[], char * names[], int n)
224{
225 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
226 {
227 if (HomePositionNP.isNameMatch(name))
228 {
229 HomePositionNP.update(values, names, n);
230 HomePositionNP.setState(IPS_OK);
231 auto homeAz = HomePositionNP[AXIS_AZ].getValue();
232 setHome(homeAz);
233 LOGF_INFO("Setting home position to %3.1f", homeAz);
234 HomePositionNP.apply();
235 return true;
236 }
237 }
238
239 return INDI::Dome::ISNewNumber(dev, name, values, names, n);
240}
241
242/************************************************************************************
243 *
244* ***********************************************************************************/
246{
247 if (!isConnected())
248 return; // No need to reset timer if we are not connected anymore
249
250 readState();
251
252 bool isMoving = (m_rawMotorState != M_Idle && m_rawMotorState != M_MovingAtSideral);
253
254 /*
255 Pulsar Dome Drive workaround to fix issue where the motor seems to
256 be struggling as it tries to get to the final position.
257 This improved version tracks consecutive cycles with no angle change
258 and only stops the motor after multiple cycles.
259 */
260 double currentAngle = DomeAbsPosNP[0].getValue();
261
262 // Check if angle has changed within tolerance and stop if stuck for threshold
263 if (std::abs(currentAngle - previousAngle) < ANGLE_TOLERANCE && isMoving)
264 {
265 stuckAngleCounter++;
266
267 if (stuckAngleCounter >= STUCK_THRESHOLD)
268 {
269 stuckAngleCounter = 0;
270 char res[DRIVER_LEN] = {0};
271
272 if (sendCommand("STOP", res))
273 {
274 double diff = std::abs(targetAz - currentAngle);
275 // Account for wrap-around (e.g., target 1, current 359)
276 if (diff > 180)
277 diff = 360.0 - diff;
278
279 LOGF_INFO("Motor stopped after %d cycles with no movement. Current: %.3f°, Target: %.3f°, Difference: %.3f°",
280 STUCK_THRESHOLD, currentAngle, targetAz, diff);
283 return;
284 }
285 }
286 }
287 else
288 {
289 // Angle changed, reset counter
290 stuckAngleCounter = 0;
291 }
292
293 previousAngle = currentAngle;
294 /* END Pulsar Dome Drive workaround */
295
296 if (DomeAbsPosNP.getState() == IPS_BUSY && isMoving == false)
297 {
298 bool isHoming = (OperationSP.getState() == IPS_BUSY && OperationSP[OPERATION_FIND_HOME].getState() == ISS_ON);
299 bool isCalibrating = (OperationSP.getState() == IPS_BUSY && OperationSP[OPERATION_CALIBRATE].getState() == ISS_ON);
300
301 if (isHoming)
302 {
303 LOG_INFO("Dome completed homing...");
304 OperationSP.reset();
305 OperationSP.setState(IPS_OK);
306 OperationSP.apply();
308 }
309 else if (isCalibrating)
310 {
311 LOG_INFO("Dome completed calibration...");
312 OperationSP.reset();
313 OperationSP.setState(IPS_OK);
314 OperationSP.apply();
316 }
317 else if (getDomeState() == DOME_PARKING)
318 {
319 SetParked(true);
320 LOG_INFO("Dome is parked.");
321 }
322 else
323 {
324 LOGF_INFO("Dome reached requested azimuth: %.3f Degrees", DomeAbsPosNP[0].getValue());
326 }
327 }
328 else
329 {
330 if (DomeAbsPosNP.getState() != IPS_BUSY && isMoving)
331 DomeAbsPosNP.setState(IPS_BUSY);
332
333 DomeAbsPosNP.apply();
334 }
335
336 if (HasShutter())
337 {
338 ShutterState newShutterState = parseShutterState(m_rawShutterState);
339 if (newShutterState != getShutterState())
340 {
341 setShutterState(newShutterState);
342 }
343
344 if (readBatteryLevels())
345 InfoTP.apply();
346 }
347
349}
350
355{
356 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
357
358 targetAz = az;
359 snprintf(cmd, DRIVER_LEN, "GO %3.1f", az);
360 if (sendCommand(cmd, res) == false)
361 return IPS_ALERT;
362
363 // Reset stuck counter for new movement
364 stuckAngleCounter = 0;
365
366 return (res[0] == 'A') ? IPS_BUSY : IPS_ALERT;
367}
368
373{
374 targetAz = range360(DomeAbsPosNP[0].getValue() + azDiff);
375 // It will take a few cycles to reach final position
376 return MoveAbs(targetAz);
377}
378
382bool RigelDome::Sync(double az)
383{
384 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
385
386 targetAz = az;
387 snprintf(cmd, DRIVER_LEN, "ANGLE K %3.1f", az);
388 if (sendCommand(cmd, res) == false)
389 return false;
390
391 return (res[0] == 'A');
392}
393
398{
399 targetAz = GetAxis1Park();
400 if (setParkAz(targetAz))
401 {
402 // Reset stuck counter for parking movement
403 stuckAngleCounter = 0;
404
405 char res[DRIVER_LEN] = {0};
406 if (sendCommand("GO P", res) == false)
407 return IPS_ALERT;
408 return (res[0] == 'A' ? IPS_BUSY : IPS_ALERT);
409 }
410
411 return IPS_ALERT;
412}
413
417bool RigelDome::home()
418{
419 // Reset stuck counter for homing movement
420 stuckAngleCounter = 0;
421 targetAz = HomePositionNP[0].getValue();
422
423 char res[DRIVER_LEN] = {0};
424 if (sendCommand("GO H", res) == false)
425 return false;
426
427 return (res[0] == 'A');
428}
429
433bool RigelDome::calibrate()
434{
435 // Reset stuck counter for calibration movement
436 stuckAngleCounter = 0;
437
438 char res[DRIVER_LEN] = {0};
439 if (sendCommand("CALIBRATE", res) == false)
440 return false;
441
442 return (res[0] == 'A');
443}
444
448bool RigelDome::setHome(double az)
449{
450 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
451
452 targetAz = az;
453 snprintf(cmd, DRIVER_LEN, "HOME %3.1f", az);
454 if (sendCommand(cmd, res) == false)
455 return false;
456
457 return (res[0] == 'A');
458}
459
464{
465 return IPS_OK;
466}
467
472{
473 char res[DRIVER_LEN] = {0};
474
475 if (operation == SHUTTER_OPEN)
476 {
477 m_TargetShutter = operation;
478 sendCommand("OPEN", res);
479 }
480 else
481 {
482 m_TargetShutter = operation;
483 sendCommand("CLOSE", res);
484 }
485
486 return (res[0] == 'A') ? IPS_BUSY : IPS_ALERT;
487}
488
493{
494 if (sendCommand("STOP"))
495 {
496 // Reset stuck counter when aborting movement
497 stuckAngleCounter = 0;
498
499 if (OperationSP.getState() == IPS_BUSY)
500 {
501 LOGF_INFO("%s is aborted.", OperationSP[OPERATION_CALIBRATE].getState() == ISS_ON ? "Calibration" : "Finding home");
502 OperationSP.reset();
503 OperationSP.setState(IPS_ALERT);
504 OperationSP.apply();
505 }
506 else if (getShutterState() == SHUTTER_MOVING)
507 {
508 DomeShutterSP.setState(IPS_ALERT);
509 DomeShutterSP.apply();
510 LOG_WARN("Shutter motion aborted!");
511 }
512 else
513 {
514 LOG_WARN("Dome motion aborted.");
515 }
516
517 return true;
518 }
519
520 return false;
521}
522
527{
528 SetAxis1Park(DomeAbsPosNP[0].getValue());
529 return true;
530}
531
536{
537 // By default set position to 90
538 SetAxis1Park(90);
539 return true;
540}
541
545bool RigelDome::setShutterConnected(bool enabled)
546{
547 char cmd[DRIVER_LEN] = {0};
548 snprintf(cmd, DRIVER_LEN, "BBOND %d", enabled ? 1 : 0);
549 return sendCommand(cmd);
550}
551
555bool RigelDome::isShutterConnected()
556{
557 char res[DRIVER_LEN] = {0};
558 if (sendCommand("BBOND", res) == false)
559 return false;
560 bool rc = (std::stoi(res) != 0);
561 LOGF_DEBUG("Shutter is %s.", (rc ? "connected" : "disconnected"));
562 return rc;
563}
564
568bool RigelDome::readStepsPerRevolution()
569{
570 char res[DRIVER_LEN] = {0};
571 if (sendCommand("ENCREV", res) == false)
572 return false;
573
574 InfoTP[INFO_TICKS].setText(res);
575 return true;
576}
577
581bool RigelDome::readBatteryLevels()
582{
583 char res[DRIVER_LEN] = {0};
584 if (sendCommand("BAT", res) == false)
585 return false;
586
587 int percent = 0;
588 double volts = 0;
589
590 if (sscanf(res, "%d %lf", &percent, &volts) != 2)
591 return false;
592
593 char levels[DRIVER_LEN] = {0};
594 snprintf(levels, DRIVER_LEN, "%.2fv (%d%%)", volts / 1000.0, percent);
595 InfoTP[INFO_BATTERY].setText(levels);
596 return true;
597}
598
602bool RigelDome::readPosition()
603{
604 char res[DRIVER_LEN] = {0};
605 if (sendCommand("ANGLE", res) == false)
606 return false;
607
608 DomeAbsPosNP[0].setValue(std::stod(res));
609 return true;
610}
611
612bool RigelDome::readHomePosition()
613{
614 char res[DRIVER_LEN] = {0};
615
616 if (sendCommand("HOME", res) == false)
617 return false;
618
619 HomePositionNP[0].setValue(std::stod(res));
620 return true;
621}
622
626bool RigelDome::setParkAz(double az)
627{
628 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
629
630 snprintf(cmd, DRIVER_LEN, "PARK %3.1f", az);
631 if (sendCommand(cmd, res) == false)
632 return false;
633
634 return res[0] == 'A';
635}
636
640bool RigelDome::readState()
641{
642 char res[DRIVER_LEN] = {0};
643 if (sendCommand("V", res) == false)
644 return false;
645
646 std::vector<std::string> fields = split(res, "\t");
647 if (fields.size() < 13)
648 return false;
649
650 DomeAbsPosNP[0].setValue(std::stod(fields[0]));
651 m_rawMotorState = static_cast<RigelMotorState>(std::stoi(fields[1]));
652 m_rawShutterState = static_cast<RigelShutterState>(std::stoi(fields[5]));
653 return true;
654}
655
659INDI::Dome::ShutterState RigelDome::parseShutterState(int state)
660{
661 switch (state)
662 {
663 case S_Open:
664 return SHUTTER_OPENED;
665
666 case S_Opening:
667 return SHUTTER_MOVING;
668
669 case S_Closed:
670 return SHUTTER_CLOSED;
671
672 case S_Closing:
673 return SHUTTER_MOVING;
674
675 case S_Error:
676 return SHUTTER_ERROR;
677
678 default:
679 return SHUTTER_UNKNOWN;
680 }
681}
685bool RigelDome::readShutterStatus()
686{
687 char res[DRIVER_LEN] = {0};
688 if (sendCommand("SHUTTER", res) == false)
689 return false;
690
691 m_rawShutterState = static_cast<RigelShutterState>(std::stoi(res));
692 return true;
693}
694
698bool RigelDome::readFirmware()
699{
700 char res[DRIVER_LEN] = {0};
701
702 if (sendCommand("VER", res) == false)
703 return false;
704
705 InfoTP[INFO_FIRMWARE].setText(res);
706 return true;
707}
708
712bool RigelDome::readModel()
713{
714 char res[DRIVER_LEN] = {0};
715
716 if (sendCommand("PULSAR", res) == false)
717 return false;
718
719 InfoTP[INFO_MODEL].setText(res);
720 return true;
721}
722
726bool RigelDome::sendCommand(const char * cmd, char * res, int cmd_len, int res_len)
727{
728 int nbytes_written = 0, nbytes_read = 0, rc = -1;
729
730 tcflush(PortFD, TCIOFLUSH);
731
732 if (cmd_len > 0)
733 {
734 char hex_cmd[DRIVER_LEN * 3] = {0};
735 hexDump(hex_cmd, cmd, cmd_len);
736 LOGF_DEBUG("CMD <%s>", hex_cmd);
737 rc = tty_write(PortFD, cmd, cmd_len, &nbytes_written);
738 }
739 else
740 {
741 LOGF_DEBUG("CMD <%s>", cmd);
742
743 char formatted_command[DRIVER_LEN] = {0};
744 snprintf(formatted_command, DRIVER_LEN, "%s\r", cmd);
745 rc = tty_write_string(PortFD, formatted_command, &nbytes_written);
746 }
747
748 if (rc != TTY_OK)
749 {
750 char errstr[MAXRBUF] = {0};
751 tty_error_msg(rc, errstr, MAXRBUF);
752 LOGF_ERROR("Serial write error: %s.", errstr);
753 return false;
754 }
755
756 if (res == nullptr)
757 return true;
758
759 if (res_len > 0)
760 rc = tty_read(PortFD, res, res_len, DRIVER_TIMEOUT, &nbytes_read);
761 else
762 rc = tty_nread_section(PortFD, res, DRIVER_LEN, DRIVER_STOP_CHAR, DRIVER_TIMEOUT, &nbytes_read);
763
764 if (rc != TTY_OK)
765 {
766 char errstr[MAXRBUF] = {0};
767 tty_error_msg(rc, errstr, MAXRBUF);
768 LOGF_ERROR("Serial read error: %s.", errstr);
769 return false;
770 }
771
772 if (res_len > 0)
773 {
774 char hex_res[DRIVER_LEN * 3] = {0};
775 hexDump(hex_res, res, res_len);
776 LOGF_DEBUG("RES <%s>", hex_res);
777 }
778 else
779 {
780 // Remove extra \r
781 res[nbytes_read - 1] = 0;
782 LOGF_DEBUG("RES <%s>", res);
783 }
784
785 tcflush(PortFD, TCIOFLUSH);
786
787 return true;
788}
789
793void RigelDome::hexDump(char * buf, const char * data, int size)
794{
795 for (int i = 0; i < size; i++)
796 sprintf(buf + 3 * i, "%02X ", static_cast<uint8_t>(data[i]));
797
798 if (size > 0)
799 buf[3 * size - 1] = '\0';
800}
801
805std::vector<std::string> RigelDome::split(const std::string &input, const std::string &regex)
806{
807 // passing -1 as the submatch index parameter performs splitting
808 std::regex re(regex);
809 std::sregex_token_iterator
810 first{input.begin(), input.end(), re, -1},
811 last;
812 return {first, last};
813}
814
819{
820 double target;
821
822 if (operation == MOTION_START)
823 {
824 target = DomeAbsPosNP[0].getValue();
825 if(dir == DOME_CW)
826 {
827 target += 5;
828 }
829 else
830 {
831 target -= 5;
832 }
833
834 if(target < 0)
835 target += 360;
836 if(target >= 360)
837 target -= 360;
838 }
839 else
840 {
841 target = DomeAbsPosNP[0].getValue();
842 }
843
844 MoveAbs(target);
845
846 return ((operation == MOTION_START) ? IPS_BUSY : IPS_OK);
847
848}
bool isConnected() const
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)
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
void SetDomeCapability(uint32_t cap)
SetDomeCapability set the dome capabilities. All capabilities must be initialized.
void SetAxis1Park(double value)
SetRAPark Set current AZ parking position. The data park file (stored in ~/.indi/ParkData....
ShutterOperation
Shutter operation command.
Definition indidome.h:114
void SetAxis1ParkDefault(double steps)
SetAxis1Park Set default AZ parking position.
DomeMotionCommand
Definition indidome.h:97
@ MOTION_START
Definition indidome.h:98
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
Definition indidome.cpp:108
double GetAxis1Park()
uint32_t GetDomeCapability() const
GetDomeCapability returns the capability of the dome.
Definition indidome.h:204
bool HasShutter()
Definition indidome.h:258
@ SHUTTER_ERROR
Definition indidome.h:151
@ SHUTTER_MOVING
Definition indidome.h:149
@ SHUTTER_UNKNOWN
Definition indidome.h:150
@ SHUTTER_OPENED
Definition indidome.h:147
@ SHUTTER_CLOSED
Definition indidome.h:148
@ DOME_CAN_PARK
Definition indidome.h:159
@ DOME_CAN_ABS_MOVE
Definition indidome.h:157
@ DOME_HAS_SHUTTER
Definition indidome.h:161
@ DOME_CAN_REL_MOVE
Definition indidome.h:158
@ DOME_CAN_ABORT
Definition indidome.h:156
@ DOME_CAN_SYNC
Definition indidome.h:160
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition indidome.cpp:287
INDI::PropertyNumber DomeAbsPosNP
Definition indidome.h:558
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition indidome.cpp:508
void setShutterState(const ShutterState &value)
void setDomeState(const DomeState &value)
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
Connection::Serial * serialConnection
Definition indidome.h:629
void SetParkDataType(DomeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
INDI::PropertySwitch DomeShutterSP
Definition indidome.h:568
ShutterState getShutterState() const
Definition indidome.h:291
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition indidome.cpp:399
DomeState getDomeState() const
Definition indidome.h:285
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
@ M_MovingAtSideral
Definition rigel_dome.h:30
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close shutter.
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool Sync(double az) override
Sync sets the dome current azimuth as the supplied azimuth position.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override
Move the Dome in a particular direction.
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
virtual bool Abort() override
Abort all dome motion.
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual const char * getDefaultName() override
virtual IPState MoveRel(double azDiff) override
Move the Dome to an relative position.
virtual bool Handshake() override
perform handshake with device to check communication
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
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
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_ATMOST1
Definition indiapi.h:172
@ AXIS_AZ
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition indicom.c:418
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Definition indicom.c:548
double range360(double r)
range360 Limits an angle to be between 0-360 degrees.
Definition indicom.c:1321
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 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
const char * IUFindOnSwitchName(ISState *states, char *names[], int n)
Returns the name of the first ON switch it finds in the supplied arguments.
Definition indidevapi.c:355
#define MAXRBUF
Definition indidriver.c:52
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
Definition indilogger.h:82
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
#define getDeviceName
@ calibrate
Definition integra.cpp:66
json_pointer res
uint8_t cmd[4]
Definition pwc-ioctl.h:2