Instrument Neutral Distributed Interface INDI 2.2.5
pegasus_falconv2.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2024 Chrysikos Efstathios. All rights reserved.
3
4 Pegasus FalconV2 Rotator
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 Corrections by T. Schriber 2022 following
25 'FalconV2 Rotator Serial Command Language Firmware >=v.1.3 (review Sep 2020)'
26*******************************************************************************/
27
28#include "pegasus_falconv2.h"
29#include "indicom.h"
32
33#include <algorithm>
34#include <cmath>
35#include <memory>
36#include <regex>
37#include <termios.h>
38#include <cstring>
39#include <sys/ioctl.h>
40#include <chrono>
41#include <math.h>
42#include <iomanip>
43
44// We declare an auto pointer to PegasusFalconV2.
45static std::unique_ptr<PegasusFalconV2> falconv2(new PegasusFalconV2());
46
48{
49 setVersion(1, 2);
50 lastStatusData.reserve(7);
51}
52
54{
56
60
62 serialConnection->setPortMatchPattern("Falcon");
63
67 // Reload Firmware
68 ReloadFirmwareSP[0].fill("RELOAD", "Reload", ISS_OFF);
69 ReloadFirmwareSP.fill(getDeviceName(), "RELOAD_FIRMWARE", "Firmware", MAIN_CONTROL_TAB,
71 60, IPS_IDLE);
72
73 // Derotate: rate in arcseconds per second, negative values rotate in reverse. 0 disables it.
74 DerotateNP[0].fill("RATE", "Rate (arcsec/s)", "%.f", -3600, 3600, 1, 0);
75 DerotateNP.fill(getDeviceName(), "ROTATOR_DEROTATE", "Derotation", MAIN_CONTROL_TAB, IP_RW,
76 60, IPS_IDLE);
77
78 // Rotator Speed
79 RotatorSpeedNP[0].fill("SPEED", "Speed (steps/sec)", "%.f", 10, 4500, 10, 500);
80 RotatorSpeedNP.fill(getDeviceName(), "ROTATOR_SPEED", "Speed", MAIN_CONTROL_TAB, IP_RW,
81 60, IPS_IDLE);
82
83 // Cable limit: the firmware keeps the rotation within 220 degrees and takes the long way round
84 // when the short way would cross the limit. The device stores the setting itself.
85 CableLimitSP[INDI_ENABLED].fill("INDI_ENABLED", "Enabled", ISS_ON);
86 CableLimitSP[INDI_DISABLED].fill("INDI_DISABLED", "Disabled", ISS_OFF);
87 CableLimitSP.fill(getDeviceName(), "ROTATOR_CABLE_LIMIT", "Cable Limit", MAIN_CONTROL_TAB, IP_RW,
89
90 // Firmware
91 FirmwareTP[0].fill("VERSION", "Version", "NA");
92 FirmwareTP.fill(getDeviceName(), "FIRMWARE_INFO", "Firmware", MAIN_CONTROL_TAB, IP_RO, 60,
93 IPS_IDLE);
94
95 // Over WiFi the device announces itself as falcon2.local and listens on TCP port 9999.
96 tcpConnection->setDefaultHost("falcon2.local");
98 wifi.initProperties("WiFi",
99 [this](const char *name) { loadConfig(true, name); },
100 [this](INDI::Property & property) { saveConfig(property); });
101
102 return true;
103}
104
106{
108 wifi.ISGetProperties();
109}
110
111bool PegasusFalconV2::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
112{
113 if (wifi.ISNewText(dev, name, texts, names, n))
114 return true;
115
116 return INDI::Rotator::ISNewText(dev, name, texts, names, n);
117}
118
120{
122
123 if (isConnected())
124 {
125 // Main Control
126 defineProperty(DerotateNP);
127 defineProperty(RotatorSpeedNP);
128 getCableLimit();
129 defineProperty(CableLimitSP);
130 defineProperty(FirmwareTP);
131 defineProperty(ReloadFirmwareSP);
132 }
133 else
134 {
135 // Main Control
136 deleteProperty(DerotateNP);
137 deleteProperty(RotatorSpeedNP);
138 deleteProperty(CableLimitSP);
139 deleteProperty(FirmwareTP);
140 deleteProperty(ReloadFirmwareSP);
141 }
142
143 wifi.updateProperties(isConnected(), PortFD);
144
145 return true;
146}
147
149{
150 return "Pegasus FalconV2";
151}
152
157{
158 // Over TCP, log in with the hotspot password before any command.
160 return false;
161
162 if (!getFirmware())
163 return false;
164
165 // Try to read the rotator speed, but don't fail if it doesn't work
166 if (!getRotatorSpeed())
167 LOG_WARN("Failed to read rotator speed during connection.");
168
169 return true;
170}
171
175bool PegasusFalconV2::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
176{
177 if (wifi.ISNewNumber(dev, name, values, names, n))
178 return true;
179
180 if (dev && !strcmp(dev, getDeviceName()))
181 {
182 // De-rotation
183 if (DerotateNP.isNameMatch(name))
184 {
185 // Older versions saved an "INTERVAL" in ms. Never start de-rotation from a configuration,
186 // and only accept the RATE element.
187 if (isConfigLoading() || n < 1 || strcmp(names[0], DerotateNP[0].getName()) != 0)
188 {
189 DerotateNP.apply();
190 return true;
191 }
192
193 const int32_t rate = static_cast<int32_t>(std::max(DerotateNP[0].getMin(),
194 std::min(DerotateNP[0].getMax(), values[0])));
195 if (setDerotation(rate))
196 {
197 DerotateNP[0].setValue(rate);
198 if (rate != 0)
199 LOGF_INFO("De-rotation is enabled at %d arcsec/s.", rate);
200 else
201 LOG_INFO("De-rotation is disabled.");
202 DerotateNP.setState(IPS_OK);
203 }
204 else
205 DerotateNP.setState(IPS_ALERT);
206 DerotateNP.apply();
207 return true;
208 }
209
210 // Rotator Speed
211 if (RotatorSpeedNP.isNameMatch(name))
212 {
213 const uint32_t speed = static_cast<uint32_t>(values[0]);
214 if (setRotatorSpeed(speed))
215 {
216 RotatorSpeedNP[0].setValue(values[0]);
217 LOGF_INFO("Rotator speed set to %u steps/sec.", speed);
218 RotatorSpeedNP.setState(IPS_OK);
219 }
220 else
221 RotatorSpeedNP.setState(IPS_ALERT);
222 RotatorSpeedNP.apply();
223 return true;
224 }
225 }
226 return Rotator::ISNewNumber(dev, name, values, names, n);
227}
228
232bool PegasusFalconV2::ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n)
233{
234 if (wifi.ISNewSwitch(dev, name, states, names, n))
235 return true;
236
237 if (dev && !strcmp(dev, getDeviceName()))
238 {
239 // ReloadFirmware
240 if (ReloadFirmwareSP.isNameMatch(name))
241 {
242 ReloadFirmwareSP.setState(reloadFirmware() ? IPS_OK : IPS_ALERT);
243 ReloadFirmwareSP.apply();
244 LOG_INFO("Reloading firmware...");
245 return true;
246 }
247
248 // Cable limit
249 if (CableLimitSP.isNameMatch(name))
250 {
251 const char *onSwitch = IUFindOnSwitchName(states, names, n);
252 const bool enabled = onSwitch != nullptr && CableLimitSP[INDI_ENABLED].isNameMatch(onSwitch);
253 if (setCableLimit(enabled))
254 {
255 CableLimitSP.update(states, names, n);
256 CableLimitSP.setState(IPS_OK);
257 if (enabled)
258 LOG_INFO("Cable limit enabled.");
259 else
260 LOG_WARN("Cable limit disabled. The rotator can now turn without limit, watch the cables.");
261 }
262 else
263 CableLimitSP.setState(IPS_ALERT);
264 CableLimitSP.apply();
265 return true;
266 }
267 }
268
269 return Rotator::ISNewSwitch(dev, name, states, names, n);
270}
271
276{
277 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
278 snprintf(cmd, DRIVER_LEN, "MD:%.2f", angle);
279 if (sendCommand(cmd, res) && !strncmp(res, "MD:", 3))
280 {
281 m_TargetAngle = angle;
282 m_MoveStarted = std::chrono::steady_clock::now();
283 m_StartAngle = GotoRotatorNP[0].getValue();
284 m_DirectionChecked = false;
285 return IPS_BUSY;
286 }
287
288 LOGF_ERROR("Unexpected move response: %s", res);
289 return IPS_ALERT;
290}
291
296{
297 char res[DRIVER_LEN] = {0};
298 if (sendCommand("FH", res) && !strcmp(res, "FH:1"))
299 {
300 // The stopped rotator is not at the target; do not wait for the move to start.
301 m_MoveStarted = std::chrono::steady_clock::time_point();
302 m_DirectionChecked = true;
303 return true;
304 }
305
306 return false;
307}
308
313{
314 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
315 snprintf(cmd, DRIVER_LEN, "FN:%d", enabled ? 1 : 0);
316 if (sendCommand(cmd, res))
317 {
318 return (!strncmp(res, cmd, 4)); //Restrict length to 4 chars!
319 }
320
321 return false;
322}
323
328{
329 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
330 snprintf(cmd, DRIVER_LEN, "SD:%.2f", angle);
331 return sendCommand(cmd, res) && !strncmp(res, "SD:", 3);
332}
333
337bool PegasusFalconV2::getCableLimit()
338{
339 // "FLIM" reports the cable limit as "FLIM:1" (enabled) or "FLIM:0".
340 char res[DRIVER_LEN] = {0};
341 int enabled = 0;
342 if (!sendCommand("FLIM", res) || sscanf(res, "FLIM:%d", &enabled) != 1)
343 {
344 LOGF_WARN("Could not read the cable limit [Res=%s].", res);
345 return false;
346 }
347
348 CableLimitSP[INDI_ENABLED].setState(enabled ? ISS_ON : ISS_OFF);
349 CableLimitSP[INDI_DISABLED].setState(enabled ? ISS_OFF : ISS_ON);
350 CableLimitSP.setState(IPS_OK);
351 return true;
352}
353
354bool PegasusFalconV2::setCableLimit(bool enabled)
355{
356 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
357 snprintf(cmd, DRIVER_LEN, "FLIM:%d", enabled ? 1 : 0);
358 if (sendCommand(cmd, res) && !strcmp(res, cmd))
359 return true;
360
361 LOGF_ERROR("Unexpected cable limit response: %s", res);
362 return false;
363}
364
365bool PegasusFalconV2::reloadFirmware()
366{
367 // FF reboots the device and reloads the firmware; it sends no reply.
368 return sendCommand("FF");
369}
370
374bool PegasusFalconV2::setDerotation(int32_t rate)
375{
376 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
377 snprintf(cmd, DRIVER_LEN, "DR:%d", rate);
378 return sendCommand(cmd, res) && !strncmp(res, "DR:", 3);
379}
380
384bool PegasusFalconV2::getRotatorSpeed()
385{
386 char res[DRIVER_LEN] = {0};
387 if (sendCommand("FS", res))
388 {
389 // Response format: "FS:<value>"
390 std::vector<std::string> result = split(res, ":");
391 if (result.size() == 2 && result[0] == "FS")
392 {
393 try
394 {
395 const uint32_t speed = std::stoul(result[1]);
396 RotatorSpeedNP[0].setValue(speed);
397 RotatorSpeedNP.setState(IPS_OK);
398 LOGF_INFO("Rotator speed is %u steps/sec.", speed);
399 return true;
400 }
401 catch (...)
402 {
403 RotatorSpeedNP.setState(IPS_ALERT);
404 LOGF_ERROR("Failed to parse speed response: %s", res);
405 return false;
406 }
407 }
408 else
409 {
410 LOGF_ERROR("Invalid speed response format: %s", res);
411 RotatorSpeedNP.setState(IPS_ALERT);
412 return false;
413 }
414 }
415 return false;
416}
417
421bool PegasusFalconV2::setRotatorSpeed(uint32_t speed)
422{
423 char cmd[DRIVER_LEN] = {0}, res[DRIVER_LEN] = {0};
424 snprintf(cmd, DRIVER_LEN, "FS:%u", speed);
425 if (sendCommand(cmd, res))
426 {
427 // Response should be "FS:" without the value
428 return (!strncmp(res, "FS:", 3));
429 }
430 return false;
431}
432
437{
438 // De-rotation is not saved, so it never starts by itself on the next connection.
440 wifi.saveConfigItems(fp);
441 return true;
442}
443
448{
449 if (!isConnected())
450 return;
451 getStatusData();
453}
454
458bool PegasusFalconV2::getFirmware()
459{
460 char res[DRIVER_LEN] = {0};
461 if (sendCommand("FV", res))
462 {
463 FirmwareTP[0].setText(res + 3);
464 return true;
465 }
466
467 return false;
468}
469
473bool PegasusFalconV2::getStatusData()
474{
475 char res[DRIVER_LEN] = {0};
476 if (sendCommand("FA", res))
477 {
478 std::vector<std::string> result = split(res, ":");
479 if (result.size() != 6)
480 {
481 LOG_WARN("Received wrong number of detailed sensor data. Retrying...");
482 return false;
483 }
484
485 // While a move is in progress, evaluate every reply so it always gets finished.
486 if (result == lastStatusData && GotoRotatorNP.getState() != IPS_BUSY)
487 return true;
488
489 double position = 0;
490 bool running = false, reversed = false;
491 try
492 {
493 position = std::stod(result[1]);
494 running = std::stoi(result[2]) == 1;
495 reversed = std::stoi(result[5]) == 1;
496 }
497 catch (const std::exception &e)
498 {
499 LOGF_WARN("Invalid status data (%s): %s", e.what(), res);
500 return false;
501 }
502
503 // A stopped rotator away from the target may not have started yet; wait for it,
504 // unless it stays put for too long (e.g. the move was rejected).
505 IPState motionState = running ? IPS_BUSY : IPS_OK;
506 if (!running && GotoRotatorNP.getState() == IPS_BUSY)
507 {
508 double distance = std::fmod(std::fabs(position - m_TargetAngle), 360.0);
509 distance = std::min(distance, 360.0 - distance);
510 if (distance > TARGET_TOLERANCE && std::chrono::steady_clock::now() - m_MoveStarted < MOVE_START_TIMEOUT)
511 motionState = IPS_BUSY;
512 }
513
514 // With the cable limit enabled, the firmware takes the long way round when the short way would
515 // cross the limit. Such a move takes minutes, so explain it once it is clearly under way.
516 if (running && !m_DirectionChecked && GotoRotatorNP.getState() == IPS_BUSY)
517 {
518 // Signed angle differences in (-180, 180].
519 auto wrap = [](double d)
520 {
521 return 180.0 - std::fmod(540.0 - d, 360.0);
522 };
523 const double shortWay = wrap(m_TargetAngle - m_StartAngle);
524 const double moved = wrap(position - m_StartAngle);
525 if (std::fabs(moved) > 1.0)
526 {
527 m_DirectionChecked = true;
528 if (std::fabs(shortWay) > 1.0 && std::fabs(shortWay) < 179.0 && moved * shortWay < 0)
529 LOGF_WARN("Rotator takes the long way round to %.2f (%.0f instead of %.0f degrees), "
530 "because the short way would cross the cable limit.",
531 m_TargetAngle, 360.0 - std::fabs(shortWay), std::fabs(shortWay));
532 }
533 }
534
535 // Update Absolute Position property if either position changes, or status changes.
536 if (std::abs(position - GotoRotatorNP[0].getValue()) > 0.01 || GotoRotatorNP.getState() != motionState)
537 {
538 GotoRotatorNP[0].setValue(position);
539 GotoRotatorNP.setState(motionState);
540 GotoRotatorNP.apply();
541 }
542
543
544 const bool wasReversed = ReverseRotatorSP[INDI_ENABLED].getState() == ISS_ON;
545 if (reversed != wasReversed)
546 {
547 ReverseRotatorSP[INDI_ENABLED].setState(reversed ? ISS_ON : ISS_OFF);
548 ReverseRotatorSP[INDI_DISABLED].setState(reversed ? ISS_OFF : ISS_ON);
549 ReverseRotatorSP.apply();
550 }
551
552 lastStatusData = result;
553 return true;
554 }
555
556 return false;
557}
558
562bool PegasusFalconV2::sendCommand(const char * cmd, char * res, int cmd_len, int res_len)
563{
564 int nbytes_written = 0, nbytes_read = 0, rc = -1;
565
566 tcflush(PortFD, TCIOFLUSH);
567
568 if (cmd_len > 0)
569 {
570 char hex_cmd[DRIVER_LEN * 3] = {0};
571 hexDump(hex_cmd, cmd, cmd_len);
572 LOGF_DEBUG("CMD <%s>", hex_cmd);
573 rc = tty_write(PortFD, cmd, cmd_len, &nbytes_written);
574 }
575 else
576 {
577 LOGF_DEBUG("CMD <%s>", cmd);
578
579 char formatted_command[DRIVER_LEN] = {0};
580 snprintf(formatted_command, DRIVER_LEN, "%s\n", cmd);
581 rc = tty_write_string(PortFD, formatted_command, &nbytes_written);
582 }
583
584 if (rc != TTY_OK)
585 {
586 char errstr[MAXRBUF] = {0};
587 tty_error_msg(rc, errstr, MAXRBUF);
588 LOGF_ERROR("Serial write error: %s.", errstr);
589 return false;
590 }
591
592 if (res == nullptr)
593 return true;
594
595 if (res_len > 0)
596 rc = tty_read(PortFD, res, res_len, DRIVER_TIMEOUT, &nbytes_read);
597 else
598 rc = tty_nread_section(PortFD, res, DRIVER_LEN, DRIVER_STOP_CHAR, DRIVER_TIMEOUT, &nbytes_read);
599
600 if (rc != TTY_OK)
601 {
602 char errstr[MAXRBUF] = {0};
603 tty_error_msg(rc, errstr, MAXRBUF);
604 LOGF_ERROR("Serial read error: %s.", errstr);
605 return false;
606 }
607
608 if (res_len > 0)
609 {
610 char hex_res[DRIVER_LEN * 3] = {0};
611 hexDump(hex_res, res, res_len);
612 LOGF_DEBUG("RES <%s>", hex_res);
613 }
614 else
615 {
616 // Remove the trailing \n and, if present, \r
617 res[nbytes_read - 1] = 0;
618 if (nbytes_read > 1 && res[nbytes_read - 2] == '\r')
619 res[nbytes_read - 2] = 0;
620 LOGF_DEBUG("RES <%s>", res);
621 }
622
623 tcflush(PortFD, TCIOFLUSH);
624
625 return true;
626}
627
631void PegasusFalconV2::hexDump(char * buf, const char * data, uint32_t size)
632{
633 for (uint32_t i = 0; i < size; i++)
634 sprintf(buf + 3 * i, "%02X ", static_cast<uint8_t>(data[i]));
635
636 if (size > 0)
637 buf[3 * size - 1] = '\0';
638}
639
643std::vector<std::string> PegasusFalconV2::split(const std::string &input, const std::string &regex)
644{
645 // passing -1 as the submatch index parameter performs splitting
646 std::regex re(regex);
647 std::sregex_token_iterator
648 first{input.begin(), input.end(), re, -1},
649 last;
650 return {first, last};
651}
652
656void PegasusFalconV2::cleanupResponse(char *response)
657{
658 std::string s(response);
659 s.erase(std::remove_if(s.begin(), s.end(),
660 [](unsigned char x)
661 {
662 return std::isspace(x);
663 }), s.end());
664 snprintf(response, DRIVER_LEN, "%s", s.c_str());
665}
bool isConnected() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
bool isConfigLoading() const
isConfigLoading Check if driver configuration is currently in the process of getting loaded.
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.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
Provides generic container for INDI properties.
void SetCapability(uint32_t cap)
SetRotatorCapability sets the Rotator capabilities. All capabilities must be initialized.
INDI::PropertySwitch ReverseRotatorSP
INDI::PropertyNumber GotoRotatorNP
Connection::Serial * serialConnection
Definition indirotator.h:95
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool Handshake()
perform handshake with device to check communication
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...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the reverse direction property in the configuration file
Connection::TCP * tcpConnection
Definition indirotator.h:96
static constexpr int TCP_PORT
Port of the TCP command socket.
bool login(int portFD)
Log in on the TCP command socket with the hotspot password.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the reverse direction property in the configuration file
virtual bool AbortRotator() override
AbortRotator Abort all motion.
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...
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ReverseRotator(bool enabled) override
reverse action ("FN:0" disabled, "FN:1" enabled)
const char * getDefaultName() override
virtual IPState MoveRotator(double angle) override
move to degrees (Command "MD:nn.nn"; Response "MD:nn.nn")
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool SyncRotator(double angle) override
SyncRotator Set current angle as the supplied angle without moving the rotator.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
IPState
Property state.
Definition indiapi.h:158
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
@ ISR_ATMOST1
Definition indiapi.h:172
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition indicom.c:418
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Definition indicom.c:548
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition indicom.c:473
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Definition indicom.c:1243
int tty_nread_section(int fd, char *buf, int nsize, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition indicom.c:759
Implementations for common driver routines.
@ TTY_OK
Definition indicom.h:54
const char * IUFindOnSwitchName(ISState *states, char *names[], int n)
Returns the name of the first ON switch it finds in the supplied arguments.
Definition indidevapi.c:355
#define MAXRBUF
Definition indidriver.c:52
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
Definition indilogger.h:82
#define LOGF_WARN(fmt,...)
Definition indilogger.h:81
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
#define getDeviceName
json_pointer res
uint8_t cmd[4]
Definition pwc-ioctl.h:2