54 IUFillText(&FirmwareT[0],
"Version",
"Version",
nullptr);
63 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -15, 35, 15);
64 addParameter(
"WEATHER_HUMIDITY",
"Humidity %", 0, 100, 15);
65 addParameter(
"WEATHER_DEWPOINT",
"Dew Point (C)", 0, 100, 15);
68 WeatherOffsetNP[OFFSET_TEMPERATURE].
fill(
"OFFSET_TEMPERATURE",
"Temperature Offset (C)",
"%.1f", -20, 20, 0.1, 0);
69 WeatherOffsetNP[OFFSET_HUMIDITY].
fill(
"OFFSET_HUMIDITY",
"Humidity Offset (%)",
"%.1f", -20, 20, 0.1, 0);
77 DewHeaterNP[0].
fill(
"DEW_HEATER_VALUE",
"Heater (%)",
"%.0f", 0, 100, 1, 0);
80 AutoDewSP[0].
fill(
"AUTO_DEW_ENABLE",
"Enable",
ISS_OFF);
81 AutoDewSP[1].
fill(
"AUTO_DEW_DISABLE",
"Disable",
ISS_ON);
85 CapAngleNP[0].
fill(
"CAP_ANGLE_VALUE",
"Angle (°)",
"%.0f", 0, 270, 1, 270);
89 DeviceStatusNP[STATUS_LIGHT_INTENSITY].
fill(
"STATUS_LIGHT_INTENSITY",
"Light Intensity",
"%.0f", 0, 100, 1, 0);
90 DeviceStatusNP[STATUS_LIGHT_ACTIVE].
fill(
"STATUS_LIGHT_ACTIVE",
"Light Active",
"%.0f", 0, 1, 1, 0);
91 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].
fill(
"STATUS_CAP_ACTUAL",
"Cap Actual Angle (°)",
"%.0f", 0, 270, 1, 0);
92 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].
fill(
"STATUS_CAP_TARGET",
"Cap Target Angle (°)",
"%.0f", 0, 270, 1, 0);
93 DeviceStatusNP[STATUS_CAP_STATUS].
fill(
"STATUS_CAP_STATUS",
"Cap Status",
"%.0f", 0, 9999, 1, 0);
94 DeviceStatusNP[STATUS_DEW_POWER].
fill(
"STATUS_DEW_POWER",
"Dew Power",
"%.0f", 0, 100, 1, 0);
95 DeviceStatusNP[STATUS_AUTO_DEW].
fill(
"STATUS_AUTO_DEW",
"Auto Dew Active",
"%.0f", 0, 1, 1, 0);
96 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].
fill(
"STATUS_DEW_AGGRESSIVE",
"Dew Aggressiveness (0-10)",
"%.0f", 0, 10, 1, 0);
97 DeviceStatusNP[STATUS_LIGHT_SENSOR].
fill(
"STATUS_LIGHT_SENSOR",
"Light Sensor",
"%.0f", 0, 100, 1, 0);
101 UptimeNP[0].
fill(
"UPTIME_SECONDS",
"Uptime (s)",
"%.0f", 0, 1e9, 1, 0);
109 DewAggressivenessNP[0].
fill(
"DEW_AGGRESSIVENESS_VALUE",
"Aggressiveness (0-10)",
"%.0f", 0, 10, 1, 5);
113 ThresholdNP[0].
fill(
"THRESHOLD_VALUE",
"Threshold (1-50)",
"%.0f", 1, 50, 1, 10);
117 WifiChannelNP[0].
fill(
"WIFI_CHANNEL_VALUE",
"Channel (1-11)",
"%.0f", 1, 11, 1, 6);
121 SaveDewSP[0].
fill(
"SAVE_DEW_LEVELS",
"Save",
ISS_OFF);
125 AutoCloseSP[0].
fill(
"AUTO_CLOSE_ENABLE",
"Enable",
ISS_OFF);
126 AutoCloseSP[1].
fill(
"AUTO_CLOSE_DISABLE",
"Disable",
ISS_ON);
130 HotspotStatusSP[0].
fill(
"HOTSPOT_ENABLE",
"Enable",
ISS_OFF);
131 HotspotStatusSP[1].
fill(
"HOTSPOT_DISABLE",
"Disable",
ISS_ON);
135 HotspotCredentialsTP[0].
fill(
"HOTSPOT_SSID",
"SSID",
nullptr);
136 HotspotCredentialsTP[1].
fill(
"HOTSPOT_PASSWORD",
"Password",
nullptr);
140 CurrentWifiTP[0].
fill(
"CURRENT_WIFI",
"Connection",
nullptr);
146 WifiScanTP[0].
fill(
"WIFI_SCAN_RESULTS",
"Networks",
nullptr);
150 WifiConnectTP[0].
fill(
"WIFI_SSID",
"SSID",
nullptr);
151 WifiConnectTP[1].
fill(
"WIFI_PASSWORD",
"Password",
nullptr);
153 WifiConnectSP[0].
fill(
"WIFI_CONNECT",
"Connect",
ISS_OFF);
157 WifiFactoryResetSP[0].
fill(
"WIFI_FACTORY_RESET",
"Reset",
ISS_OFF);
258 return "Pegasus FlatMaster Neo";
261void PegasusFlatMasterNeo::updateFirmwareVersion()
263 char response[16] = {0};
265 if(sendCommand(
"FV", response))
278bool PegasusFlatMasterNeo::Ack()
282 char response[16] = {0};
283 if (sendCommand(
"F#", response))
285 if (strstr(response,
"FMNEO") !=
nullptr)
287 updateFirmwareVersion();
291 LOGF_ERROR(
"Ack failed: unexpected response '%s'", response);
297 char response[16] = {0};
300 snprintf(
cmd, 16,
"FE:%d", enable ? 1 : 0);
302 if (!sendCommand(
cmd, response))
304 LOGF_ERROR(
"EnableLightBox: send failed. %s", response);
308 if (strstr(response,
"FE:") ==
nullptr)
310 LOGF_ERROR(
"EnableLightBox: unexpected response '%s'", response);
319 char response[16] = {0};
322 snprintf(
cmd, 16,
"FL:%d", value);
324 if (!sendCommand(
cmd, response))
326 LOGF_ERROR(
"SetLightBoxBrightness: send failed. %s", response);
330 if (strstr(response,
"FL:") ==
nullptr)
332 LOGF_ERROR(
"SetLightBoxBrightness: unexpected response '%s'", response);
344 if (strstr(name,
"WEATHER_"))
354 if (setDewHeater(
static_cast<uint8_t
>(values[0])))
356 DewHeaterNP.
update(values, names, n);
367 if (setCapAngle(
static_cast<uint16_t
>(values[0])))
369 CapAngleNP.
update(values, names, n);
381 for (
int i = 0; i < n; i++)
383 if (strcmp(names[i],
"OFFSET_TEMPERATURE") == 0)
384 ok &= setTemperatureOffset(values[i]);
385 else if (strcmp(names[i],
"OFFSET_HUMIDITY") == 0)
386 ok &= setHumidityOffset(values[i]);
390 WeatherOffsetNP.
update(values, names, n);
395 WeatherOffsetNP.
apply();
401 if (setDewAggressiveness(
static_cast<uint8_t
>(values[0])))
403 DewAggressivenessNP.
update(values, names, n);
408 DewAggressivenessNP.
apply();
414 if (setThreshold(
static_cast<uint8_t
>(values[0])))
416 ThresholdNP.
update(values, names, n);
427 if (setWifiChannel(
static_cast<uint8_t
>(values[0])))
429 WifiChannelNP.
update(values, names, n);
434 WifiChannelNP.
apply();
451 HotspotCredentialsTP.
update(texts, names, n);
452 const char *ssid = HotspotCredentialsTP[0].
getText();
453 const char *pwd = HotspotCredentialsTP[1].
getText();
454 if (ssid && pwd && setHotspot(ssid, pwd))
458 HotspotCredentialsTP.
apply();
464 WifiConnectTP.
update(texts, names, n);
466 WifiConnectTP.
apply();
489 AutoDewSP.
update(states, names, n);
491 if (setAutoDew(enable))
501 char response[16] = {0};
502 sendCommand(
"FQ", response);
505 LOG_INFO(
"Reboot command sent to device.");
521 AutoCloseSP.
update(states, names, n);
523 if (setAutoClose(enable))
533 HotspotStatusSP.
update(states, names, n);
535 if (setHotspotStatus(enable))
539 HotspotStatusSP.
apply();
545 if (scanWifiNetworks())
555 const char *ssid = WifiConnectTP[0].
getText();
556 const char *pwd = WifiConnectTP[1].
getText();
557 if (ssid && connectToWifi(ssid, pwd))
564 WifiConnectSP.
apply();
572 WifiFactoryResetSP.
apply();
573 LOG_INFO(
"WiFi factory reset sent to device.");
593 WeatherOffsetNP.
save(fp);
594 DewHeaterNP.
save(fp);
596 DewAggressivenessNP.
save(fp);
597 ThresholdNP.
save(fp);
599 WifiChannelNP.
save(fp);
603bool PegasusFlatMasterNeo::sendCommand(
const char *command,
char *res,
int timeout_sec)
605 int nbytes_written = 0, nbytes_read = 0, rc = -1;
609 snprintf(
cmd,
sizeof(
cmd),
"%s\n", command);
613 tcflush(PortFD, TCIOFLUSH);
630 res[nbytes_read - 1] = 0;
631 if (nbytes_read > 1 && res[nbytes_read - 2] ==
'\r')
632 res[nbytes_read - 2] = 0;
636 tcflush(PortFD, TCIOFLUSH);
643 char response[16] = {0};
645 if (!sendCommand(
"FS:0", response))
651 if (strstr(response,
"FS:") ==
nullptr)
660 char response[16] = {0};
662 if (!sendCommand(
"FS:1", response))
664 LOGF_ERROR(
"Error on UnParkCap. %s", response);
668 if (strstr(response,
"FS:") ==
nullptr)
677 char response[16] = {0};
678 if (sendCommand(
"FH", response) && strstr(response,
"FH:1") !=
nullptr)
683bool PegasusFlatMasterNeo::setDewHeater(uint8_t value)
686 char response[16] = {0};
687 snprintf(
cmd, 16,
"DH:%d", value);
688 if (sendCommand(
cmd, response))
689 return strstr(response,
"DH:") !=
nullptr;
693bool PegasusFlatMasterNeo::setAutoDew(
bool enable)
696 char response[16] = {0};
697 snprintf(
cmd, 16,
"PD:%d", enable ? 1 : 0);
699 if (!sendCommand(
cmd, response) || strstr(response,
"PD:") ==
nullptr)
702 if (!getStatusData())
705 const bool actual = (DeviceStatusNP[STATUS_AUTO_DEW].getValue() == 1);
706 if (actual != enable)
708 LOGF_ERROR(
"AutoDew %s failed: device reports %s.", enable ?
"enable" :
"disable", actual ?
"enabled" :
"disabled");
715bool PegasusFlatMasterNeo::setCapAngle(uint16_t angle)
718 char response[16] = {0};
719 snprintf(
cmd, 16,
"CD:%d", angle);
720 if (sendCommand(
cmd, response))
721 return strstr(response,
"CD:") !=
nullptr;
741bool PegasusFlatMasterNeo::getStatusData()
743 char response[NEO_LEN] = {0};
745 if (!sendCommand(
"FA", response))
747 LOG_ERROR(
"Error querying device status.");
752 std::vector<std::string> result = split(response,
":");
754 if (result.size() < FA_N)
756 LOGF_WARN(
"Received unexpected FA status format: %s", response);
767 const double lightIntensity = std::stod(result[FA_LIGHT_INTENSITY]);
768 const double lightActive = std::stod(result[FA_LIGHT_ACTIVE]);
769 const double capTargetAngle = std::stod(result[FA_CAP_TARGET_ANGLE]);
770 const double capActualAngle = std::stod(result[FA_CAP_ACTUAL_ANGLE]);
771 const double capStatus = std::stod(result[FA_CAP_STATUS]);
772 const double dewPower = std::stod(result[FA_DEW_POWER]);
773 const double autoDew = std::stod(result[FA_AUTO_DEW_STATUS]);
774 const double dewAggressive = std::stod(result[FA_DEW_AGGRESSIVE]);
775 const double lightSensor = std::stod(result[FA_LIGHT_SENSOR]);
779 DeviceStatusNP[STATUS_LIGHT_INTENSITY].setValue(lightIntensity);
780 DeviceStatusNP[STATUS_LIGHT_ACTIVE].setValue(lightActive);
781 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].setValue(capTargetAngle);
782 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].setValue(capActualAngle);
783 DeviceStatusNP[STATUS_CAP_STATUS].setValue(capStatus);
784 DeviceStatusNP[STATUS_DEW_POWER].setValue(dewPower);
785 DeviceStatusNP[STATUS_AUTO_DEW].setValue(autoDew);
786 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].setValue(dewAggressive);
787 DeviceStatusNP[STATUS_LIGHT_SENSOR].setValue(lightSensor);
789 DeviceStatusNP.
apply();
792 const bool lightOn = (lightActive != 0);
810 if (capStatus == CAP_STATUS_PARKED)
820 else if (capStatus == CAP_STATUS_UNPARKED)
830 if (CapAngleNP[0].getValue() != capTargetAngle)
832 CapAngleNP[0].setValue(capTargetAngle);
837 catch (
const std::exception &e)
839 LOGF_ERROR(
"Error parsing FA status data: %s", e.what());
843 lastStatusData = result;
847bool PegasusFlatMasterNeo::getWeatherOffsets()
849 char response[NEO_LEN] = {0};
851 if (!sendCommand(
"CR", response))
853 LOG_ERROR(
"Error querying weather offsets.");
858 std::vector<std::string> result = split(response,
":");
860 if (result.size() < CR_N)
862 LOGF_WARN(
"Received unexpected CR offset format: %s", response);
868 WeatherOffsetNP[OFFSET_TEMPERATURE].setValue(std::stod(result[CR_TEMP_OFFSET]));
869 WeatherOffsetNP[OFFSET_HUMIDITY].setValue(std::stod(result[CR_HUM_OFFSET]));
871 WeatherOffsetNP.
apply();
873 catch (
const std::exception &e)
875 LOGF_ERROR(
"Error parsing CR offset data: %s", e.what());
882bool PegasusFlatMasterNeo::setTemperatureOffset(
double value)
885 char response[16] = {0};
886 snprintf(
cmd, 16,
"CT:%.1f", value);
887 if (sendCommand(
cmd, response))
888 return strstr(response,
"CT:") !=
nullptr;
892bool PegasusFlatMasterNeo::setHumidityOffset(
double value)
895 char response[16] = {0};
896 snprintf(
cmd, 16,
"CH:%.1f", value);
897 if (sendCommand(
cmd, response))
898 return strstr(response,
"CH:") !=
nullptr;
902bool PegasusFlatMasterNeo::getWeatherData()
904 char response[NEO_LEN] = {0};
906 if (!sendCommand(
"ES", response))
908 LOG_ERROR(
"Error querying weather data.");
914 std::vector<std::string> result = split(response,
":");
916 if (result.size() < WI_N)
918 LOGF_WARN(
"Received unexpected weather data format: %s", response);
922 if (result == lastWeatherData)
931 catch (
const std::exception &e)
933 LOGF_ERROR(
"Error parsing weather data: %s", e.what());
943 lastWeatherData = result;
947bool PegasusFlatMasterNeo::getUptime()
949 char response[16] = {0};
950 if (!sendCommand(
"FU", response))
954 const char *val = strstr(response,
"FU:");
955 UptimeNP[0].setValue(atof(val ? val + 3 : response));
961bool PegasusFlatMasterNeo::getThreshold()
963 char response[16] = {0};
964 if (!sendCommand(
"DT", response))
967 const char *val = strstr(response,
"DT:");
971 int threshold = atoi(val + 3);
972 if (threshold < 1 || threshold > 50)
974 LOGF_WARN(
"DT returned %d which is outside the valid range [1..50], ignoring.", threshold);
978 ThresholdNP[0].setValue(threshold);
984bool PegasusFlatMasterNeo::setThreshold(uint8_t value)
986 if (value < 1 || value > 50)
988 LOGF_ERROR(
"Threshold %d is outside the valid range [1..50].", value);
992 char response[16] = {0};
993 snprintf(
cmd,
sizeof(
cmd),
"DT:%d", value);
994 if (sendCommand(
cmd, response))
995 return strstr(response,
"DT:") !=
nullptr;
1001bool PegasusFlatMasterNeo::setDewAggressiveness(uint8_t level)
1004 char response[16] = {0};
1006 snprintf(
cmd,
sizeof(
cmd),
"DA:%d", level);
1007 if (!sendCommand(
cmd, response) || strstr(response,
"DA:") ==
nullptr)
1010 const uint8_t mapped =
static_cast<uint8_t
>(9 +
static_cast<int>(
round(level * 246.0 / 10.0)));
1011 char cmd2[16] = {0};
1012 char response2[16] = {0};
1013 snprintf(cmd2,
sizeof(cmd2),
"PD:%d", mapped);
1014 if (!sendCommand(cmd2, response2) || strstr(response2,
"PD:") ==
nullptr)
1020bool PegasusFlatMasterNeo::saveDewLevels()
1022 char response[16] = {0};
1023 sendCommand(
"DSTR", response);
1027bool PegasusFlatMasterNeo::getWifiChannel()
1029 char response[16] = {0};
1030 if (!sendCommand(
"AC", response))
1033 int channel = atoi(response);
1034 if (channel < 1 || channel > 11)
1037 WifiChannelNP[0].setValue(channel);
1039 WifiChannelNP.
apply();
1043bool PegasusFlatMasterNeo::setWifiChannel(uint8_t channel)
1046 char response[16] = {0};
1047 snprintf(
cmd,
sizeof(
cmd),
"AC:%d", channel);
1048 if (sendCommand(
cmd, response))
1049 return atoi(response) != 0;
1053bool PegasusFlatMasterNeo::getAutoClose()
1055 char response[16] = {0};
1056 if (!sendCommand(
"DC:99", response))
1059 const bool on = (strstr(response,
"DC:1") !=
nullptr);
1060 AutoCloseSP.
reset();
1063 AutoCloseSP.
apply();
1067bool PegasusFlatMasterNeo::setAutoClose(
bool enable)
1070 char response[16] = {0};
1071 snprintf(
cmd,
sizeof(
cmd),
"DC:%d", enable ? 1 : 0);
1072 if (!sendCommand(
cmd, response))
1074 return strstr(response, enable ?
"DC:1" :
"DC:0") != nullptr;
1077bool PegasusFlatMasterNeo::getHotspotStatus()
1079 char response[16] = {0};
1080 if (!sendCommand(
"A?", response))
1083 const bool on = (response[0] ==
'1');
1084 HotspotStatusSP.
reset();
1087 HotspotStatusSP.
apply();
1091bool PegasusFlatMasterNeo::setHotspotStatus(
bool enable)
1094 char response[16] = {0};
1095 snprintf(
cmd,
sizeof(
cmd),
"AE:%d", enable ? 1 : 0);
1096 sendCommand(
cmd, response);
1097 return getHotspotStatus();
1100bool PegasusFlatMasterNeo::getHotspot()
1102 char response[NEO_LEN] = {0};
1103 if (!sendCommand(
"AL", response))
1107 std::vector<std::string> parts = split(response,
":");
1108 if (parts.size() < 2)
1111 HotspotCredentialsTP[0].setText(parts[0].c_str());
1112 HotspotCredentialsTP[1].setText(parts[1].c_str());
1114 HotspotCredentialsTP.
apply();
1118bool PegasusFlatMasterNeo::setHotspot(
const char *ssid,
const char *password)
1120 char cmd[NEO_LEN] = {0};
1121 char response[16] = {0};
1123 snprintf(
cmd,
sizeof(
cmd),
"AN:%s", ssid);
1124 if (!sendCommand(
cmd, response) || strstr(response,
"AN:") ==
nullptr)
1127 snprintf(
cmd,
sizeof(
cmd),
"AP:%s", password);
1128 if (!sendCommand(
cmd, response) || strstr(response,
"AP:") ==
nullptr)
1134bool PegasusFlatMasterNeo::getCurrentWifi()
1136 char response[NEO_LEN] = {0};
1137 if (!sendCommand(
"WI", response))
1140 if (strcmp(response,
"0") == 0)
1142 CurrentWifiTP[0].setText(
"Disconnected");
1146 CurrentWifiTP[0].setText(response);
1149 CurrentWifiTP.
apply();
1153bool PegasusFlatMasterNeo::scanWifiNetworks()
1155 char response[512] = {0};
1157 if (!sendCommand(
"WS", response, 16))
1160 if (strcmp(response,
"0") == 0)
1161 WifiScanTP[0].setText(
"No networks found");
1163 WifiScanTP[0].setText(response);
1170bool PegasusFlatMasterNeo::connectToWifi(
const char *ssid,
const char *password)
1172 if (!ssid || ssid[0] ==
'\0')
1174 LOG_ERROR(
"WiFi SSID cannot be empty.");
1178 char cmd[NEO_LEN] = {0};
1179 char response[16] = {0};
1181 snprintf(
cmd,
sizeof(
cmd),
"WN:%s", ssid);
1182 if (!sendCommand(
cmd, response) || strstr(response,
"WN:") ==
nullptr)
1186 if (!password || password[0] ==
'\0')
1188 if (!sendCommand(
"WP:PASSWORD", response) || strstr(response,
"WP:") ==
nullptr)
1193 if (strlen(password) < 8)
1195 LOG_ERROR(
"WiFi password must be at least 8 characters.");
1198 snprintf(
cmd,
sizeof(
cmd),
"WP:%s", password);
1199 if (!sendCommand(
cmd, response) || strstr(response,
"WP:") ==
nullptr)
1206bool PegasusFlatMasterNeo::wifiFactoryReset()
1208 char response[16] = {0};
1215std::vector<std::string> PegasusFlatMasterNeo::split(
const std::string &input,
const std::string &sep)
1217 std::vector<std::string> result;
1219 std::sregex_token_iterator it(input.begin(), input.end(), re, -1);
1220 std::sregex_token_iterator end;
1221 for (; it != end; ++it)
1222 result.push_back(it->str());
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 ...
void setPortMatchPattern(const std::string &pattern)
setPortMatchPattern Set a regex pattern used to automatically select a serial port from the discovere...
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
Provides interface to implement remotely controlled dust cover.
const char * getDeviceName() const
virtual bool updateProperties()
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)
Process the client newSwitch command.
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
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 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::PropertySwitch ParkCapSP
bool updateProperties()
updateProperties Defines or Delete properties based on default device connection status
void initProperties(const char *group, uint32_t capabilities=0)
Initialize dust cap properties. It is recommended to call this function within initProperties() of yo...
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process dust cap switch properties.
void initProperties(const char *group, uint32_t capabilities)
Initialize light box properties. It is recommended to call this function within initProperties() of y...
void ISGetProperties(const char *deviceName)
isGetLightBoxProperties Get light box properties
INDI::PropertyNumber LightIntensityNP
bool saveConfigItems(FILE *fp)
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process light box switch properties.
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process light box text properties.
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process light box number properties.
INDI::PropertySwitch LightSP
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.
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const ISState states[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
bool update(const char *const texts[], 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)
INDI::PropertyViewText * getText() const
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 processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process weather switch properties.
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 controllable light box/switch device.
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be implemented in the child class, if supported.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual IPState AbortCap() override
Abort motion. Must be implemented by child.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be implemented in the child class.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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....
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Implementations for common driver routines.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
void IDSetText(const ITextVectorProperty *tvp, const char *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,...)
double round(double value, int decimal_places)