Instrument Neutral Distributed Interface INDI  1.9.5
lacerta_mfoc.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2018 Franck Le Rhun. All rights reserved.
3  Copyright(c) 2018 Christian Liska. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8  .
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13  .
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 *******************************************************************************/
19 
20 #include "lacerta_mfoc.h"
21 #include "indicom.h"
23 
24 #include <cmath>
25 #include <memory>
26 #include <cstring>
27 #include <unistd.h>
28 
29 // We declare an auto pointer to lacerta_mfoc.
30 static std::unique_ptr<lacerta_mfoc> Lacerta_mfoc(new lacerta_mfoc());
31 
32 // Delay for receiving messages
33 #define FOCUSMFOC_TIMEOUT 1000
34 // According to documentation for v2
35 #define MFOC_POSMAX_HARDWARE 250000
36 #define MFOC_POSMIN_HARDWARE 300
37 
38 /************************************************************************************
39  *
40 ************************************************************************************/
42 {
44 }
45 
46 /************************************************************************************
47  *
48 ************************************************************************************/
50 {
51  return "Lacerta MFOC";
52 }
53 
54 /************************************************************************************
55  *
56 ************************************************************************************/
57 void lacerta_mfoc::ISGetProperties(const char *dev)
58 {
59  if (dev != nullptr && strcmp(dev, getDeviceName()) != 0)
60  return;
61 
63 
64  defineProperty(&TempTrackDirSP);
65  loadConfig(true, TempTrackDirSP.name);
66 
67  defineProperty(&StartSavedPositionSP);
68  loadConfig(true, StartSavedPositionSP.name);
69 }
70 
71 /************************************************************************************
72  *
73 ************************************************************************************/
75 {
77 
78  FocusBacklashN[0].min = 0;
79  FocusBacklashN[0].max = 255;
80  FocusBacklashN[0].step = 1;
81  FocusBacklashN[0].value = 12;
82 
83  // IUFillNumber(&BacklashN[0], "BACKLASH", "step", "%4.2f", 0, 255, 1, 12);
84  // IUFillNumberVector(&BacklashNP, BacklashN, 1, getDeviceName(), "BACKLASH_SETTINGS", "Backlash", MAIN_CONTROL_TAB, IP_RW, 60,
85  // IPS_IDLE);
86 
87  IUFillNumber(&TempCompN[0], "TEMPCOMP", "step/10 degC", "%4.2f", -5000, 5000, 1, 65);
88  IUFillNumberVector(&TempCompNP, TempCompN, 1, getDeviceName(), "TEMPCOMP_SETTINGS", "T Comp.", MAIN_CONTROL_TAB, IP_RW, 60,
89  IPS_IDLE);
90 
93  FocusMaxPosN[0].step = (FocusMaxPosN[0].max - FocusMaxPosN[0].min) / 20.0;
94  FocusMaxPosN[0].value = 110000;
95 
96  FocusAbsPosN[0].min = 0;
97  FocusAbsPosN[0].max = FocusMaxPosN[0].value;
98  FocusAbsPosN[0].step = FocusAbsPosN[0].max / 50.0;
99 
100  IUFillSwitch(&TempTrackDirS[MODE_TDIR_BOTH], "Both", "Both", ISS_ON);
101  IUFillSwitch(&TempTrackDirS[MODE_TDIR_IN], "In", "In", ISS_ON);
102  IUFillSwitch(&TempTrackDirS[MODE_TDIR_OUT], "Out", "Out", ISS_ON);
103  IUFillSwitchVector(&TempTrackDirSP, TempTrackDirS, MODE_COUNT_TEMP_DIR, getDeviceName(), "Temp. dir.", "Temp. dir.", MAIN_CONTROL_TAB, IP_RW,
104  ISR_1OFMANY, 60, IPS_IDLE);
105 
106  IUFillSwitch(&StartSavedPositionS[MODE_SAVED_ON], "Yes", "Yes", ISS_ON);
107  IUFillSwitch(&StartSavedPositionS[MODE_SAVED_OFF], "No", "No", ISS_OFF);
108  IUFillSwitchVector(&StartSavedPositionSP, StartSavedPositionS, MODE_COUNT_SAVED, getDeviceName(), "Start saved pos.", "Start saved pos.", MAIN_CONTROL_TAB, IP_RW,
109  ISR_1OFMANY, 60, IPS_IDLE);
110 
111  return true;
112 }
113 
114 /************************************************************************************
115  *
116 ************************************************************************************/
118 {
119  // Get Initial Position before we define it in the INDI::Focuser class
120  FocusAbsPosN[0].value = GetAbsFocuserPosition();
121 
123 
124  if (isConnected())
125  {
126  //defineProperty(&BacklashNP);
127  defineProperty(&TempCompNP);
128  defineProperty(&TempTrackDirSP);
129  defineProperty(&StartSavedPositionSP);
130 
131  }
132  else
133  {
134  //deleteProperty(BacklashNP.name);
135  deleteProperty(TempCompNP.name);
136  deleteProperty(TempTrackDirSP.name);
137  deleteProperty(StartSavedPositionSP.name);
138  }
139 
140  return true;
141 }
142 
143 /************************************************************************************
144  *
145 ************************************************************************************/
147 {
148  char MFOC_cmd[32] = ": Q #";
149  char MFOC_res[32] = {0};
150  char MFOC_res_type[32] = "0";
151  int MFOC_pos_measd = 0;
152  int nbytes_written = 0;
153  int nbytes_read = 0;
154 
155 
156  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
157  LOGF_INFO("CMD <%s>", MFOC_cmd);
158  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
159  LOGF_DEBUG("RES <%s>", MFOC_res_type);
160 
161  sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_pos_measd);
162 
163  if (MFOC_res_type[0] == 'P')
164  {
165  FocusAbsPosN[0].value = MFOC_pos_measd;
167  return true;
168  }
169 
170  return false;
171 }
172 
173 /************************************************************************************
174  *
175 ************************************************************************************/
176 bool lacerta_mfoc::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
177 {
178  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
179  {
180  // Temp. Track Direction
181  if (strcmp(TempTrackDirSP.name, name) == 0)
182  {
183  IUUpdateSwitch(&TempTrackDirSP, states, names, n);
184  int tdir = 0;
185  int index = IUFindOnSwitchIndex(&TempTrackDirSP);
186  char MFOC_cmd[32] = ": I ";
187  char MFOC_res[32] = {0};
188  int nbytes_read = 0;
189  int nbytes_written = 0;
190  int MFOC_tdir_measd = 0;
191  char MFOC_res_type[32] = "0";
192 
193  switch (index)
194  {
195  case MODE_TDIR_BOTH:
196  tdir = 0;
197  strcat(MFOC_cmd, "0 #");
198  break;
199 
200  case MODE_TDIR_IN:
201  tdir = 1;
202  strcat(MFOC_cmd, "1 #");
203  break;
204 
205  case MODE_TDIR_OUT:
206  tdir = 2;
207  strcat(MFOC_cmd, "2 #");
208  break;
209 
210  default:
211  TempTrackDirSP.s = IPS_ALERT;
212  IDSetSwitch(&TempTrackDirSP, "Unknown mode index %d", index);
213  return true;
214  }
215 
216 
217  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
218  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
219  tty_write_string(PortFD, ": W #", &nbytes_written);
220  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
221  sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tdir_measd);
222  LOGF_DEBUG("RES <%s>", MFOC_res);
223 
224  if (MFOC_tdir_measd == tdir)
225  {
226  TempTrackDirSP.s = IPS_OK;
227  }
228  else
229  {
230  TempTrackDirSP.s = IPS_ALERT;
231  }
232 
233  IDSetSwitch(&TempTrackDirSP, nullptr);
234  return true;
235  }
236 
237 
238  // Start at saved position
239  if (strcmp(StartSavedPositionSP.name, name) == 0)
240  {
241  IUUpdateSwitch(&StartSavedPositionSP, states, names, n);
242  int svstart = 0;
243  int index = IUFindOnSwitchIndex(&StartSavedPositionSP);
244  char MFOC_cmd[32] = ": F ";
245  char MFOC_res[32] = {0};
246  int nbytes_read = 0;
247  int nbytes_written = 0;
248  int MFOC_svstart_measd = 0;
249  char MFOC_res_type[32] = "0";
250 
251  switch (index)
252  {
253  case MODE_SAVED_ON:
254  svstart = 1;
255  strcat(MFOC_cmd, "1 #");
256  break;
257 
258  case MODE_SAVED_OFF:
259  svstart = 0;
260  strcat(MFOC_cmd, "0 #");
261  break;
262 
263  default:
264  StartSavedPositionSP.s = IPS_ALERT;
265  IDSetSwitch(&StartSavedPositionSP, "Unknown mode index %d", index);
266  return true;
267  }
268 
269  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
270  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
271  tty_write_string(PortFD, ": N #", &nbytes_written);
272  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
273  sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_svstart_measd);
274 
275  LOGF_DEBUG("RES <%s>", MFOC_res);
276  // LOGF_DEBUG("Debug MFOC cmd sent %s", MFOC_cmd);
277  if (MFOC_svstart_measd == svstart)
278  {
279  StartSavedPositionSP.s = IPS_OK;
280  }
281  else
282  {
283  StartSavedPositionSP.s = IPS_ALERT;
284  }
285 
286  IDSetSwitch(&StartSavedPositionSP, nullptr);
287  return true;
288  }
289  }
290 
291  return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
292 }
293 
294 bool lacerta_mfoc::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
295 {
296  if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
297  {
298  // if (strcmp(name, "BACKLASH_SETTINGS") == 0)
299  // {
300  // return SetBacklash(values, names, n);
301  // }
302 
303 
304  if (strcmp(name, "TEMPCOMP_SETTINGS") == 0)
305  {
306  return SetTempComp(values, names, n);
307  }
308  }
309 
310  // Let INDI::Focuser handle any other number properties
311  return INDI::Focuser::ISNewNumber(dev, name, values, names, n);
312 }
313 
314 /************************************************************************************
315  *
316 ************************************************************************************/
317 //bool lacerta_mfoc::SetBacklash(double values[], char *names[], int n)
319 {
320  LOGF_DEBUG("-> BACKLASH_SETTINGS", 0);
321  char MFOC_cmd[32] = ": B ";
322  char MFOC_res[32] = {0};
323  int nbytes_read = 0;
324  int nbytes_written = 0;
325  int MFOC_tdir_measd = 0;
326  //int bl_int = 0;
327  char bl_char[32] = {0};
328  char MFOC_res_type[32] = "0";
329  // BacklashNP.s = IPS_OK;
330  // IUUpdateNumber(&BacklashNP, values, names, n);
331  // bl_int = BacklashN[0].value;
332  sprintf(bl_char, "%d", steps);
333  strcat(bl_char, " #");
334  strcat(MFOC_cmd, bl_char);
335 
336  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
337  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
338  tty_write_string(PortFD, ": J #", &nbytes_written);
339 
340  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
341 
342  sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tdir_measd);
343 
344  LOGF_DEBUG("RES <%s>", MFOC_res);
345 
346  //IDSetNumber(&BacklashNP, nullptr);
347 
348  return true;
349 }
350 
351 bool lacerta_mfoc::SetTempComp(double values[], char *names[], int n)
352 {
353  LOGF_INFO("-> TEMPCOMP_SETTINGS", 0);
354  char MFOC_cmd[32] = ": D ";
355  char MFOC_res[32] = {0};
356  int nbytes_read = 0;
357  int nbytes_written = 0;
358  int MFOC_tc_measd = 0;
359  int tc_int = 0;
360  char tc_char[32] = {0};
361  char MFOC_res_type[32] = "0";
362  TempCompNP.s = IPS_OK;
363  IUUpdateNumber(&TempCompNP, values, names, n);
364  tc_int = TempCompN[0].value;
365  sprintf(tc_char, "%d", tc_int);
366  strcat(tc_char, " #");
367  strcat(MFOC_cmd, tc_char);
368 
369  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
370  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
371  tty_write_string(PortFD, ": U #", &nbytes_written);
372 
373  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
374 
375  sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tc_measd);
376 
377  LOGF_DEBUG("RES <%s>", MFOC_res);
378 
379  IDSetNumber(&TempCompNP, nullptr);
380 
381  return true;
382 }
383 
385 {
386  char MFOC_cmd[32] = ": G ";
387  char MFOC_res[32] = {0};
388  int nbytes_read = 0;
389  int nbytes_written = 0;
390  int MFOC_pm_measd = 0;
391  char pm_char[32] = {0};
392  char MFOC_res_type[32] = "0";
393 
394  sprintf(pm_char, "%d", ticks);
395  strcat(pm_char, " #");
396  strcat(MFOC_cmd, pm_char);
397 
398  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
399  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
400  tty_write_string(PortFD, ": O #", &nbytes_written);
401 
402  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
403 
404  sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_pm_measd);
405 
406  LOGF_DEBUG("RES <%s>", MFOC_res);
407  return true;
408 }
409 
410 /************************************************************************************
411  *
412 ************************************************************************************/
414 {
415  char MFOC_cmd[32] = ": M ";
416  char abs_pos_char[32] = {0};
417  int nbytes_written = 0;
418 
419  //int pos = GetAbsFocuserPosition();
420  sprintf(abs_pos_char, "%d", targetTicks);
421  strcat(abs_pos_char, " #");
422  strcat(MFOC_cmd, abs_pos_char);
423 
424  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
425  LOGF_DEBUG("CMD <%s>", MFOC_cmd);
426 
427  //Waiting makes no sense - will be immediatly interrupted by the ekos system...
428  //int ticks = std::abs((int)(targetTicks - pos) * FOCUS_MOTION_DELAY);
429  //LOGF_INFO("sleep for %d ms", ticks);
430  //usleep(ticks + 5000);
431 
432  FocusAbsPosN[0].value = targetTicks;
433 
434  //only for debugging! Maybe there is a bug in the MFOC firmware command "Q #"!
435  GetAbsFocuserPosition();
436 
437  return IPS_OK;
438 }
439 
440 /************************************************************************************
441  *
442 ************************************************************************************/
444 {
445  // Calculation of the demand absolute position
446  uint32_t targetTicks = FocusAbsPosN[0].value + (ticks * (dir == FOCUS_INWARD ? -1 : 1));
448  IDSetNumber(&FocusAbsPosNP, nullptr);
449 
450  return MoveAbsFocuser(targetTicks);
451 }
452 
453 
455 {
456  // Save Focuser Config
458 
459  // Save additional MFPC Config
460  //IUSaveConfigNumber(fp, &BacklashNP);
461  IUSaveConfigNumber(fp, &TempCompNP);
462 
463  return true;
464 }
465 
466 uint32_t lacerta_mfoc::GetAbsFocuserPosition()
467 {
468  char MFOC_cmd[32] = ": Q #";
469  char MFOC_res[32] = {0};
470  char MFOC_res_type[32] = "0";
471  int MFOC_pos_measd = 0;
472 
473  int nbytes_written = 0;
474  int nbytes_read = 0;
475 
476  do
477  {
478  tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
479  LOGF_INFO("CMD <%s>", MFOC_cmd);
480  tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
481  sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_pos_measd);
482  }
483  while(strcmp(MFOC_res_type, "P") != 0);
484 
485  LOGF_DEBUG("RES <%s>", MFOC_res_type);
486  LOGF_DEBUG("current position: %d", MFOC_pos_measd);
487 
488  return static_cast<uint32_t>(MFOC_pos_measd);
489 }
INDI::FocuserInterface::FOCUSER_CAN_ABS_MOVE
@ FOCUSER_CAN_ABS_MOVE
Definition: indifocuserinterface.h:74
lacerta_mfoc
Definition: lacerta_mfoc.h:24
INDI::FocuserInterface::FOCUSER_CAN_REL_MOVE
@ FOCUSER_CAN_REL_MOVE
Definition: indifocuserinterface.h:75
INDI::FocuserInterface::FocusAbsPosNP
INumberVectorProperty FocusAbsPosNP
Definition: indifocuserinterface.h:282
lacerta_mfoc::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
Definition: lacerta_mfoc.cpp:413
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::FocuserInterface::FocusBacklashN
INumber FocusBacklashN[1]
Definition: indifocuserinterface.h:311
IPS_OK
@ IPS_OK
Definition: indiapi.h:161
_INumberVectorProperty::s
IPState s
Definition: indiapi.h:332
MFOC_POSMAX_HARDWARE
#define MFOC_POSMAX_HARDWARE
Definition: lacerta_mfoc.cpp:35
lacerta_mfoc::initProperties
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: lacerta_mfoc.cpp:74
ISS_OFF
@ ISS_OFF
Definition: indiapi.h:150
indicom.h
Implementations for common driver routines.
INDI::Focuser::ISGetProperties
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: indifocuser.cpp:111
IPS_ALERT
@ IPS_ALERT
Definition: indiapi.h:163
IUFillNumber
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: indidriver.c:348
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
lacerta_mfoc::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: lacerta_mfoc.cpp:176
lacerta_mfoc::updateProperties
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: lacerta_mfoc.cpp:117
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
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
IUSaveConfigNumber
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition: indicom.c:1455
LOGF_DEBUG
#define LOGF_DEBUG(fmt,...)
Definition: indilogger.h:83
lacerta_mfoc::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition: lacerta_mfoc.cpp:443
INDI::Focuser::PortFD
int PortFD
Definition: indifocuser.h:116
MFOC_POSMIN_HARDWARE
#define MFOC_POSMIN_HARDWARE
Definition: lacerta_mfoc.cpp:36
lacerta_mfoc::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
Definition: lacerta_mfoc.cpp:454
INDI::FocuserInterface::FOCUS_INWARD
@ FOCUS_INWARD
Definition: indifocuserinterface.h:68
lacerta_mfoc::lacerta_mfoc
lacerta_mfoc()
Definition: lacerta_mfoc.cpp:41
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
IUFillNumberVector
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: indidriver.c:455
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::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
INDI::DefaultDevice::loadConfig
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
Definition: defaultdevice.cpp:147
IUUpdateSwitch
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
Definition: indidriver.c:171
FOCUSMFOC_TIMEOUT
#define FOCUSMFOC_TIMEOUT
Definition: lacerta_mfoc.cpp:33
INDI::BaseDevice::isConnected
bool isConnected() const
Definition: basedevice.cpp:518
LOGF_INFO
#define LOGF_INFO(fmt,...)
Definition: indilogger.h:82
INDI::FocuserInterface::SetCapability
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
Definition: indifocuserinterface.h:95
lacerta_mfoc::Handshake
virtual bool Handshake() override
perform handshake with device to check communication
Definition: lacerta_mfoc.cpp:146
name
const char * name
Definition: indiserver.c:116
_ISwitchVectorProperty::s
IPState s
Definition: indiapi.h:382
INDI::FocuserInterface::FocusMaxPosN
INumber FocusMaxPosN[1]
Definition: indifocuserinterface.h:291
IUUpdateNumber
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
Definition: indidriver.c:225
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
IP_RW
@ IP_RW
Definition: indiapi.h:185
INDI::FocuserInterface::FOCUSER_HAS_BACKLASH
@ FOCUSER_HAS_BACKLASH
Definition: indifocuserinterface.h:80
lacerta_mfoc::getDefaultName
const char * getDefaultName() override
Definition: lacerta_mfoc.cpp:49
ISState
ISState
Switch state.
Definition: indiapi.h:148
lacerta_mfoc::SetFocuserBacklash
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
Definition: lacerta_mfoc.cpp:318
IUFindOnSwitchIndex
int IUFindOnSwitchIndex(const ISwitchVectorProperty *sp)
Returns the index of first ON switch it finds in the vector switch property.
Definition: indicom.c:1424
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_write_string
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition: indicom.c:465
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
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.
lacerta_mfoc::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: lacerta_mfoc.cpp:294
lacerta_mfoc.h
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
lacerta_mfoc::ISGetProperties
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: lacerta_mfoc.cpp:57
INDI::Focuser::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indifocuser.cpp:145
lacerta_mfoc::SetFocuserMaxPosition
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
Definition: lacerta_mfoc.cpp:384
_ISwitchVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:370
ISS_ON
@ ISS_ON
Definition: indiapi.h:151