Instrument Neutral Distributed Interface INDI 2.2.5
pegasus_focuscube3.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2023 Chrysikos Efstathios. All rights reserved.
3
4 Pegasus FocusCube
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#include "pegasus_focuscube3.h"
25
26#include "indicom.h"
29
30#include <cmath>
31#include <cstring>
32#include <memory>
33#include <regex>
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
41static std::unique_ptr<PegasusFocusCube3> focusCube(new PegasusFocusCube3());
42
43
45{
46 setVersion(1, 2);
47 // Can move in Absolute & Relative motions, can AbortFocuser motion.
54}
55
56
58{
59 int tty_rc = 0, nbytes_written = 0, nbytes_read = 0;
60 char command[PEGASUS_LEN] = {0}, response[PEGASUS_LEN] = {0};
61 // Over TCP, log in with the hotspot password before any command.
62 const bool tcp = getActiveConnection() == tcpConnection;
63 PortFD = tcp ? tcpConnection->getPortFD() : serialConnection->getPortFD();
64 if (tcp && !wifi.login(PortFD))
65 return false;
66
67 LOG_DEBUG("CMD <##>");
68
69
70
71
72 tcflush(PortFD, TCIOFLUSH);
73 strncpy(command, "##\r\n", PEGASUS_LEN);
74 if ( (tty_rc = tty_write_string(PortFD, command, &nbytes_written)) != TTY_OK)
75 {
76 char errorMessage[MAXRBUF];
77 tty_error_msg(tty_rc, errorMessage, MAXRBUF);
78 LOGF_ERROR("Serial write error: %s", errorMessage);
79 return false;
80 }
81
82 // Try first with stopChar as the stop character
83 if ( (tty_rc = tty_nread_section(PortFD, response, PEGASUS_LEN, stopChar, 1, &nbytes_read)) != TTY_OK)
84 {
85 // Try 0xA as the stop character
86 if (tty_rc == TTY_OVERFLOW || tty_rc == TTY_TIME_OUT)
87 {
88 tcflush(PortFD, TCIOFLUSH);
89 tty_write_string(PortFD, command, &nbytes_written);
90 stopChar = 0xA;
91 tty_rc = tty_nread_section(PortFD, response, PEGASUS_LEN, stopChar, 1, &nbytes_read);
92 }
93
94 if (tty_rc != TTY_OK)
95 {
96 char errorMessage[MAXRBUF];
97 tty_error_msg(tty_rc, errorMessage, MAXRBUF);
98 LOGF_ERROR("Serial read error: %s", errorMessage);
99 return false;
100 }
101 }
102
103 tcflush(PortFD, TCIOFLUSH);
104 response[nbytes_read - 1] = '\0';
105 LOGF_DEBUG("RES <%s>", response);
106
107 setupComplete = false;
108
109 return (strstr(response, "FC3") != nullptr);
110}
111
113{
114 return "Pegasus FocusCube3";
115}
116
118{
120
121 TemperatureNP[0].fill("TEMPERATURE", "Level", "%.0f", -40, 40, 1, 0);
122 TemperatureNP.fill(getDeviceName(), "FOCUS_TEMPERATURE", "Temperature", FOCUS_SETTINGS_TAB, IP_RO, 60, IPS_IDLE);
123
124 FirmwareVersionTP[0].fill("Version", "Version", "");
125 FirmwareVersionTP.fill(getDeviceName(), "Firmware", "Firmware", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);
126
127 SpeedNP[0].fill("Speed", "Value", "%6.2f", 100, 1000., 100., 400.);
128 SpeedNP.fill(getDeviceName(), "MaxSpeed", "", FOCUS_SETTINGS_TAB, IP_RW, 0, IPS_IDLE);
129
130 // Relative and absolute movement
131 FocusRelPosNP[0].setMin(0.);
132 FocusRelPosNP[0].setMax(50000.);
133 FocusRelPosNP[0].setValue(0);
134 FocusRelPosNP[0].setStep(1000);
135
136 FocusAbsPosNP[0].setMin(0.);
137 FocusAbsPosNP[0].setValue(0);
138 FocusAbsPosNP[0].setStep(1000);
139
140 // Backlash compensation
141 FocusBacklashNP[0].setMin(1); // 0 is off.
142 FocusBacklashNP[0].setMax(1000);
143 FocusBacklashNP[0].setValue(1);
144 FocusBacklashNP[0].setStep(1);
145
146 FocusMaxPosNP[0].setMax(1317500);
147 FocusMaxPosNP[0].setValue(1317500);
148 FocusAbsPosNP[0].setMax(1317500);
149
153 serialConnection->setPortMatchPattern("FocusCube");
154
155 // Over WiFi the device announces itself as focuscube3.local and listens on TCP port 9999.
156 tcpConnection->setDefaultHost("focuscube3.local");
158 wifi.initProperties("WiFi",
159 [this](const char *name) { loadConfig(true, name); },
160 [this](INDI::Property & property) { saveConfig(property); });
161
162 return true;
163}
164
166{
168 wifi.ISGetProperties();
169}
170
171bool PegasusFocusCube3::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
172{
173 if (wifi.ISNewSwitch(dev, name, states, names, n))
174 return true;
175
176 return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
177}
178
179bool PegasusFocusCube3::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
180{
181 if (wifi.ISNewText(dev, name, texts, names, n))
182 return true;
183
184 return INDI::Focuser::ISNewText(dev, name, texts, names, n);
185}
186
188{
190 wifi.saveConfigItems(fp);
191 return true;
192}
193
195{
197
198 if (isConnected())
199 {
200 // The temperature is defined once the status shows that a sensor is connected.
201 defineProperty(FirmwareVersionTP);
202 std::string firmware = getFirmwareVersion();
203 FirmwareVersionTP[0].setText(firmware);
204 FirmwareVersionTP.setState(IPS_OK);
205 FirmwareVersionTP.apply();
206
207 // Show the speed the device actually uses instead of the default.
208 int speed = 0;
209 if (getSpeed(speed))
210 SpeedNP[0].setValue(speed);
211 defineProperty(SpeedNP);
212
213 wifi.updateProperties(true, PortFD);
214 }
215 else
216 {
217 hasTemperatureSensor = false;
218 deleteProperty(TemperatureNP);
219 wifi.updateProperties(false, -1);
220 deleteProperty(FirmwareVersionTP);
221 deleteProperty(SpeedNP);
222 }
223
224 return true;
225}
226
227
228bool PegasusFocusCube3::ISNewNumber(const char * dev, const char * name, double values[], char * names[], int n)
229{
230 if (wifi.ISNewNumber(dev, name, values, names, n))
231 return true;
232
233 if (dev != nullptr && !strcmp(dev, getDeviceName()))
234 {
235 if(SpeedNP.isNameMatch(name))
236 {
237 SpeedNP.update(values, names, n);
238 IPState result = IPS_OK;
239 if (isConnected())
240 {
241 if(!setSpeed(values[0]))
242 {
243 result = IPS_ALERT;
244 }
245 }
246 SpeedNP.setState(result);
247 SpeedNP.apply();
248 return true;
249 }
250 }
251
252 return INDI::Focuser::ISNewNumber(dev, name, values, names, n);
253}
254
256{
257 targetPosition = targetTicks;
258
259 bool rc = move(targetPosition);
260
261 if (!rc)
262 return IPS_ALERT;
263
264 moveStarted = std::chrono::steady_clock::now();
265 FocusAbsPosNP.setState(IPS_BUSY);
266
267 return IPS_BUSY;
268}
269
271{
272 double newPosition = 0;
273 bool rc = false;
274
275 if (dir == FOCUS_INWARD)
276 newPosition = FocusAbsPosNP[0].getValue() - ticks;
277 else
278 newPosition = FocusAbsPosNP[0].getValue() + ticks;
279
280 rc = move(newPosition);
281
282 if (!rc)
283 return IPS_ALERT;
284
285 targetPosition = newPosition;
286 moveStarted = std::chrono::steady_clock::now();
287 FocusRelPosNP[0].setValue(ticks);
288 FocusRelPosNP.setState(IPS_BUSY);
289
290 return IPS_BUSY;
291}
292
293bool PegasusFocusCube3::move(uint32_t newPosition)
294{
295 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0}, expectedResponse[PEGASUS_LEN] = {0};
296 snprintf(expectedResponse, PEGASUS_LEN, "%u", newPosition);
297 snprintf(cmd, PEGASUS_LEN, "FM:%u", newPosition);
298 if(sendCommand(cmd, res))
299 {
300 // The reply carries the target position: "12345" on firmware 2.0, "FM:12345" in the command list.
301 if(!strstr(res, expectedResponse))
302 {
303 LOGF_ERROR("Error on move [Cmd=%s Res=%s]", cmd, res);
304 return false;
305 }
306 }
307 else
308 {
309 LOGF_ERROR("Error on move [Position=%d]", newPosition);
310 return false;
311 }
312 return true;
313}
314
315
316bool PegasusFocusCube3::sendCommand(const char * cmd, char * res)
317{
318 int nbytes_read = 0, nbytes_written = 0, tty_rc = 0;
319 char command[PEGASUS_LEN] = {0};
320 LOGF_DEBUG("CMD <%s>", cmd);
321
322 for (int i = 0; i < 2; i++)
323 {
325 // Over TCP, firmware 2.0 only executes a command after a carriage return.
326 snprintf(command, PEGASUS_LEN, "%s\r\n", cmd);
327 if ( (tty_rc = tty_write_string(PortFD, command, &nbytes_written)) != TTY_OK)
328 continue;
329
330 if (!res)
331 {
332 tcflush(PortFD, TCIOFLUSH);
333 return true;
334 }
335
336 if ( (tty_rc = tty_nread_section(PortFD, res, PEGASUS_LEN, stopChar, PEGASUS_TIMEOUT, &nbytes_read)) != TTY_OK
337 || nbytes_read == 1)
338 continue;
339
340 tcflush(PortFD, TCIOFLUSH);
341 res[nbytes_read - 1] = '\0';
342
343 // Replies end with CR LF. tcflush() does not discard the LF left behind on a TCP socket,
344 // so it starts the next reply; drop leading line ends.
345 const size_t skip = strspn(res, "\r\n");
346 if (skip > 0)
347 memmove(res, res + skip, strlen(res + skip) + 1);
348 if (res[0] == '\0')
349 continue;
350
351 LOGF_DEBUG("RES <%s>", res);
352 return true;
353 }
354
355 if (tty_rc != TTY_OK)
356 {
357 char errorMessage[MAXRBUF];
358 tty_error_msg(tty_rc, errorMessage, MAXRBUF);
359 LOGF_ERROR("Serial error: %s", errorMessage);
360 }
361
362 return false;
363}
364
365bool PegasusFocusCube3::parseReply(const char *res, const char *prefix, int &value)
366{
367 // Firmware 2.0 replies with the value only (e.g. "400"), the command list shows "SP:400".
368 const size_t len = strlen(prefix);
369 const char *start = strncmp(res, prefix, len) == 0 ? res + len : res;
370 return sscanf(start, "%d", &value) == 1;
371}
372
373bool PegasusFocusCube3::setSpeed(uint16_t speed)
374{
375 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
376 snprintf(cmd, PEGASUS_LEN, "SP:%u", speed);
377
378 int actual = 0;
379 if (!sendCommand(cmd, res) || !parseReply(res, "SP:", actual))
380 {
381 LOGF_ERROR("Error on set speed [Cmd=%s Res=%s]", cmd, res);
382 return false;
383 }
384
385 // The reply is the speed in use. Values above the device maximum (400 on firmware 2.0) are ignored.
386 SpeedNP[0].setValue(actual);
387 if (actual != speed)
388 {
389 LOGF_WARN("Device kept speed %d, %u is outside its range.", actual, speed);
390 return false;
391 }
392 return true;
393}
394
395bool PegasusFocusCube3::getSpeed(int &speed)
396{
397 char res[PEGASUS_LEN] = {0};
398 if (!sendCommand("SP", res) || !parseReply(res, "SP:", speed))
399 {
400 LOGF_WARN("Could not read the speed [Res=%s].", res);
401 return false;
402 }
403 return true;
404}
405
406std::string PegasusFocusCube3::getFirmwareVersion()
407{
408 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
409 snprintf(cmd, PEGASUS_LEN, "FV");
410 if(sendCommand(cmd, res))
411 {
412
413 }
414 else
415 {
416 LOG_ERROR("Error on get Firmware");
417 }
418 return res;
419}
420
421std::vector<std::string> PegasusFocusCube3::split(const std::string &input, const std::string &regex)
422{
423 // passing -1 as the submatch index parameter performs splitting
424 std::regex re(regex);
425 std::sregex_token_iterator
426 first{input.begin(), input.end(), re, -1},
427 last;
428 return {first, last};
429}
430
432{
433 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
434 snprintf(cmd, PEGASUS_LEN, "FH");
435 if(sendCommand(cmd, res))
436 {
437
438 }
439 else
440 {
441 LOG_ERROR("Error on abort");
442 return false;
443 }
444
445
446 FocusAbsPosNP.setState(IPS_IDLE);
447 FocusRelPosNP.setState(IPS_IDLE);
448 FocusAbsPosNP.apply();
449 FocusRelPosNP.apply();
450 return true;
451}
452
454{
455 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0}, expectedResponse[PEGASUS_LEN] = {0};
456 snprintf(expectedResponse, PEGASUS_LEN, "%u", ticks);
457 snprintf(cmd, PEGASUS_LEN, "FN:%u", ticks);
458 if(sendCommand(cmd, res))
459 {
460 if(!strstr(res, expectedResponse))
461 {
462 LOGF_ERROR("Error on sync [Cmd=%s Res=%s]", cmd, res);
463 return false;
464 }
465 }
466 else
467 {
468 LOG_ERROR("Error on sync");
469 return false;
470 }
471
472 return true;
473}
474
476{
477 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
478 snprintf(cmd, PEGASUS_LEN, "FD:%d", enabled ? 1 : 0);
479 if(sendCommand(cmd, res))
480 {
481
482 }
483 else
484 {
485 LOG_ERROR("Error on reverse");
486 return false;
487 }
488
489 return true;
490}
491
493{
494 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0}, expectedResponse[PEGASUS_LEN] = {0};
495 snprintf(expectedResponse, PEGASUS_LEN, "%u", steps);
496 snprintf(cmd, PEGASUS_LEN, "BL:%d", steps);
497 if(sendCommand(cmd, res))
498 {
499 if(!strstr(res, expectedResponse))
500 {
501 LOGF_ERROR("Error on backlash [Cmd=%s Res=%s]", cmd, res);
502 return false;
503 }
504 }
505 else
506 {
507 LOG_ERROR("Error on backlash");
508 return false;
509 }
510
511 return true;
512}
513
515{
516 if (!isConnected())
517 {
519 return;
520 }
521
522 bool rc = updateFocusParams();
523
524 if (rc)
525 {
526 if (FocusAbsPosNP.getState() == IPS_BUSY || FocusRelPosNP.getState() == IPS_BUSY)
527 {
528 // A stopped focuser away from the target may not have started yet.
529 const bool atTarget = currentPosition == targetPosition ||
530 std::chrono::steady_clock::now() - moveStarted > MOVE_START_TIMEOUT;
531 if (isMoving == false && atTarget)
532 {
533 FocusAbsPosNP.setState(IPS_OK);
534 FocusRelPosNP.setState(IPS_OK);
535 FocusAbsPosNP.apply();
536 FocusRelPosNP.apply();
537 LOG_INFO("Focuser reached requested position.");
538 }
539 }
540 }
541
543}
544
545bool PegasusFocusCube3::updateFocusParams()
546{
547 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
548 snprintf(cmd, PEGASUS_LEN, "FA");
549 if(sendCommand(cmd, res))
550 {
551
552 }
553 else
554 {
555 LOGF_ERROR("Error on [Cmd=%s Res=%s]", cmd, res);
556 return false;
557 }
558
559 std::vector<std::string> result = split(res, ":");
560
561 // Status: FC3:position:running:temperature:reverse:backlash
562 if(result.size() < 6 || result[0] != "FC3")
563 {
564 LOGF_WARN("Unexpected status data: %s", res);
565 return false;
566 }
567
568
569 // #1 Position
570 currentPosition = atoi(result[1].c_str());
571 if (currentPosition != FocusAbsPosNP[0].getValue())
572 {
573 FocusAbsPosNP[0].setValue(currentPosition);
574 FocusAbsPosNP.apply();
575 }
576
577 // #2 Moving Status
578 isMoving = (result[2] == "1");
579
580
581 // #3 Temperature: -127 means that no sensor is connected, so the property is only shown with a sensor.
582 const double temperature = atof(result[3].c_str());
583 const bool sensor = temperature > -126;
584 if (sensor != hasTemperatureSensor)
585 {
586 hasTemperatureSensor = sensor;
587 if (sensor)
588 defineProperty(TemperatureNP);
589 else
590 deleteProperty(TemperatureNP);
591 }
592 if (sensor)
593 {
594 TemperatureNP[0].setValue(temperature);
595 TemperatureNP.setState(IPS_OK);
596 TemperatureNP.apply();
597 }
598
599
600 // #4 Reverse Status
601 int reverseStatus = atoi(result[4].c_str());
602 if (reverseStatus >= 0 && reverseStatus <= 1)
603 {
604 FocusReverseSP.reset();
605 FocusReverseSP[INDI_ENABLED].setState((reverseStatus == 1) ? ISS_ON : ISS_OFF);
606 FocusReverseSP[INDI_DISABLED].setState((reverseStatus == 0) ? ISS_ON : ISS_OFF);
607 FocusReverseSP.setState(IPS_OK);
608 FocusReverseSP.apply();
609 }
610
611
612 // #5 Backlash
613
614 int backlash = atoi(result[5].c_str());
615 // If backlash is zero then compensation is disabled
616 if (backlash == 0 && FocusBacklashSP[INDI_ENABLED].getState() == ISS_ON)
617 {
618 LOG_WARN("Backlash value is zero, disabling backlash switch...");
619
622 FocusBacklashSP.setState(IPS_IDLE);
623 FocusBacklashSP.apply();
624 }
625 else if (backlash > 0 && (FocusBacklashSP[INDI_DISABLED].getState() == ISS_ON || backlash != FocusBacklashNP[0].getValue()))
626 {
627 if (backlash != FocusBacklashNP[0].getValue())
628 {
629 FocusBacklashNP[0].setValue(backlash);
630 FocusBacklashNP.setState(IPS_OK);
631 FocusBacklashNP.apply();
632 }
633
634 if (FocusBacklashSP[INDI_DISABLED].getState() == ISS_ON)
635 {
638 FocusBacklashSP.setState(IPS_OK);
639 FocusBacklashSP.apply();
640 }
641 }
642
643 return true;
644}
double temperature
bool isConnected() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setDefaultPollingPeriod(uint32_t msec)
setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
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.
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void addDebugControl()
Add Debug control to the driver.
INDI::PropertyNumber FocusRelPosNP
INDI::PropertySwitch FocusReverseSP
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
INDI::PropertyNumber FocusMaxPosNP
INDI::PropertySwitch FocusBacklashSP
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,...
Connection::TCP * tcpConnection
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...
Connection::Serial * serialConnection
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Processes incoming new text values from the client for this device. Delegates processing to the contr...
Provides generic container for INDI properties.
static constexpr int TCP_PORT
Port of the TCP command socket.
static void drain(int portFD)
Discard pending input. tcflush() only works on a serial port, so over TCP a line end left behind by a...
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual bool saveConfigItems(FILE *fp) override
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
static constexpr const uint8_t PEGASUS_LEN
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 ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
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...
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
static constexpr const uint8_t PEGASUS_TIMEOUT
bool sendCommand(const char *cmd, char *res)
virtual 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 IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
const char * getDefaultName() override
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Processes incoming new text values from the client for this device. Delegates processing to the contr...
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
std::vector< std::string > split(const std::string &input, const std::string &regex)
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 Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
#define FOCUS_SETTINGS_TAB
Definition dmfc.cpp:34
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
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
@ TTY_TIME_OUT
Definition indicom.h:58
@ TTY_OVERFLOW
Definition indicom.h:62
#define MAXRBUF
Definition indidriver.c:52
*brief user defined string literal for JSON values *sa std::size_t n
#define LOG_DEBUG(txt)
Definition indilogger.h:75
#define LOGF_WARN(fmt,...)
Definition indilogger.h:81
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition indilogger.h:72
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
#define getDeviceName
json_pointer res
uint8_t cmd[4]
Definition pwc-ioctl.h:2