Instrument Neutral Distributed Interface INDI 2.2.5
lacerta_mfoc_fmc.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2023 Christian Liska. All rights reserved.
3 based on the 2018 MFOC implementation (c) Franck Le Rhun and Christian Liska
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_fmc.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_fmc.
30static std::unique_ptr<lacerta_mfoc_fmc> Lacerta_mfoc_fmc(new lacerta_mfoc_fmc());
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************************************************************************************/
49
50/************************************************************************************
51 *
52************************************************************************************/
54{
55 return "Lacerta MFOC FMC";
56}
57
58/************************************************************************************
59 *
60************************************************************************************/
62{
63 if (dev != nullptr && strcmp(dev, getDeviceName()) != 0)
64 return;
65
67
68 defineProperty(TempTrackDirSP);
69 TempTrackDirSP.load();
70
71 defineProperty(StartSavedPositionSP);
72 StartSavedPositionSP.load();
73}
74
75/************************************************************************************
76 *
77************************************************************************************/
79{
81
82 FocusBacklashNP[0].setMin(0);
83 FocusBacklashNP[0].setMax(255);
84 FocusBacklashNP[0].setStep(1);
85 FocusBacklashNP[0].setValue(12);
86
87 CurrentHoldingNP[0].fill("CURRHOLD", "holding current mA", "%4d", 0, 1200, 1, 160);
88 CurrentHoldingNP.fill(getDeviceName(), "CURRHOLD_SETTINGS", "Curr. Hold", FOCUS_TAB,
89 IP_WO, 60,
90 IPS_IDLE);
91
92 CurrentMovingNP[0].fill("CURRMOVE", "moving current mA", "%4d", 0, 1200, 1, 400);
93 CurrentMovingNP.fill(getDeviceName(), "CURRMOVE_SETTINGS", "Curr. Move", FOCUS_TAB,
94 IP_WO, 60,
95 IPS_IDLE);
96
99 FocusMaxPosNP[0].setStep((FocusMaxPosNP[0].getMax() - FocusMaxPosNP[0].getMin()) / 20.0);
100 FocusMaxPosNP[0].setValue(110000);
101
102 FocusAbsPosNP[0].setMin(0);
103 FocusAbsPosNP[0].setMax(FocusMaxPosNP[0].getValue());
104 FocusAbsPosNP[0].setStep(FocusAbsPosNP[0].getMax() / 50.0);
105
106 TempTrackDirSP[MODE_TDIR_BOTH].fill("Both", "Both", ISS_ON);
107 TempTrackDirSP[MODE_TDIR_IN].fill("In", "In", ISS_ON);
108 TempTrackDirSP[MODE_TDIR_OUT].fill("Out", "Out", ISS_ON);
109 TempTrackDirSP.fill(getDeviceName(), "Temp. dir.", "Temp. dir.",
111 ISR_1OFMANY, 60, IPS_IDLE);
112
113 StartSavedPositionSP[MODE_SAVED_ON].fill( "Yes", "Yes", ISS_ON);
114 StartSavedPositionSP[MODE_SAVED_OFF].fill("No", "No", ISS_OFF);
115 StartSavedPositionSP.fill(getDeviceName(), "Start saved pos.",
116 "Start saved pos.", MAIN_CONTROL_TAB, IP_RW,
117 ISR_1OFMANY, 60, IPS_IDLE);
118
119 return true;
120}
121
122/************************************************************************************
123 *
124************************************************************************************/
126{
127 // Get Initial Position before we define it in the INDI::Focuser class
128 FocusAbsPosNP[0].setValue(GetAbsFocuserPosition());
129
131
132 if (isConnected())
133 {
134 defineProperty(&TempCompNP);
135 defineProperty(CurrentHoldingNP);
136 defineProperty(CurrentMovingNP);
137 defineProperty(TempTrackDirSP);
138 defineProperty(StartSavedPositionSP);
139
140 }
141 else
142 {
143 deleteProperty(TempCompNP.name);
144 deleteProperty(CurrentHoldingNP);
145 deleteProperty(CurrentMovingNP);
146 deleteProperty(TempTrackDirSP);
147 deleteProperty(StartSavedPositionSP);
148 }
149
150 return true;
151}
152
153/************************************************************************************
154 *
155************************************************************************************/
157{
158 char MFOC_cmd[32] = ": q #";
159 char MFOC_res[32] = {0};
160 char MFOC_res_type[32] = "0";
161 char device[5] = "0";
162 int MFOC_pos_measd = 0;
163 int nbytes_written = 0;
164 int nbytes_read = 0;
165
166 bool device_found = false;
167 if (tty_write_string(PortFD, ": i #", &nbytes_written) == TTY_OK)
168 {
169 int count = 0;
170 do
171 {
172 try
173 {
174 if (tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read) != TTY_OK)
175 {
176 LOGF_ERROR("Unknown device or MFOC firmware not compatible with this driver version! Please update firmware! %s", device);
177 return false;
178 }
179
180 sscanf(MFOC_res, "%s %s", MFOC_res_type, device);
181 LOGF_INFO("%s", device);
182 device_found = strcmp(device, "MFOC") == 0 || strcmp(device, "FMC") == 0;
183 }
184 catch (...)
185 {
186 LOGF_ERROR("Cannot detect connected device %s", device);
187 return false;
188 }
189 count ++;
190 }
191 while (!device_found && count != 10);
192 }
193 LOGF_INFO("Device detected: %s", device);
194
195 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
196 LOGF_INFO("CMD: %s", MFOC_cmd);
197 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
198 MFOC_res[nbytes_read] = 0;
199 LOGF_DEBUG("Handshake: RES [%s]", MFOC_res);
200
201 sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_pos_measd);
202
203 if (MFOC_res_type[0] == 'p')
204 {
205 FocusAbsPosNP[0].setValue(MFOC_pos_measd);
207 return true;
208 }
209
210 return false;
211}
212
213
214/************************************************************************************
215 *
216************************************************************************************/
217bool lacerta_mfoc_fmc::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
218{
219 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
220 {
221 // Temp. Track Direction
222 if (TempTrackDirSP.isNameMatch(name))
223 {
224 TempTrackDirSP.update(states, names, n);
225 int tdir = 0;
226 int index = TempTrackDirSP.findOnSwitchIndex();
227 char MFOC_cmd[32] = ": W ";
228 char MFOC_res[32] = {0};
229 int nbytes_read = 0;
230 int nbytes_written = 0;
231 int MFOC_tdir_measd = 0;
232 char MFOC_res_type[32] = "0";
233
234 switch (index)
235 {
236 case MODE_TDIR_BOTH:
237 tdir = 0;
238 strcat(MFOC_cmd, "0 #");
239 break;
240
241 case MODE_TDIR_IN:
242 tdir = 1;
243 strcat(MFOC_cmd, "1 #");
244 break;
245
246 case MODE_TDIR_OUT:
247 tdir = 2;
248 strcat(MFOC_cmd, "2 #");
249 break;
250
251 default:
252 TempTrackDirSP.setState(IPS_ALERT);
253 LOGF_ERROR("Unknown mode index %d", index);
254 return true;
255 }
256
257
258 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
259
260 LOGF_DEBUG("ISNewSwitch: CMD [%s]", MFOC_cmd);
261 tty_write_string(PortFD, ": W #", &nbytes_written);
262 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
263 MFOC_res[nbytes_read] = 0;
264 sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tdir_measd);
265 LOGF_DEBUG("ISNewSwitch: RES [%s]", MFOC_res);
266
267 if (MFOC_tdir_measd == tdir)
268 {
269 TempTrackDirSP.setState(IPS_OK);
270 }
271 else
272 {
273 TempTrackDirSP.setState(IPS_ALERT);
274 }
275
276 TempTrackDirSP.apply();
277 return true;
278 }
279
280 // Start at saved position
281 if (StartSavedPositionSP.isNameMatch(name))
282 {
283 StartSavedPositionSP.update(states, names, n);
284 int svstart = 0;
285 int index = StartSavedPositionSP.findOnSwitchIndex();
286 char MFOC_cmd[32] = ": N ";
287 char MFOC_res[32] = {0};
288 int nbytes_read = 0;
289 int nbytes_written = 0;
290 int MFOC_svstart_measd = 0;
291 char MFOC_res_type[32] = "0";
292
293 switch (index)
294 {
295 case MODE_SAVED_ON:
296 svstart = 1;
297 strcat(MFOC_cmd, "1 #");
298 break;
299
300 case MODE_SAVED_OFF:
301 svstart = 0;
302 strcat(MFOC_cmd, "0 #");
303 break;
304
305 default:
306 StartSavedPositionSP.setState(IPS_ALERT);
307 LOGF_ERROR("Unknown mode index %d", index);
308 return true;
309 }
310
311 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
312
313 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
314 tty_write_string(PortFD, ": N #", &nbytes_written);
315 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
316 MFOC_res[nbytes_read] = 0;
317 sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_svstart_measd);
318
319 LOGF_DEBUG("RES [%s]", MFOC_res);
320 if (MFOC_svstart_measd == svstart)
321 {
322 StartSavedPositionSP.setState(IPS_OK);
323 }
324 else
325 {
326 StartSavedPositionSP.setState(IPS_ALERT);
327 }
328
329 StartSavedPositionSP.apply();
330 return true;
331 }
332 }
333
334 return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
335}
336
337bool lacerta_mfoc_fmc::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
338{
339 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
340 {
341 if (strcmp(name, "TEMPCOMP_SETTINGS") == 0)
342 {
343 return SetTempComp(values, names, n);
344 }
345
346 if (strcmp(name, "CURRHOLD_SETTINGS") == 0)
347 {
348 CurrentHoldingNP.update(values, names, n);
349 if (!SetCurrHold(CurrentHoldingNP[0].getValue()))
350 {
351 CurrentHoldingNP.setState(IPS_ALERT);
352 CurrentHoldingNP.apply();
353 return false;
354 }
355 CurrentHoldingNP.setState(IPS_OK);
356 CurrentHoldingNP.apply();
357 return true;
358 }
359
360 if (strcmp(name, "CURRMOVE_SETTINGS") == 0)
361 {
362 CurrentMovingNP.update(values, names, n);
363 if (!SetCurrMove(CurrentMovingNP[0].getValue()))
364 {
365 CurrentMovingNP.setState(IPS_ALERT);
366 CurrentMovingNP.apply();
367 return false;
368 }
369 CurrentMovingNP.setState(IPS_OK);
370 CurrentMovingNP.apply();
371 return true;
372 }
373 }
374
375 // Let INDI::Focuser handle any other number properties
376 return INDI::Focuser::ISNewNumber(dev, name, values, names, n);
377}
378
379/************************************************************************************
380 *
381************************************************************************************/
383{
384 char MFOC_cmd[32] = ": B ";
385 char MFOC_res[32] = {0};
386 int nbytes_read = 0;
387 int nbytes_written = 0;
388 int MFOC_tdir_measd = 0;
389 char bl_char[32] = {0};
390 char MFOC_res_type[32] = "0";
391
392 sprintf(bl_char, "%d", steps);
393 strcat(bl_char, " #");
394 strcat(MFOC_cmd, bl_char);
395
396 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
397 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
398
399 tty_write_string(PortFD, ": b #", &nbytes_written);
400 do
401 {
402 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
403 MFOC_res[nbytes_read] = 0;
404 sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tdir_measd);
405 }
406 while(strcmp("b", MFOC_res_type) != 0);
407 LOGF_DEBUG("RES [%s]", MFOC_res);
408
409 return true;
410}
411
412bool lacerta_mfoc_fmc::SetCurrHold(int currHoldValue)
413{
414 char MFOC_cmd[32] = ": E ";
415 char MFOC_res[32] = {0};
416 int nbytes_read = 0;
417 int nbytes_written = 0;
418 int MFOC_ch_measd = 0;
419 char ch_char[32] = {0};
420 char MFOC_res_type[32] = "0";
421
422 sprintf(ch_char, "%d", currHoldValue);
423 strcat(ch_char, " #");
424 strcat(MFOC_cmd, ch_char);
425
426 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
427 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
428
429 do
430 {
431 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
432 sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_ch_measd);
433 MFOC_res[nbytes_read] = 0;
434 }
435 while(strcmp("e", MFOC_res_type) != 0);
436
437 LOGF_DEBUG("RES [%s]", MFOC_res);
438 LOGF_INFO("Holding Current set to %d mA", MFOC_ch_measd);
439
440 return true;
441}
442
443bool lacerta_mfoc_fmc::SetCurrMove(int currMoveValue)
444{
445 char MFOC_cmd[32] = ": F ";
446 char MFOC_res[32] = {0};
447 int nbytes_read = 0;
448 int nbytes_written = 0;
449 int MFOC_cm_measd = 0;
450 char cm_char[32] = {0};
451 char MFOC_res_type[32] = "0";
452
453 sprintf(cm_char, "%d", currMoveValue);
454 strcat(cm_char, " #");
455 strcat(MFOC_cmd, cm_char);
456
457 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
458 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
459
460 do
461 {
462 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
463 sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_cm_measd);
464 MFOC_res[nbytes_read] = 0;
465 }
466 while(strcmp("f", MFOC_res_type) != 0);
467
468 LOGF_DEBUG("RES [%s]", MFOC_res);
469 LOGF_INFO("Moving Current set to %d mA", MFOC_cm_measd);
470
471 return true;
472}
473
474bool lacerta_mfoc_fmc::SetTempComp(double values[], char *names[], int n)
475{
476 char MFOC_cmd[32] = ": U ";
477 char MFOC_res[32] = {0};
478 int nbytes_read = 0;
479 int nbytes_written = 0;
480 int MFOC_tc_measd = 0;
481 int tc_int = 0;
482 char tc_char[32] = {0};
483 char MFOC_res_type[32] = "0";
484
485 TempCompNP.s = IPS_OK;
486 IUUpdateNumber(&TempCompNP, values, names, n);
487 tc_int = TempCompN[0].value;
488 sprintf(tc_char, "%d", tc_int);
489 strcat(tc_char, " #");
490 strcat(MFOC_cmd, tc_char);
491
492 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
493 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
494
495 tty_write_string(PortFD, ": u #", &nbytes_written);
496 do
497 {
498 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
499 MFOC_res[nbytes_read] = 0;
500 sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tc_measd);
501 }
502 while(strcmp("u", MFOC_res_type) != 0);
503 LOGF_DEBUG("RES [%s]", MFOC_res);
504
505 IDSetNumber(&TempCompNP, nullptr);
506
507 return true;
508}
509
511{
512 char MFOC_cmd[32] = ": G ";
513 char MFOC_res[32] = {0};
514 int nbytes_read = 0;
515 int nbytes_written = 0;
516 int MFOC_pm_measd = 0;
517 char pm_char[32] = {0};
518 char MFOC_res_type[32] = "0";
519
520 sprintf(pm_char, "%d", ticks);
521 strcat(pm_char, " #");
522 strcat(MFOC_cmd, pm_char);
523
524 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
525 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
526 IgnoreButLogResponse();
527
528 tty_write_string(PortFD, ": g #", &nbytes_written);
529 do
530 {
531 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
532 MFOC_res[nbytes_read] = 0;
533 sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_pm_measd);
534 }
535 while (strcmp("g", MFOC_res_type) != 0);
536 LOGF_DEBUG("RES [%s]", MFOC_res);
537
538 return true;
539}
540
541/************************************************************************************
542 *
543************************************************************************************/
545{
546 char MFOC_cmd[32] = ": M ";
547 char abs_pos_char[32] = {0};
548 int nbytes_written = 0;
549
550 //int pos = GetAbsFocuserPosition();
551 sprintf(abs_pos_char, "%d", targetTicks);
552 strcat(abs_pos_char, " #");
553 strcat(MFOC_cmd, abs_pos_char);
554
555 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
556 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
557 IgnoreButLogResponse();
558
559 FocusAbsPosNP[0].setValue(targetTicks);
560
561 GetAbsFocuserPosition();
562
563 return IPS_OK;
564}
565
566/************************************************************************************
567 *
568************************************************************************************/
570{
571 // Calculation of the demand absolute position
572 auto targetTicks = FocusAbsPosNP[0].getValue();
573 if (dir == FOCUS_INWARD) targetTicks -= ticks;
574 else targetTicks += ticks;
575 targetTicks = std::clamp(targetTicks, FocusAbsPosNP[0].getMin(), FocusAbsPosNP[0].getMax());
576
579
580 return MoveAbsFocuser(targetTicks);
581}
582
583/************************************************************************************
584 *
585************************************************************************************/
587{
588 char MFOC_cmd[32] = ": P ";
589 char sync_pos[8] = {0};
590
591 int nbytes_written = 0;
592
593 sprintf(sync_pos, "%d", ticks);
594 strcat(sync_pos, " #");
595 strcat(MFOC_cmd, sync_pos);
596
597 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
598 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
599 IgnoreButLogResponse();
600
601 return true;
602}
603
604/************************************************************************************
605 *
606************************************************************************************/
608{
609 char MFOC_cmd[32] = ": H #";
610 char MFOC_res[32] = {0};
611 char MFOC_res_type[32] = "0";
612 int nbytes_read = 0;
613 int nbytes_written = 0;
614 int halt_flag = 0;
615
616 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
617
618 if (tty_write_string(PortFD, MFOC_cmd, &nbytes_written) == TTY_OK)
619 {
620
621 int count = 0;
622 do
623 {
624 count ++;
625 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
626 MFOC_res[nbytes_read] = 0;
627 sscanf (MFOC_res, "%s %d", MFOC_res_type, &halt_flag);
628 }
629 while(strcmp(MFOC_res_type, "H") != 0 && count <= 100);
630
631 FocusAbsPosNP[0].setValue(GetAbsFocuserPosition());
633 return true;
634 }
635 else
636 return false;
637
638}
639
640/************************************************************************************
641 *
642************************************************************************************/
644{
645 LOGF_DEBUG("saveConfigItems()", 0);
646 // Save Focuser Config
648
649 // Save additional MFPC Config
650 IUSaveConfigNumber(fp, &TempCompNP);
651 CurrentHoldingNP.save(fp);
652 CurrentMovingNP.save(fp);
653
654 return true;
655}
656
657uint32_t lacerta_mfoc_fmc::GetAbsFocuserPosition()
658{
659 char MFOC_cmd[32] = ": q #";
660 char MFOC_res[32] = {0};
661 char MFOC_res_type[32] = "0";
662 int MFOC_pos_measd = 0;
663
664 int nbytes_written = 0;
665 int nbytes_read = 0;
666 int count = 0;
667
668 tty_write_string(PortFD, MFOC_cmd, &nbytes_written);
669 LOGF_DEBUG("CMD [%s]", MFOC_cmd);
670
671 do
672 {
673 tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);
674 sscanf(MFOC_res, "%s %d", MFOC_res_type, &MFOC_pos_measd);
675 count++;
676 }
677 while(strcmp(MFOC_res_type, "p") != 0 && count < 100);
678
679 return static_cast<uint32_t>(MFOC_pos_measd);
680}
681
682void lacerta_mfoc_fmc::IgnoreResponse()
683{
684 int nbytes_read = 0;
685 char MFOC_res[64];
686 tty_read_section(PortFD, MFOC_res, 0xA, FOCUSMFOC_TIMEOUT, &nbytes_read);
687}
688
689void lacerta_mfoc_fmc::IgnoreButLogResponse()
690{
691 int nbytes_read = 0;
692 char MFOC_res[64];
693 tty_read_section(PortFD, MFOC_res, 0xA, FOCUSMFOC_TIMEOUT, &nbytes_read);
694 MFOC_res[nbytes_read] = 0;
695 LOGF_DEBUG("*RES [%s]", MFOC_res);
696}
697
hid_device * device
bool isConnected() const
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
INDI::PropertyNumber FocusMaxPosNP
INDI::PropertyNumber FocusBacklashNP
INDI::PropertyNumber FocusAbsPosNP
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
virtual bool saveConfigItems(FILE *fp) override
virtual void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool load()
load Attempt to load property values from configuration file.
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const ISState states[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool saveConfigItems(FILE *fp) override
const char * getDefaultName() override
bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser 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_WO
Definition indiapi.h:183
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_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition indicom.c:653
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition indicom.c:473
Implementations for common driver routines.
@ TTY_OK
Definition indicom.h:54
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition indidevapi.c:23
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
#define LOGF_INFO(fmt,...)
Definition indilogger.h:82
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define getDeviceName
#define MFOC_POSMAX_HARDWARE
#define FOCUSMFOC_TIMEOUT
#define MFOC_POSMIN_HARDWARE
char name[MAXINDINAME]
Definition indiapi.h:321