35static std::unique_ptr<PegasusPPBA> ppba(
new PegasusPPBA());
40 lastSensorData.reserve(PA_N);
41 lastConsumptionData.reserve(PS_N);
42 lastMetricsData.reserve(PC_N);
64 RebootSP[0].
fill(
"REBOOT",
"Reboot Device",
ISS_OFF);
79 std::string name (1,
static_cast<char>(
'A' + i));
117 PowerStatisticsNP[STATS_AVG_AMPS].
fill(
"STATS_AVG_AMPS",
"Average Current (A)",
"%4.2f", 0, 999, 100, 0);
118 PowerStatisticsNP[STATS_AMP_HOURS].
fill(
"STATS_AMP_HOURS",
"Amp hours (Ah)",
"%4.2f", 0, 999, 100, 0);
119 PowerStatisticsNP[STATS_WATT_HOURS].
fill(
"STATS_WATT_HOURS",
"Watt hours (Wh)",
"%4.2f", 0, 999, 100, 0);
120 PowerStatisticsNP[STATS_TOTAL_CURRENT].
fill(
"STATS_TOTAL_CURRENT",
"Total current (A)",
"%4.2f", 0, 999, 100, 0);
124 AdjOutVoltSP[ADJOUT_OFF].
fill(
"ADJOUT_OFF",
"Off",
ISS_ON);
125 AdjOutVoltSP[ADJOUT_3V].
fill(
"ADJOUT_3V",
"3V",
ISS_OFF);
126 AdjOutVoltSP[ADJOUT_5V].
fill(
"ADJOUT_5V",
"5V",
ISS_OFF);
127 AdjOutVoltSP[ADJOUT_8V].
fill(
"ADJOUT_8V",
"8V",
ISS_OFF);
128 AdjOutVoltSP[ADJOUT_9V].
fill(
"ADJOUT_9V",
"9V",
ISS_OFF);
129 AdjOutVoltSP[ADJOUT_12V].
fill(
"ADJOUT_12V",
"12V",
ISS_OFF);
134 PowerOnBootSP[POWER_PORT_1].
fill(
"POWER_PORT_1",
"Quad Out",
ISS_ON);
135 PowerOnBootSP[POWER_PORT_2].
fill(
"POWER_PORT_2",
"Adj Out",
ISS_ON);
136 PowerOnBootSP[POWER_PORT_3].
fill(
"POWER_PORT_3",
"Dew A",
ISS_ON);
137 PowerOnBootSP[POWER_PORT_4].
fill(
"POWER_PORT_4",
"Dew B",
ISS_ON);
142 AutoDewSettingsNP[AUTO_DEW_AGGRESSION].
fill(
"AGGRESSION",
"Aggresiveness (%)",
"%.2f", 0, 100, 10, 0);
148 FirmwareTP[FIRMWARE_VERSION].
fill(
"VERSION",
"Version",
"NA");
149 FirmwareTP[FIRMWARE_UPTIME].
fill(
"UPTIME",
"Uptime (h)",
"NA");
156 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -15, 35, 15);
157 addParameter(
"WEATHER_HUMIDITY",
"Humidity %", 0, 100, 15);
158 addParameter(
"WEATHER_DEWPOINT",
"Dew Point (C)", 0, 100, 15);
166 FocuserSettingsNP[SETTING_MAX_SPEED].
fill(
"SETTING_MAX_SPEED",
"Max Speed (%)",
"%.f", 0, 900, 100, 400);
171 FocuserDriveSP[STEP_FULL].
fill(
"STEP_FULL",
"Full",
ISS_OFF);
172 FocuserDriveSP[STEP_HALF].
fill(
"STEP_HALF",
"Half",
ISS_ON);
173 FocuserDriveSP[STEP_FORTH].
fill(
"STEP_FORTH",
"1/4",
ISS_OFF);
174 FocuserDriveSP[STEP_EIGHTH].
fill(
"STEP_EIGHTH",
"1/8",
ISS_OFF);
197 m_HasExternalMotor = findExternalMotorController();
199 if (m_HasExternalMotor)
212 getAutoDewAggression();
220 if (m_HasExternalMotor)
233 setupComplete =
true;
249 if (m_HasExternalMotor)
260 setupComplete =
false;
268 return "Pegasus PPBA";
271bool PegasusPPBA::Handshake()
273 int tty_rc = 0, nbytes_written = 0, nbytes_read = 0;
274 char command[PEGASUS_LEN] = {0}, response[PEGASUS_LEN] = {0};
280 tcflush(PortFD, TCIOFLUSH);
281 strncpy(command,
"P#\n", PEGASUS_LEN);
286 LOGF_ERROR(
"Serial write error: %s", errorMessage);
296 tcflush(PortFD, TCIOFLUSH);
305 LOGF_ERROR(
"Serial read error: %s", errorMessage);
310 tcflush(PortFD, TCIOFLUSH);
311 response[nbytes_read - 1] =
'\0';
314 setupComplete =
false;
316 return (!strcmp(response,
"PPBA_OK") || !strcmp(response,
"PPBM_OK"));
331 AdjOutVoltSP.
update(states, names, n);
356 AdjOutVoltSP.
apply();
357 LOGF_ERROR(
"Unexpected voltage level: %d", target_index);
362 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
373 if (target_index == ADJOUT_OFF)
375 ok = sendCommand(
"P2:0", res);
379 snprintf(
cmd, PEGASUS_LEN,
"P2:%d", adjv);
380 ok = sendCommand(
cmd, res);
382 ok = sendCommand(
"P2:1", res);
387 AdjOutVoltSP.
reset();
394 AdjOutVoltSP.
reset();
399 AdjOutVoltSP.
apply();
400 LOGF_INFO(
"New adj. voltage: %dV", adjv);
416 PowerOnBootSP.
update(states, names, n);
418 PowerOnBootSP.
apply();
427 FocuserDriveSP.
update(states, names, n);
434 FocuserDriveSP.
reset();
439 FocuserDriveSP.
apply();
443 if (strstr(name,
"FOCUS"))
447 return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
462 uint8_t aggression =
static_cast<uint8_t
>(values[0] / 100.0 * 255.0);
463 if (setAutoDewAggression(aggression))
465 AutoDewSettingsNP.
update(values, names, n);
472 AutoDewSettingsNP.
apply();
479 if (setFocuserMaxSpeed(values[0]))
481 FocuserSettingsNP[SETTING_MAX_SPEED].setValue(values[0]);
489 FocuserSettingsNP.
apply();
493 if (strstr(name,
"FOCUS_"))
496 if (strstr(name,
"WEATHER_"))
514bool PegasusPPBA::sendCommand(
const char *
cmd,
char * res)
516 int nbytes_read = 0, nbytes_written = 0, tty_rc = 0;
517 char command[PEGASUS_LEN] = {0};
520 for (
int i = 0; i < 2; i++)
522 tcflush(PortFD, TCIOFLUSH);
523 snprintf(command, PEGASUS_LEN,
"%s\n",
cmd);
529 tcflush(PortFD, TCIOFLUSH);
537 tcflush(PortFD, TCIOFLUSH);
538 res[nbytes_read - 1] =
'\0';
553bool PegasusPPBA::findExternalMotorController()
555 char res[PEGASUS_LEN] = {0};
556 if (!sendCommand(
"XS", res))
560 return strstr(res,
"200");
563bool PegasusPPBA::setAutoDewEnabled(
bool enabled)
565 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
566 snprintf(
cmd, PEGASUS_LEN,
"PD:%d", enabled ? 1 : 0);
567 if (sendCommand(
cmd, res))
569 return (!strcmp(res,
cmd));
575bool PegasusPPBA::setAutoDewAggression(uint8_t value)
577 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
578 snprintf(
cmd, PEGASUS_LEN,
"PD:%d", value);
579 if (sendCommand(
cmd, res))
581 return (!strcmp(res,
cmd));
587bool PegasusPPBA::setPowerEnabled(uint8_t port,
bool enabled)
589 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
590 snprintf(
cmd, PEGASUS_LEN,
"P%d:%d", port, enabled ? 1 : 0);
591 if (sendCommand(
cmd, res))
593 return (!strcmp(res,
cmd));
599bool PegasusPPBA::setLedIndicator(
bool enabled)
601 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
602 snprintf(
cmd, PEGASUS_LEN,
"PL:%d", enabled ? 1 : 0);
603 if (sendCommand(
cmd, res))
605 return (!strcmp(res,
cmd));
611bool PegasusPPBA::setPowerOnBoot()
613 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
614 snprintf(
cmd, PEGASUS_LEN,
"PE:%d%d%d%d", PowerOnBootSP[POWER_PORT_1].getState() ==
ISS_ON ? 1 : 0,
615 PowerOnBootSP[POWER_PORT_2].getState() ==
ISS_ON ? 1 : 0,
616 PowerOnBootSP[POWER_PORT_3].getState() ==
ISS_ON ? 1 : 0,
617 PowerOnBootSP[POWER_PORT_4].getState() ==
ISS_ON ? 1 : 0);
618 if (sendCommand(
cmd, res))
620 return (!strcmp(res,
"PE:1"));
626bool PegasusPPBA::setDewPWM(uint8_t
id, uint8_t value)
628 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0}, expected[PEGASUS_LEN] = {0};
629 snprintf(
cmd, PEGASUS_LEN,
"P%d:%03d",
id, value);
630 snprintf(expected, PEGASUS_LEN,
"P%d:%d",
id, value);
631 if (sendCommand(
cmd, res))
633 return (!strcmp(res, expected));
643 AdjOutVoltSP.
save(fp);
644 PowerOnBootSP.
save(fp);
645 AutoDewSettingsNP.
save(fp);
647 if (m_HasExternalMotor)
650 FocuserSettingsNP.
save(fp);
651 FocuserDriveSP.
save(fp);
669 getConsumptionData();
672 if (m_HasExternalMotor)
678bool PegasusPPBA::sendFirmware()
680 char res[PEGASUS_LEN] = {0};
681 if (sendCommand(
"PV", res))
684 FirmwareTP[FIRMWARE_VERSION].setText(res);
692bool PegasusPPBA::getSensorData()
694 char res[PEGASUS_LEN] = {0};
695 if (sendCommand(
"PA", res))
697 std::vector<std::string> result = split(res,
":");
698 if (result.size() < PA_N)
700 LOG_WARN(
"Received wrong number of detailed sensor data. Retrying...");
704 if (result == lastSensorData)
714 if (lastSensorData.size() < PA_N ||
715 lastSensorData[PA_VOLTAGE] != result[PA_VOLTAGE] || lastSensorData[PA_CURRENT] != result[PA_CURRENT])
722 if (lastSensorData.size() < PA_N ||
723 lastSensorData[PA_TEMPERATURE] != result[PA_TEMPERATURE] ||
724 lastSensorData[PA_HUMIDITY] != result[PA_HUMIDITY] ||
725 lastSensorData[PA_DEW_POINT] != result[PA_DEW_POINT])
737 if (lastSensorData.size() < PA_N || lastSensorData[PA_PORT_STATUS] != result[PA_PORT_STATUS])
745 AdjOutVoltSP.
reset();
746 if (std::stoi(result[PA_ADJ_STATUS]) == 0)
756 if (lastSensorData.size() < PA_N ||
757 lastSensorData[PA_PWRADJ] != result[PA_PWRADJ] || lastSensorData[PA_ADJ_STATUS] != result[PA_ADJ_STATUS])
758 AdjOutVoltSP.
apply();
763 if (lastSensorData.size() < PA_N ||
764 lastSensorData[PA_PWR_WARN] != result[PA_PWR_WARN])
772 if (lastSensorData.size() < PA_N ||
773 lastSensorData[PA_DEW_1] != result[PA_DEW_1] || lastSensorData[PA_DEW_2] != result[PA_DEW_2])
779 bool autodew = std::stoi(result[PA_AUTO_DEW]);
781 if (lastSensorData.size() < PA_N || lastSensorData[PA_AUTO_DEW] != result[PA_AUTO_DEW])
787 bool changed =
false;
793 LOGF_INFO(
"Auto dew on, enabling channel %s", (i == 0 ?
"A" :
"B"));
802 lastSensorData = result;
810bool PegasusPPBA::getConsumptionData()
812 char res[PEGASUS_LEN] = {0};
813 if (sendCommand(
"PS", res))
815 std::vector<std::string> result = split(res,
":");
816 if (result.size() < PS_N)
818 LOG_WARN(
"Received wrong number of detailed consumption data. Retrying...");
822 if (result == lastConsumptionData)
826 PowerStatisticsNP[STATS_AVG_AMPS].setValue(std::stod(result[PS_AVG_AMPS]));
827 PowerStatisticsNP[STATS_AMP_HOURS].setValue(std::stod(result[PS_AMP_HOURS]));
828 PowerStatisticsNP[STATS_WATT_HOURS].setValue(std::stod(result[PS_WATT_HOURS]));
830 if (lastConsumptionData.size() < PS_N ||
831 lastConsumptionData[PS_AVG_AMPS] != result[PS_AVG_AMPS] ||
832 lastConsumptionData[PS_AMP_HOURS] != result[PS_AMP_HOURS] ||
833 lastConsumptionData[PS_WATT_HOURS] != result[PS_WATT_HOURS])
834 PowerStatisticsNP.
apply();
836 lastConsumptionData = result;
844bool PegasusPPBA::getAutoDewAggression()
846 char res[PEGASUS_LEN] = {0};
847 if (sendCommand(
"DA", res))
851 sscanf(res,
"%*[^:]:%d", &value);
852 AutoDewSettingsNP[AUTO_DEW_AGGRESSION].setValue(100 * value / 255);
857 AutoDewSettingsNP.
apply();
861bool PegasusPPBA::getMetricsData()
863 char res[PEGASUS_LEN] = {0};
864 if (sendCommand(
"PC", res))
866 std::vector<std::string> result = split(res,
":");
867 if (result.size() < PC_N)
869 LOG_WARN(
"Received wrong number of detailed metrics data. Retrying...");
873 if (result == lastMetricsData)
877 PowerStatisticsNP[STATS_TOTAL_CURRENT].setValue(std::stod(result[PC_TOTAL_CURRENT]));
882 if (lastMetricsData.size() < PC_N || lastMetricsData[PC_12V_CURRENT] != result[PC_12V_CURRENT])
893 if (lastMetricsData.size() < PC_N ||
894 lastMetricsData[PC_TOTAL_CURRENT] != result[PC_TOTAL_CURRENT] ||
895 lastMetricsData[PC_DEWA_CURRENT] != result[PC_DEWA_CURRENT] ||
896 lastMetricsData[PC_DEWB_CURRENT] != result[PC_DEWB_CURRENT])
900 PowerStatisticsNP.
apply();
903 std::chrono::milliseconds uptime(std::stol(result[PC_UPTIME]));
904 using dhours = std::chrono::duration<double, std::ratio<3600 >>;
905 std::stringstream ss;
906 ss << std::fixed << std::setprecision(3) << dhours(uptime).count();
907 FirmwareTP[FIRMWARE_UPTIME].setText(ss.str().c_str());
910 lastMetricsData = result;
918bool PegasusPPBA::reboot()
920 return sendCommand(
"PF",
nullptr);
928 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
929 snprintf(
cmd, PEGASUS_LEN,
"XS:3#%u", targetTicks);
946 return sendCommand(
"XS:6",
nullptr);
954 char cmd[PEGASUS_LEN] = {0};
955 snprintf(
cmd, PEGASUS_LEN,
"XS:8#%d", enabled ? 1 : 0);
956 return sendCommand(
cmd,
nullptr);
964 char cmd[PEGASUS_LEN] = {0};
965 snprintf(
cmd, PEGASUS_LEN,
"XS:5#%u", ticks);
966 return sendCommand(
cmd,
nullptr);
974 char cmd[PEGASUS_LEN] = {0};
975 snprintf(
cmd, PEGASUS_LEN,
"XS:10#%d", steps);
976 return sendCommand(
cmd,
nullptr);
982bool PegasusPPBA::setFocuserMaxSpeed(uint16_t maxSpeed)
984 char cmd[PEGASUS_LEN] = {0};
985 snprintf(
cmd, PEGASUS_LEN,
"XS:7#%d", maxSpeed);
986 return sendCommand(
cmd,
nullptr);
989bool PegasusPPBA::setFocuserMicrosteps(
int value)
991 char cmd[PEGASUS_LEN] = {0};
992 snprintf(
cmd, PEGASUS_LEN,
"XS:9#%d", value);
993 return sendCommand(
cmd,
nullptr);
1001 char cmd[PEGASUS_LEN] = {0};
1002 snprintf(
cmd, PEGASUS_LEN,
"XS:8#%d", enabled ? 1 : 0);
1003 return sendCommand(
cmd,
nullptr);
1009bool PegasusPPBA::getXMCStartupData()
1011 char res[PEGASUS_LEN] = {0};
1014 if (sendCommand(
"XS:2", res))
1016 uint32_t position = 0;
1017 sscanf(res,
"%*[^#]#%d", &position);
1022 if (sendCommand(
"XS:7", res))
1025 sscanf(res,
"%*[^#]#%d", &speed);
1026 FocuserSettingsNP[SETTING_MAX_SPEED].setValue(speed);
1035void PegasusPPBA::queryXMC()
1037 char res[PEGASUS_LEN] = {0};
1038 uint32_t position = 0;
1039 uint32_t motorRunning = 0;
1042 if (sendCommand(
"XS:1", res))
1043 sscanf(res,
"%*[^#]#%d", &motorRunning);
1045 if (sendCommand(
"XS:2", res))
1046 sscanf(res,
"%*[^#]#%d", &position);
1058 else if (lastPosition != position)
1065std::vector<std::string> PegasusPPBA::split(
const std::string &input,
const std::string ®ex)
1068 std::regex re(regex);
1069 std::sregex_token_iterator
1070 first{input.begin(), input.end(), re, -1},
1072 return {first, last};
1081 return setPowerEnabled(port + 1, enabled);
1088 auto pwmValue =
static_cast<uint8_t
>(dutyCycle / 100.0 * 255.0);
1089 return setDewPWM(port + 3, enabled ? pwmValue : 0);
1094 return setLedIndicator(enabled);
1100 return setAutoDewEnabled(enabled);
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the initial connection to the devic...
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
const char * getDeviceName() const
INDI::PropertyText getText(const char *name) const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
virtual bool initProperties()
Initialize properties initial state and value. The child class must implement this function.
void syncDriverInfo()
syncDriverInfo sends the current driver information to the client.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
uint32_t getDriverInterface() const
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
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 interface to implement focuser functionality.
INDI::PropertyNumber FocusRelPosNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
void initProperties(const char *groupName)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
INDI::PropertyNumber FocusAbsPosNP
INDI::PropertySwitch DewChannelsSP
bool saveConfigItems(FILE *fp)
saveConfigItems Save power properties in config file
INDI::PropertySwitch AutoDewSP
void SetCapability(uint32_t cap)
SetPowerCapability sets the Power capabilities. All capabilities must be initialized.
@ POWER_HAS_VOLTAGE_SENSOR
@ POWER_HAS_OVERALL_CURRENT
@ POWER_HAS_PER_PORT_CURRENT
INDI::PropertyNumber PowerSensorsNP
INDI::PropertyNumber PowerChannelCurrentNP
INDI::PropertyNumber DewChannelCurrentNP
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process Power number properties.
void initProperties(const char *groupName, size_t nPowerPorts=0, size_t nDewPorts=0, size_t nVariablePorts=0, size_t nAutoDewPorts=0, size_t nUSBPorts=0)
Initialize Power properties. It is recommended to call this function within initProperties() of your ...
INDI::PropertyText PowerChannelLabelsTP
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process Power text properties.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process Power switch properties.
INDI::PropertySwitch PowerChannelsSP
INDI::PropertyNumber DewChannelDutyCycleNP
bool updateProperties()
updateProperties Define or Delete Power properties based on the connection status of the base device
INDI::PropertyText DewChannelLabelsTP
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.
void setLabel(const char *label)
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)
int findOnSwitchIndex() const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
Provides interface to implement weather reporting and safety monitoring functionality.
void addParameter(std::string name, std::string label, double numMinOk, double numMaxOk, double percWarning, bool flipWarning=false)
Add a physical weather measurable parameter to the weather driver.
bool setCriticalParameter(std::string name)
setCriticalParameter Set parameter that is considered critical to the operation of the observatory....
bool syncCriticalParameters()
Synchronize and update the state of all critical parameters.
void setParameterValue(std::string name, double value)
setParameterValue Update weather parameter value
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process weather number properties.
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save parameters ranges in the config file.
INDI::PropertyNumber ParametersNP
void initProperties(const char *statusGroup, const char *paramsGroup)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
INDI::PropertyLight critialParametersLP
virtual bool SetPowerPort(size_t port, bool enabled) override
Power Interface Implementations.
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
const char * getDefaultName() override
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
virtual bool SetFocuserBacklashEnabled(bool enabled) override
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual bool SetDewPort(size_t port, bool enabled, double dutyCycle) override
SetDewPort Set DEW/Dew port duty cycle.
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, 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 SetUSBPort(size_t port, bool enabled) override
SetUSBPort Set USB port on/off.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool SetLEDEnabled(bool enabled) override
SetLEDEnabled Enable/disable power LEDs.
virtual bool CyclePower() override
CyclePower Cycle power to all ports.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool SetAutoDewEnabled(size_t port, bool enabled) override
SetAutoDewEnabled Enable/disable automatic dew control.
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.
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
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
Implementations for common driver routines.
#define LOGF_INFO(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOGF_ERROR(fmt,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.