38static constexpr const int PEGASUS_LEN = 128;
41static std::unique_ptr<PegasusUPB3> upb3(
new PegasusUPB3());
44 INDI::FocuserInterface(this),
45 INDI::WeatherInterface(this),
46 INDI::PowerInterface(this),
51 lastSensorData.reserve(25);
52 lastPowerData.reserve(5);
53 lastStepperData.reserve(6);
54 lastAutoDewData.reserve(4);
59 return "Pegasus UPB3";
65bool PegasusUPB3::Handshake()
67 char response[PEGASUS_LEN] = {0};
75 snprintf(response, PEGASUS_LEN,
"UPBv3:1.0");
80 int tty_rc = 0, nbytes_written = 0;
81 char command[PEGASUS_LEN] = {0};
82 tcflush(PortFD, TCIOFLUSH);
83 strncpy(command,
"P#\n", PEGASUS_LEN);
88 LOGF_ERROR(
"Serial write error: %s", errorMessage);
98 tcflush(PortFD, TCIOFLUSH);
101 tty_rc =
tty_nread_section(PortFD, response, PEGASUS_LEN, stopChar, 1, &nbytes_read);
108 LOGF_ERROR(
"Serial read error: %s", errorMessage);
113 cleanupResponse(response);
114 tcflush(PortFD, TCIOFLUSH);
119 setupComplete =
false;
122 if (strstr(response,
"UPBv3") ==
nullptr)
124 LOG_ERROR(
"Device not recognized as UPBv3. Please check connection.");
134bool PegasusUPB3::setPowerEnabled(uint8_t port, uint8_t value)
136 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
137 snprintf(
cmd, PEGASUS_LEN,
"P%d:%d", port, value);
138 if (sendCommand(
cmd, res))
140 return (!strcmp(res,
cmd));
145bool PegasusUPB3::setPowerLEDEnabled(
bool enabled)
147 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
148 snprintf(
cmd, PEGASUS_LEN,
"PL:%d", enabled ? 1 : 0);
149 if (sendCommand(
cmd, res))
151 return (!strcmp(res,
cmd));
156bool PegasusUPB3::setBuckVoltage(uint8_t voltage)
158 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
159 snprintf(
cmd, PEGASUS_LEN,
"PJ:%d", voltage);
160 if (sendCommand(
cmd, res))
162 return (!strcmp(res,
cmd));
167bool PegasusUPB3::setBoostVoltage(uint8_t voltage)
169 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
170 snprintf(
cmd, PEGASUS_LEN,
"PB:%d", voltage);
171 if (sendCommand(
cmd, res))
173 return (!strcmp(res,
cmd));
178bool PegasusUPB3::setBuckEnabled(
bool enabled)
180 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
181 snprintf(
cmd, PEGASUS_LEN,
"PJ:%d", enabled ? 1 : 0);
182 if (sendCommand(
cmd, res))
184 return (!strcmp(res,
cmd));
189bool PegasusUPB3::setBoostEnabled(
bool enabled)
191 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
192 snprintf(
cmd, PEGASUS_LEN,
"PB:%d", enabled ? 1 : 0);
193 if (sendCommand(
cmd, res))
195 return (!strcmp(res,
cmd));
200bool PegasusUPB3::setAutoDewEnabled(uint8_t port,
bool enabled)
203 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
211 if (port == 1) dew1 = enabled;
212 else if (port == 2) dew2 = enabled;
213 else if (port == 3) dew3 = enabled;
215 snprintf(
cmd, PEGASUS_LEN,
"ADW:%d:%d:%d", dew1 ? 1 : 0, dew2 ? 1 : 0, dew3 ? 1 : 0);
216 if (sendCommand(
cmd, res))
218 return (!strcmp(res,
cmd));
223bool PegasusUPB3::setAutoDewAgg(uint8_t value)
225 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
226 snprintf(
cmd, PEGASUS_LEN,
"DA:%d", value);
227 if (sendCommand(
cmd, res))
229 return (!strcmp(res,
cmd));
234bool PegasusUPB3::setDewPWM(uint8_t
id, uint8_t value)
236 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
237 snprintf(
cmd, PEGASUS_LEN,
"D%d:%d",
id, value);
238 if (sendCommand(
cmd, res))
240 return (!strcmp(res,
cmd));
245bool PegasusUPB3::setUSBPortEnabled(uint8_t port,
bool enabled)
247 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
248 snprintf(
cmd, PEGASUS_LEN,
"U%d:%d", port, enabled ? 1 : 0);
249 if (sendCommand(
cmd, res))
251 return (!strcmp(res,
cmd));
256bool PegasusUPB3::setRelay(
bool enabled)
258 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
259 snprintf(
cmd, PEGASUS_LEN,
"RL:%d", enabled ? 1 : 0);
260 if (sendCommand(
cmd, res))
262 return (!strcmp(res,
cmd));
267bool PegasusUPB3::setFocuserMaxSpeed(uint16_t maxSpeed)
269 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
270 snprintf(
cmd, PEGASUS_LEN,
"SS:%d", maxSpeed);
271 if (sendCommand(
cmd, res))
273 return (!strcmp(res,
cmd));
278bool PegasusUPB3::setFocuserMicrostepping(uint8_t value)
280 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
281 snprintf(
cmd, PEGASUS_LEN,
"MSTEP:%d", value);
282 if (sendCommand(
cmd, res))
284 return (!strcmp(res,
cmd));
289bool PegasusUPB3::setFocuserCurrentLimit(uint16_t value)
291 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
292 snprintf(
cmd, PEGASUS_LEN,
"MCUR:%d", value);
293 if (sendCommand(
cmd, res))
295 return (!strcmp(res,
cmd));
300bool PegasusUPB3::setFocuserHoldTorque(
bool enabled)
302 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
303 snprintf(
cmd, PEGASUS_LEN,
"MHLD:%d", enabled ? 1 : 0);
304 if (sendCommand(
cmd, res))
306 return (!strcmp(res,
cmd));
311bool PegasusUPB3::setPowerOnBoot()
313 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
314 snprintf(
cmd, PEGASUS_LEN,
"PS");
315 if (sendCommand(
cmd, res))
322bool PegasusUPB3::getPowerOnBoot()
331bool PegasusUPB3::setupParams()
337bool PegasusUPB3::sendFirmware()
339 char res[PEGASUS_LEN] = {0};
340 if (sendCommand(
"PV", res))
343 FirmwareTP[FIRMWARE_VERSION].setText(res);
350bool PegasusUPB3::getSensorData()
352 char res[PEGASUS_LEN] = {0};
353 if (sendCommand(
"PA", res))
355 std::vector<std::string> result = split(res,
":");
358 if (result.size() < 13)
360 LOGF_WARN(
"Received wrong number (%i) of sensor data (%s). Expected 13.", result.size(), res);
364 if (result == lastSensorData)
377 if (sensorUpdated(result, 1, 6))
384 if (sensorUpdated(result, 7, 9))
389 m_RelayState = (std::stoi(result[12]) == 1);
391 lastSensorData = result;
397bool PegasusUPB3::getPowerData()
399 char res[PEGASUS_LEN] = {0};
400 if (sendCommand(
"PC", res))
402 std::vector<std::string> result = split(res,
":");
403 if (result.size() < 3)
405 LOGF_WARN(
"Received wrong number (%i) of power data (%s). Retrying...", result.size(), res);
409 if (result == lastPowerData)
412 PowerConsumptionNP[CONSUMPTION_AVG_AMPS].setValue(std::stod(result[1]));
413 PowerConsumptionNP[CONSUMPTION_AMP_HOURS].setValue(std::stod(result[2]));
414 PowerConsumptionNP[CONSUMPTION_WATT_HOURS].setValue(std::stod(result[3]));
416 PowerConsumptionNP.
apply();
418 if (result.size() >= 5)
420 FirmwareTP[FIRMWARE_UPTIME].setText(result[4].c_str());
424 lastPowerData = result;
430bool PegasusUPB3::getStepperData()
432 char res[PEGASUS_LEN] = {0};
433 if (sendCommand(
"SA", res))
435 std::vector<std::string> result = split(res,
":");
436 if (result.size() < 5)
438 LOGF_WARN(
"Received wrong number (%i) of stepper data (%s). Retrying...", result.size(), res);
442 if (result == lastStepperData)
446 focusMotorRunning = (std::stoi(result[2]) == 1);
455 else if (stepperUpdated(result, 1))
461 if (stepperUpdated(result, 3))
464 lastStepperData = result;
470bool PegasusUPB3::getAutoDewData()
472 char res[PEGASUS_LEN] = {0};
473 if (sendCommand(
"PD", res))
475 std::vector<std::string> result = split(res,
":");
476 if (result.size() < 2)
481 if (result == lastAutoDewData)
484 lastAutoDewData = result;
490bool PegasusUPB3::getUSBStatus()
492 char res[PEGASUS_LEN] = {0};
493 if (sendCommand(
"UA", res))
495 std::vector<std::string> result = split(res,
":");
498 if (result.size() < 9)
504 bool changed =
false;
507 auto newState = (std::stoi(result[i + 1]) == 1) ?
ISS_ON :
ISS_OFF;
523bool PegasusUPB3::getInputVoltageCurrentData()
525 char res[PEGASUS_LEN] = {0};
526 if (sendCommand(
"VR", res))
528 std::vector<std::string> result = split(res,
":");
530 if (result.size() < 3)
536 if (result == lastVRData)
540 double voltage = std::stod(result[1]);
541 double current = std::stod(result[2]);
542 double power = voltage * current;
556bool PegasusUPB3::getEnvironmentalData()
558 char res[PEGASUS_LEN] = {0};
559 if (sendCommand(
"ES", res))
561 std::vector<std::string> result = split(res,
":");
563 if (result.size() < 4)
569 if (result == lastESData)
596 return setPowerEnabled(port + 1, enabled ? 100 : 0);
602 auto pwmValue =
static_cast<uint8_t
>(dutyCycle / 100.0 * 255.0);
603 return setDewPWM(port + 1, enabled ? pwmValue : 0);
612 return setBuckVoltage(
static_cast<uint8_t
>(voltage));
614 return setBuckEnabled(
false);
619 return setBoostVoltage(
static_cast<uint8_t
>(voltage));
621 return setBoostEnabled(
false);
628 return setPowerLEDEnabled(enabled);
633 return setAutoDewEnabled(port + 1, enabled);
639 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
642 for (
int i = 1; i <= 6; i++)
644 snprintf(
cmd, PEGASUS_LEN,
"P%d:0", i);
645 sendCommand(
cmd, res);
652 for (
int i = 1; i <= 6; i++)
654 snprintf(
cmd, PEGASUS_LEN,
"P%d:100", i);
655 sendCommand(
cmd, res);
663 return setUSBPortEnabled(port + 1, enabled);
675 auto newState = m_RelayState ? 1 : 0;
677 if (oldState != newState)
696 if (setRelay(enabled))
698 m_RelayState = enabled;
710 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
711 snprintf(
cmd, PEGASUS_LEN,
"SM:%u", targetTicks);
712 if (sendCommand(
cmd, res))
721 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
722 snprintf(
cmd, PEGASUS_LEN,
"SG:%c%u", dir ==
FOCUS_INWARD ?
'-' :
'+', ticks);
723 if (sendCommand(
cmd, res))
732 char res[PEGASUS_LEN] = {0};
733 if (sendCommand(
"SH", res))
735 return strstr(res,
"SH:1") !=
nullptr;
742 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
743 snprintf(
cmd, PEGASUS_LEN,
"SR:%d", enabled ? 1 : 0);
744 if (sendCommand(
cmd, res))
746 return (!strcmp(res,
cmd));
753 char cmd[PEGASUS_LEN] = {0}, res[PEGASUS_LEN] = {0};
754 snprintf(
cmd, PEGASUS_LEN,
"SC:%u", ticks);
755 if (sendCommand(
cmd, res))
757 return (!strcmp(res,
cmd));
796 PowerOnBootSP.
update(states, names, n);
798 PowerOnBootSP.
apply();
816 return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
829 if (setAutoDewAgg(
static_cast<uint8_t
>(values[0])))
831 AutoDewAggNP[0].setValue(values[0]);
838 AutoDewAggNP.
apply();
845 AutoDewAggPerPortNP.
update(values, names, n);
847 AutoDewAggPerPortNP.
apply();
855 FocuserSettingsNP.
update(values, names, n);
857 setFocuserMaxSpeed(
static_cast<uint16_t
>(FocuserSettingsNP[SETTING_MAX_SPEED].getValue()));
858 setFocuserMicrostepping(
static_cast<uint8_t
>(FocuserSettingsNP[SETTING_MICROSTEPPING].getValue()));
859 setFocuserCurrentLimit(
static_cast<uint16_t
>(FocuserSettingsNP[SETTING_CURRENT_LIMIT].getValue()));
860 setFocuserHoldTorque(
static_cast<bool>(FocuserSettingsNP[SETTING_HOLD_TORQUE].getValue()));
863 FocuserSettingsNP.
apply();
917 AutoDewAggNP.
save(fp);
918 AutoDewAggPerPortNP.
save(fp);
919 FocuserSettingsNP.
save(fp);
920 PowerOnBootSP.
save(fp);
942 getInputVoltageCurrentData();
943 getEnvironmentalData();
953bool PegasusUPB3::sendCommand(
const char *
cmd,
char * res)
955 int nbytes_read = 0, nbytes_written = 0, tty_rc = 0;
961 if (!strcmp(
cmd,
"PV"))
963 strncpy(res,
"PV:1.0", PEGASUS_LEN);
967 snprintf(res, PEGASUS_LEN,
"%s",
cmd);
972 for (
int i = 0; i < 2; i++)
974 char command[PEGASUS_LEN] = {0};
975 tcflush(PortFD, TCIOFLUSH);
976 snprintf(command, PEGASUS_LEN,
"%s\n",
cmd);
982 tcflush(PortFD, TCIOFLUSH);
990 tcflush(PortFD, TCIOFLUSH);
992 cleanupResponse(res);
1001 LOGF_ERROR(
"Serial error: %s", errorMessage);
1010void PegasusUPB3::cleanupResponse(
char *response)
1012 std::string s(response);
1013 s.erase(std::remove_if(s.begin(), s.end(),
1016 return std::isspace(x);
1018 snprintf(response, PEGASUS_LEN,
"%s", s.c_str());
1024std::vector<std::string> PegasusUPB3::split(
const std::string &input,
const std::string ®ex)
1027 std::regex re(regex);
1028 std::sregex_token_iterator
1029 first{input.begin(), input.end(), re, -1},
1031 return {first, last};
1037bool PegasusUPB3::sensorUpdated(
const std::vector<std::string> &result, uint8_t start, uint8_t end)
1039 if (lastSensorData.empty())
1042 for (uint8_t index = start; index <= end; index++)
1044 if (index >= lastSensorData.size() || result[index] != lastSensorData[index])
1054bool PegasusUPB3::stepperUpdated(
const std::vector<std::string> &result, uint8_t index)
1056 if (lastStepperData.empty())
1059 return index >= lastStepperData.size() || result[index] != lastStepperData[index];
1065bool PegasusUPB3::reboot()
1067 return sendCommand(
"PF",
nullptr);
1090 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -15, 35, 15);
1091 addParameter(
"WEATHER_HUMIDITY",
"Humidity %", 0, 100, 15);
1092 addParameter(
"WEATHER_DEWPOINT",
"Dew Point (C)", 0, 100, 15);
1133 RebootSP[0].
fill(
"REBOOT",
"Reboot Device",
ISS_OFF);
1137 PowerConsumptionNP[CONSUMPTION_AVG_AMPS].
fill(
"CONSUMPTION_AVG_AMPS",
"Avg. Amps",
"%4.2f", 0, 999, 100, 0);
1138 PowerConsumptionNP[CONSUMPTION_AMP_HOURS].
fill(
"CONSUMPTION_AMP_HOURS",
"Amp Hours",
"%4.2f", 0, 999, 100, 0);
1139 PowerConsumptionNP[CONSUMPTION_WATT_HOURS].
fill(
"CONSUMPTION_WATT_HOURS",
"Watt Hours",
"%4.2f", 0, 999, 100, 0);
1143 PowerOnBootSP[POWER_PORT_1].
fill(
"POWER_PORT_1",
"Power Port 1",
ISS_ON);
1144 PowerOnBootSP[POWER_PORT_2].
fill(
"POWER_PORT_2",
"Power Port 2",
ISS_ON);
1145 PowerOnBootSP[POWER_PORT_3].
fill(
"POWER_PORT_3",
"Power Port 3",
ISS_ON);
1146 PowerOnBootSP[POWER_PORT_4].
fill(
"POWER_PORT_4",
"Power Port 4",
ISS_ON);
1147 PowerOnBootSP[POWER_PORT_5].
fill(
"POWER_PORT_5",
"Power Port 5",
ISS_ON);
1148 PowerOnBootSP[POWER_PORT_6].
fill(
"POWER_PORT_6",
"Power Port 6",
ISS_ON);
1152 OverCurrentLP[OC_POWER_1].
fill(
"OC_POWER_1",
"Power Port 1",
IPS_OK);
1153 OverCurrentLP[OC_POWER_2].
fill(
"OC_POWER_2",
"Power Port 2",
IPS_OK);
1154 OverCurrentLP[OC_POWER_3].
fill(
"OC_POWER_3",
"Power Port 3",
IPS_OK);
1155 OverCurrentLP[OC_POWER_4].
fill(
"OC_POWER_4",
"Power Port 4",
IPS_OK);
1156 OverCurrentLP[OC_POWER_5].
fill(
"OC_POWER_5",
"Power Port 5",
IPS_OK);
1157 OverCurrentLP[OC_POWER_6].
fill(
"OC_POWER_6",
"Power Port 6",
IPS_OK);
1158 OverCurrentLP[OC_DEW_1].
fill(
"OC_DEW_1",
"Dew A",
IPS_OK);
1159 OverCurrentLP[OC_DEW_2].
fill(
"OC_DEW_2",
"Dew B",
IPS_OK);
1160 OverCurrentLP[OC_DEW_3].
fill(
"OC_DEW_3",
"Dew C",
IPS_OK);
1164 AutoDewAggNP[AUTO_DEW_AGG].
fill(
"AUTO_DEW_AGG_VALUE",
"Global (0-10)",
"%.f", 0, 10, 1, 5);
1168 AutoDewAggPerPortNP[AUTO_DEW_AGG_1].
fill(
"AUTO_DEW_AGG_1",
"Port 1 (1-10)",
"%.f", 1, 10, 1, 5);
1169 AutoDewAggPerPortNP[AUTO_DEW_AGG_2].
fill(
"AUTO_DEW_AGG_2",
"Port 2 (1-10)",
"%.f", 1, 10, 1, 5);
1170 AutoDewAggPerPortNP[AUTO_DEW_AGG_3].
fill(
"AUTO_DEW_AGG_3",
"Port 3 (1-10)",
"%.f", 1, 10, 1, 5);
1174 FocuserSettingsNP[SETTING_MAX_SPEED].
fill(
"SETTING_MAX_SPEED",
"Max Speed",
"%.f", 0, 1000, 100, 400);
1175 FocuserSettingsNP[SETTING_MICROSTEPPING].
fill(
"SETTING_MICROSTEPPING",
"Microstepping",
"%.f", 1, 32, 1, 2);
1176 FocuserSettingsNP[SETTING_CURRENT_LIMIT].
fill(
"SETTING_CURRENT_LIMIT",
"Current Limit (mA)",
"%.f", 0, 3000, 100, 1000);
1177 FocuserSettingsNP[SETTING_HOLD_TORQUE].
fill(
"SETTING_HOLD_TORQUE",
"Hold Torque (0/1)",
"%.f", 0, 1, 1, 0);
1181 FirmwareTP[FIRMWARE_VERSION].
fill(
"VERSION",
"Version",
"NA");
1182 FirmwareTP[FIRMWARE_UPTIME].
fill(
"UPTIME",
"Uptime (s)",
"NA");
1236 setupComplete =
true;
1268 setupComplete =
false;
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
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.
bool isSimulation() const
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
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.
INDI::PropertyNumber FocusRelPosNP
INDI::PropertySwitch FocusReverseSP
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
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process number properties.
void initProperties(const char *groupName, uint8_t outputs, const std::string &prefix="Output")
Initialize filter wheel properties. It is recommended to call this function within initProperties() o...
bool processSwitch(const char *dev, const char *name, ISState states[], char *names[], int n)
Process switch properties.
bool saveConfigItems(FILE *fp)
saveConfigItems save Filter Names in config file
std::vector< INDI::PropertySwitch > DigitalOutputsSP
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process text properties.
bool updateProperties()
updateProperties Defines or Delete properties based on default device connection status
bool saveConfigItems(FILE *fp)
saveConfigItems Save power properties in config file
INDI::PropertySwitch AutoDewSP
INDI::PropertyNumber VariableChannelVoltsNP
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::PropertyText VariableChannelLabelsTP
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 ...
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::PropertySwitch USBPortSP
INDI::PropertyNumber DewChannelDutyCycleNP
INDI::PropertyText USBPortLabelsTP
bool updateProperties()
updateProperties Define or Delete Power properties based on the connection status of the base device
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
void setLabel(const char *label)
bool isNameMatch(const char *otherName) const
void fill(const char *device, const char *name, const char *label, const char *group, IPState state)
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)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
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
Provides interface to implement Digital Boolean Output (On/Off) functionality.
virtual bool SetLEDEnabled(bool enabled) override
SetLEDEnabled Enable/disable power LEDs.
virtual bool SetDewPort(size_t port, bool enabled, double dutyCycle) override
SetDewPort Set DEW/Dew port duty cycle.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool initProperties() override
Init Properties.
virtual bool SetUSBPort(size_t port, bool enabled) override
SetUSBPort Set USB port on/off.
virtual void TimerHit() override
Timer Hit.
const char * getDefaultName() override
virtual bool SetFocuserBacklashEnabled(bool enabled) override
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual bool SetVariablePort(size_t port, bool enabled, double voltage) override
SetVariablePort Set variable voltage port.
virtual bool UpdateDigitalOutputs() override
OutputInterface Implementation (Relay)
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
virtual bool updateProperties() override
Update Properties.
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool SetPowerPort(size_t port, bool enabled) override
PowerInterface Implementation.
virtual bool CommandOutput(uint32_t index, OutputState command) override
Send command to output.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
ISNewSwitch.
virtual bool saveConfigItems(FILE *fp) override
Save Config Items.
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
FocuserInterface Implementation.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
ISNewText.
virtual bool SetAutoDewEnabled(size_t port, bool enabled) override
SetAutoDewEnabled Enable/disable automatic dew control.
virtual bool CyclePower() override
CyclePower Cycle power to all ports.
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
ISNewNumber.
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_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.