Instrument Neutral Distributed Interface INDI  1.9.5
pegasus_scopsoag.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2021 Chrysikos Efstathios. All rights reserved.
3 
4  Pegasus ScopsOAG
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #include "pegasus_scopsoag.h"
26 
27 #include "indicom.h"
29 
30 #include <cmath>
31 #include <cstring>
32 #include <memory>
33 
34 #include <termios.h>
35 #include <unistd.h>
36 
37 #define DMFC_TIMEOUT 3
38 #define FOCUS_SETTINGS_TAB "Settings"
39 #define TEMPERATURE_THRESHOLD 0.1
40 
41 static std::unique_ptr<PegasusScopsOAG> scopsOAG(new PegasusScopsOAG());
42 
44 {
45  // Can move in Absolute & Relative motions, can AbortFocuser motion.
52 }
53 
55 {
57 
58  // LED
59  IUFillSwitch(&LEDS[LED_OFF], "Off", "", ISS_ON);
60  IUFillSwitch(&LEDS[LED_ON], "On", "", ISS_OFF);
61  IUFillSwitchVector(&LEDSP, LEDS, 2, getDeviceName(), "LED", "", FOCUS_SETTINGS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
62 
63  // Firmware Version
64  IUFillText(&FirmwareVersionT[0], "Version", "Version", "");
65  IUFillTextVector(&FirmwareVersionTP, FirmwareVersionT, 1, getDeviceName(), "Firmware", "Firmware", MAIN_CONTROL_TAB, IP_RO,
66  0, IPS_IDLE);
67 
68  // Relative and absolute movement
69  FocusRelPosN[0].min = 0.;
70  FocusRelPosN[0].max = 50000.;
71  FocusRelPosN[0].value = 0;
72  FocusRelPosN[0].step = 1000;
73 
74  FocusAbsPosN[0].min = 0.;
75  FocusAbsPosN[0].max = 100000;
76  FocusAbsPosN[0].value = 0;
77  FocusAbsPosN[0].step = 1000;
78 
79  // Backlash compensation
80  FocusBacklashN[0].min = 1; // 0 is off.
81  FocusBacklashN[0].max = 1000;
82  FocusBacklashN[0].value = 1;
83  FocusBacklashN[0].step = 1;
84 
85  //LED Default ON
86  LEDS[LED_ON].s = ISS_ON;
87  LEDS[LED_OFF].s = ISS_OFF;
88 
92 
93  return true;
94 }
95 
97 {
99 
100  if (isConnected())
101  {
102 
106  defineProperty(&LEDSP);
107  defineProperty(&FirmwareVersionTP);
108  }
109  else
110  {
111  deleteProperty(LEDSP.name);
112  deleteProperty(FirmwareVersionTP.name);
113  }
114 
115  return true;
116 }
117 
119 {
120  if (ack())
121  {
122  LOGF_INFO("%s is online. Getting focus parameters...", this->getDeviceName());
123  return true;
124  }
125 
126  LOGF_INFO(
127  "Error retrieving data from %s, please ensure device is powered and the port is correct.", this->getDeviceName());
128  return false;
129 }
130 
131 
133 {
134  return "Pegasus ScopsOAG";
135 }
136 
137 bool PegasusScopsOAG::ack()
138 {
139  int nbytes_written = 0, nbytes_read = 0, rc = -1;
140  char errstr[MAXRBUF];
141  char cmd[2] = {0};
142  char res[16] = {0};
143 
144  cmd[0] = '#';
145  cmd[1] = 0xA;
146 
147  LOGF_DEBUG("CMD <%#02X>", cmd[0]);
148 
149  tcflush(PortFD, TCIOFLUSH);
150 
151  if ((rc = tty_write(PortFD, cmd, 2, &nbytes_written)) != TTY_OK)
152  {
153  tty_error_msg(rc, errstr, MAXRBUF);
154  LOGF_ERROR("Ack error: %s.", errstr);
155  return false;
156  }
157 
158  if ((rc = tty_read_section(PortFD, res, 0xA, DMFC_TIMEOUT, &nbytes_read)) != TTY_OK)
159  {
160  tty_error_msg(rc, errstr, MAXRBUF);
161  LOGF_ERROR("Ack error: %s.", errstr);
162  return false;
163  }
164 
165  // Get rid of 0xA
166  res[nbytes_read - 1] = 0;
167 
168 
169  if( res[nbytes_read - 2] == '\r') res[nbytes_read - 2] = 0;
170 
171  LOGF_DEBUG("RES <%s>", res);
172 
173  tcflush(PortFD, TCIOFLUSH);
174 
175 
176 
177  if((strstr(res, "OK_SCOPS") != nullptr))
178  return true;
179 
180  return false;
181 }
182 
183 
184 bool PegasusScopsOAG::SyncFocuser(uint32_t ticks)
185 {
186  int nbytes_written = 0, rc = -1;
187  char cmd[16] = {0};
188 
189  snprintf(cmd, 16, "W:%ud", ticks);
190  cmd[strlen(cmd)] = 0xA;
191 
192  LOGF_DEBUG("CMD <%s>", cmd);
193 
194  // Set Position
195  if ((rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK)
196  {
197  char errstr[MAXRBUF];
198  tty_error_msg(rc, errstr, MAXRBUF);
199  LOGF_ERROR("sync error: %s.", errstr);
200  return false;
201  }
202 
203  this->ignoreResponse();
204 
205  return true;
206 }
207 
208 bool PegasusScopsOAG::move(uint32_t newPosition)
209 {
210  int nbytes_written = 0, rc = -1;
211  char cmd[16] = {0};
212 
213  snprintf(cmd, 16, "M:%ud", newPosition);
214  cmd[strlen(cmd)] = 0xA;
215 
216  LOGF_DEBUG("CMD <%s>", cmd);
217 
218  // Set Position
219  if ((rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK)
220  {
221  char errstr[MAXRBUF];
222  tty_error_msg(rc, errstr, MAXRBUF);
223  LOGF_ERROR("move error: %s.", errstr);
224  return false;
225  }
226 
227  this->ignoreResponse();
228 
229  return true;
230 }
231 
232 bool PegasusScopsOAG::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
233 {
234  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
235  {
236  // LED
237  if (!strcmp(name, LEDSP.name))
238  {
239  IUUpdateSwitch(&LEDSP, states, names, n);
240  bool rc = setLedEnabled(LEDS[LED_ON].s == ISS_ON);
241  LEDSP.s = rc ? IPS_OK : IPS_ALERT;
242  IDSetSwitch(&LEDSP, nullptr);
243  return true;
244  }
245  }
246  return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
247 }
248 
249 void PegasusScopsOAG::ignoreResponse()
250 {
251  int nbytes_read = 0;
252  char res[64];
253  tty_read_section(PortFD, res, 0xA, DMFC_TIMEOUT, &nbytes_read);
254 }
255 
256 bool PegasusScopsOAG::updateFocusParams()
257 {
258  int nbytes_written = 0, nbytes_read = 0, rc = -1;
259  char errstr[MAXRBUF];
260  char cmd[3] = {0};
261  char res[64];
262  cmd[0] = 'A';
263  cmd[1] = 0xA;
264 
265  LOGF_DEBUG("CMD <%#02X>", cmd[0]);
266 
267  tcflush(PortFD, TCIOFLUSH);
268 
269  if ((rc = tty_write(PortFD, cmd, 2, &nbytes_written)) != TTY_OK)
270  {
271  tty_error_msg(rc, errstr, MAXRBUF);
272  LOGF_ERROR("GetFocusParams error: %s.", errstr);
273  return false;
274  }
275 
276 
277  if ((rc = tty_read_section(PortFD, res, 0xA, DMFC_TIMEOUT, &nbytes_read)) != TTY_OK)
278  {
279  tty_error_msg(rc, errstr, MAXRBUF);
280  LOGF_ERROR("GetFocusParams error: %s.", errstr);
281  return false;
282  }
283 
284  res[nbytes_read - 1] = 0;
285 
286  // Check for '\r' at end of string and replace with nullptr (DMFC firmware version 2.8)
287  if( res[nbytes_read - 2] == '\r') res[nbytes_read - 2] = 0;
288 
289  LOGF_DEBUG("RES <%s>", res);
290 
291  tcflush(PortFD, TCIOFLUSH);
292 
293  char *token = std::strtok(res, ":");
294 
295 
296  // #1 Status
297  if (token == nullptr || ((strstr(token, "OK_SCOPS") == nullptr)))
298  {
299  LOGF_ERROR("Invalid status response. %s", res);
300  return false;
301  }
302 
303  // #2 Version
304  token = std::strtok(nullptr, ":");
305 
306  if (token == nullptr)
307  {
308  LOG_ERROR("Invalid version response.");
309  return false;
310  }
311 
312  if (FirmwareVersionT[0].text == nullptr || strcmp(FirmwareVersionT[0].text, token))
313  {
314  IUSaveText(&FirmwareVersionT[0], token);
315  FirmwareVersionTP.s = IPS_OK;
316  IDSetText(&FirmwareVersionTP, nullptr);
317  }
318 
319  // #3 Motor Type
320  token = std::strtok(nullptr, ":");
321 
322  // #4 Temperature
323  token = std::strtok(nullptr, ":");
324 
325  // #5 Position
326  token = std::strtok(nullptr, ":");
327 
328  if (token == nullptr)
329  {
330  LOG_ERROR("Invalid position response.");
331  return false;
332  }
333 
334  currentPosition = atoi(token);
335  if (currentPosition != FocusAbsPosN[0].value)
336  {
337  FocusAbsPosN[0].value = currentPosition;
338  IDSetNumber(&FocusAbsPosNP, nullptr);
339  }
340 
341  // #6 Moving Status
342  token = std::strtok(nullptr, ":");
343 
344  if (token == nullptr)
345  {
346  LOG_ERROR("Invalid moving status response.");
347  return false;
348  }
349 
350  isMoving = (token[0] == '1');
351 
352  // #7 LED Status
353  token = std::strtok(nullptr, ":");
354 
355  if (token == nullptr)
356  {
357  LOG_ERROR("Invalid LED response.");
358  return false;
359  }
360 
361  int ledStatus = atoi(token);
362  if (ledStatus >= 0 && ledStatus <= 1)
363  {
364  IUResetSwitch(&LEDSP);
365  LEDS[ledStatus].s = ISS_ON;
366  LEDSP.s = IPS_OK;
367  IDSetSwitch(&LEDSP, nullptr);
368  }
369 
370  // #8 Reverse Status
371  token = std::strtok(nullptr, ":");
372 
373  // #9 Encoder status
374  token = std::strtok(nullptr, ":");
375 
376  // #10 Backlash
377  token = std::strtok(nullptr, ":");
378 
379  if (token == nullptr)
380  {
381  LOG_ERROR("Invalid encoder response.");
382  return false;
383  }
384 
385  int backlash = atoi(token);
386  // If backlash is zero then compensation is disabled
387  if (backlash == 0 && FocusBacklashS[INDI_ENABLED].s == ISS_ON)
388  {
389  LOG_WARN("Backlash value is zero, disabling backlash switch...");
390 
394  IDSetSwitch(&FocusBacklashSP, nullptr);
395  }
396  else if (backlash > 0 && (FocusBacklashS[INDI_DISABLED].s == ISS_ON || backlash != FocusBacklashN[0].value))
397  {
398  if (backlash != FocusBacklashN[0].value)
399  {
400  FocusBacklashN[0].value = backlash;
402  IDSetNumber(&FocusBacklashNP, nullptr);
403  }
404 
406  {
410  IDSetSwitch(&FocusBacklashSP, nullptr);
411  }
412  }
413 
414  return true;
415 }
416 
417 
418 bool PegasusScopsOAG::setLedEnabled(bool enable)
419 {
420  int nbytes_written = 0, rc = -1;
421  char cmd[16] = {0};
422 
423  snprintf(cmd, 16, "L:%d", enable ? 2 : 1);
424  cmd[strlen(cmd)] = 0xA;
425 
426  LOGF_DEBUG("CMD <%s>", cmd);
427 
428  tcflush(PortFD, TCIOFLUSH);
429 
430  // Led
431  if ((rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK)
432  {
433  char errstr[MAXRBUF];
434  tty_error_msg(rc, errstr, MAXRBUF);
435  LOGF_ERROR("Led error: %s.", errstr);
436  return false;
437  }
438 
439  this->ignoreResponse();
440  return true;
441 }
442 
444 {
445  targetPosition = targetTicks;
446 
447  bool rc = move(targetPosition);
448 
449  if (!rc)
450  return IPS_ALERT;
451 
453 
454  return IPS_BUSY;
455 }
456 
458 {
459  double newPosition = 0;
460  bool rc = false;
461 
462  if (dir == FOCUS_INWARD)
463  newPosition = FocusAbsPosN[0].value - ticks;
464  else
465  newPosition = FocusAbsPosN[0].value + ticks;
466 
467  rc = move(newPosition);
468 
469  if (!rc)
470  return IPS_ALERT;
471 
472  FocusRelPosN[0].value = ticks;
474 
475  return IPS_BUSY;
476 }
477 
479 {
480  if (!isConnected())
481  {
483  return;
484  }
485 
486  bool rc = updateFocusParams();
487 
488  if (rc)
489  {
491  {
492  if (isMoving == false)
493  {
496  IDSetNumber(&FocusAbsPosNP, nullptr);
497  IDSetNumber(&FocusRelPosNP, nullptr);
498  LOG_INFO("Focuser reached requested position.");
499  }
500  }
501  }
502 
504 }
505 
507 {
508  int nbytes_written;
509  char cmd[2] = { 'H', 0xA };
510 
511  if (tty_write(PortFD, cmd, 2, &nbytes_written) == TTY_OK)
512  {
515  IDSetNumber(&FocusAbsPosNP, nullptr);
516  IDSetNumber(&FocusRelPosNP, nullptr);
517  this->ignoreResponse();
518  return true;
519  }
520  else
521  return false;
522 }
523 
525 {
527  IUSaveConfigSwitch(fp, &LEDSP);
528 
529  return true;
530 }
INDI::FocuserInterface::FOCUSER_CAN_ABS_MOVE
@ FOCUSER_CAN_ABS_MOVE
Definition: indifocuserinterface.h:74
IP_RO
@ IP_RO
Definition: indiapi.h:183
INDI::FocuserInterface::FOCUSER_CAN_SYNC
@ FOCUSER_CAN_SYNC
Definition: indifocuserinterface.h:78
PegasusScopsOAG::AbortFocuser
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition: pegasus_scopsoag.cpp:506
INDI::FocuserInterface::FOCUSER_CAN_REL_MOVE
@ FOCUSER_CAN_REL_MOVE
Definition: indifocuserinterface.h:75
INDI::FocuserInterface::FocusAbsPosNP
INumberVectorProperty FocusAbsPosNP
Definition: indifocuserinterface.h:282
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
PegasusScopsOAG::PegasusScopsOAG
PegasusScopsOAG()
Definition: pegasus_scopsoag.cpp:43
PegasusScopsOAG::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: pegasus_scopsoag.cpp:54
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::FocuserInterface::FocusBacklashN
INumber FocusBacklashN[1]
Definition: indifocuserinterface.h:311
LOGF_ERROR
#define LOGF_ERROR(fmt,...)
Definition: indilogger.h:80
IPS_OK
@ IPS_OK
Definition: indiapi.h:161
_INumberVectorProperty::s
IPState s
Definition: indiapi.h:332
PegasusScopsOAG::SyncFocuser
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
Definition: pegasus_scopsoag.cpp:184
PegasusScopsOAG::Handshake
virtual bool Handshake() override
perform handshake with device to check communication
Definition: pegasus_scopsoag.cpp:118
ISS_OFF
@ ISS_OFF
Definition: indiapi.h:150
indicom.h
Implementations for common driver routines.
IDSetText
void IDSetText(const ITextVectorProperty *t, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing text vector property.
IPS_ALERT
@ IPS_ALERT
Definition: indiapi.h:163
INDI::DefaultDevice::defineProperty
void defineProperty(INumberVectorProperty *property)
Definition: defaultdevice.cpp:997
MAIN_CONTROL_TAB
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
Definition: defaultdevice.cpp:34
IUFillTextVector
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: indidriver.c:477
PegasusScopsOAG::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
Definition: pegasus_scopsoag.cpp:443
INDI::DefaultDevice::setDefaultPollingPeriod
void setDefaultPollingPeriod(uint32_t msec)
setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
Definition: defaultdevice.cpp:1157
INDI::Focuser::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
Definition: indifocuser.cpp:241
INDI::BaseDevice::getDeviceName
const char * getDeviceName() const
Definition: basedevice.cpp:799
INDI::Focuser::serialConnection
Connection::Serial * serialConnection
Definition: indifocuser.h:113
tty_read_section
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition: indicom.c:557
INDI::FocuserInterface::FOCUSER_CAN_ABORT
@ FOCUSER_CAN_ABORT
Definition: indifocuserinterface.h:76
Connection::Serial::B_19200
@ B_19200
Definition: connectionserial.h:82
IUFillText
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: indidriver.c:369
PegasusScopsOAG::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: pegasus_scopsoag.cpp:96
INDI::FocuserInterface::FocusReverseSP
ISwitchVectorProperty FocusReverseSP
Definition: indifocuserinterface.h:302
LOG_INFO
#define LOG_INFO(txt)
Definition: indilogger.h:74
MAXRBUF
#define MAXRBUF
Definition: indidriver.c:52
IUResetSwitch
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
Definition: indicom.c:1442
tty_error_msg
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Definition: indicom.c:1156
INDI::DefaultDevice::getCurrentPollingPeriod
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
Definition: defaultdevice.cpp:1139
INDI::FocuserInterface::FocusBacklashSP
ISwitchVectorProperty FocusBacklashSP
Definition: indifocuserinterface.h:306
LOGF_DEBUG
#define LOGF_DEBUG(fmt,...)
Definition: indilogger.h:83
Connection::Serial::setDefaultBaudRate
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
Definition: connectionserial.cpp:381
INDI::DefaultDevice::SetTimer
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
Definition: defaultdevice.cpp:865
INDI::Focuser::PortFD
int PortFD
Definition: indifocuser.h:116
PegasusScopsOAG::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition: pegasus_scopsoag.cpp:457
tty_write
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition: indicom.c:415
INDI::FocuserInterface::FOCUS_INWARD
@ FOCUS_INWARD
Definition: indifocuserinterface.h:68
IUFillSwitchVector
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: indidriver.c:412
INDI::BaseDevice::INDI_ENABLED
@ INDI_ENABLED
Definition: basedevice.h:64
IPS_BUSY
@ IPS_BUSY
Definition: indiapi.h:162
ISR_1OFMANY
@ ISR_1OFMANY
Definition: indiapi.h:172
connectionserial.h
IPS_IDLE
@ IPS_IDLE
Definition: indiapi.h:160
INDI::FocuserInterface::FocusRelPosN
INumber FocusRelPosN[1]
Definition: indifocuserinterface.h:287
INDI::FocuserInterface::FOCUSER_CAN_REVERSE
@ FOCUSER_CAN_REVERSE
Definition: indifocuserinterface.h:77
INDI::Focuser::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indifocuser.cpp:120
_INumberVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:322
PegasusScopsOAG::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
Definition: pegasus_scopsoag.cpp:524
IUUpdateSwitch
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
Definition: indidriver.c:171
INDI::FocuserInterface::FocusRelPosNP
INumberVectorProperty FocusRelPosNP
Definition: indifocuserinterface.h:286
_ITextVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:249
INDI::BaseDevice::isConnected
bool isConnected() const
Definition: basedevice.cpp:518
LOGF_INFO
#define LOGF_INFO(fmt,...)
Definition: indilogger.h:82
INDI::FocuserInterface::FocusBacklashS
ISwitch FocusBacklashS[2]
Definition: indifocuserinterface.h:307
LOG_ERROR
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition: indilogger.h:72
PegasusScopsOAG::getDefaultName
const char * getDefaultName() override
Definition: pegasus_scopsoag.cpp:132
INDI::FocuserInterface::SetCapability
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
Definition: indifocuserinterface.h:95
IUSaveText
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition: indicom.c:1449
name
const char * name
Definition: indiserver.c:116
_ISwitchVectorProperty::s
IPState s
Definition: indiapi.h:382
_ITextVectorProperty::s
IPState s
Definition: indiapi.h:259
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
PegasusScopsOAG
Definition: pegasus_scopsoag.h:29
IP_RW
@ IP_RW
Definition: indiapi.h:185
LOG_WARN
#define LOG_WARN(txt)
Definition: indilogger.h:73
INDI::FocuserInterface::FOCUSER_HAS_BACKLASH
@ FOCUSER_HAS_BACKLASH
Definition: indifocuserinterface.h:80
PegasusScopsOAG::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: pegasus_scopsoag.cpp:232
ISState
ISState
Switch state.
Definition: indiapi.h:148
DMFC_TIMEOUT
#define DMFC_TIMEOUT
Definition: pegasus_scopsoag.cpp:37
PegasusScopsOAG::TimerHit
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: pegasus_scopsoag.cpp:478
INDI::DefaultDevice::addDebugControl
void addDebugControl()
Add Debug control to the driver.
Definition: defaultdevice.cpp:639
IUSaveConfigSwitch
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
Definition: indicom.c:1465
INDI::Focuser::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indifocuser.cpp:58
TTY_OK
@ TTY_OK
Definition: indicom.h:94
INDI::FocuserInterface::FocusBacklashNP
INumberVectorProperty FocusBacklashNP
Definition: indifocuserinterface.h:310
INDI::DefaultDevice::deleteProperty
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
Definition: defaultdevice.cpp:965
FOCUS_SETTINGS_TAB
#define FOCUS_SETTINGS_TAB
Definition: pegasus_scopsoag.cpp:38
INDI::Focuser::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indifocuser.cpp:168
INDI::FocuserInterface::FocusAbsPosN
INumber FocusAbsPosN[1]
Definition: indifocuserinterface.h:283
IDSetNumber
void void void IDSetNumber(const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing number vector property.
IDSetSwitch
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.
IUFillSwitch
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: indidriver.c:320
pegasus_scopsoag.h
INDI::BaseDevice::INDI_DISABLED
@ INDI_DISABLED
Definition: basedevice.h:65
_ISwitchVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:370
ISS_ON
@ ISS_ON
Definition: indiapi.h:151