58 IUFillText(&FirmwareT[0],
"Version",
"Version",
nullptr);
67 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -15, 35, 15);
68 addParameter(
"WEATHER_HUMIDITY",
"Humidity %", 0, 100, 15);
69 addParameter(
"WEATHER_DEWPOINT",
"Dew Point (C)", 0, 100, 15);
72 WeatherOffsetNP[OFFSET_TEMPERATURE].fill(
"OFFSET_TEMPERATURE",
"Temperature Offset (C)",
"%.1f", -20, 20, 0.1, 0);
73 WeatherOffsetNP[OFFSET_HUMIDITY].fill(
"OFFSET_HUMIDITY",
"Humidity Offset (%)",
"%.0f", -50, 50, 1, 0);
81 DewHeaterNP[0].fill(
"DEW_HEATER_VALUE",
"Heater (%)",
"%.0f", 0, 100, 1, 0);
84 AutoDewSP[0].fill(
"AUTO_DEW_ENABLE",
"Enable",
ISS_OFF);
85 AutoDewSP[1].fill(
"AUTO_DEW_DISABLE",
"Disable",
ISS_ON);
89 CapAngleNP[0].fill(
"CAP_ANGLE_VALUE",
"Angle (°)",
"%.0f", 0, 270, 1, 270);
93 DeviceStatusNP[STATUS_LIGHT_INTENSITY].fill(
"STATUS_LIGHT_INTENSITY",
"Light Intensity",
"%.0f", 0, 100, 1, 0);
94 DeviceStatusNP[STATUS_LIGHT_ACTIVE].fill(
"STATUS_LIGHT_ACTIVE",
"Light Active",
"%.0f", 0, 1, 1, 0);
95 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].fill(
"STATUS_CAP_ACTUAL",
"Cap Actual Angle (°)",
"%.0f", 0, 270, 1, 0);
96 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].fill(
"STATUS_CAP_TARGET",
"Cap Target Angle (°)",
"%.0f", 0, 270, 1, 0);
97 DeviceStatusNP[STATUS_CAP_STATUS].fill(
"STATUS_CAP_STATUS",
"Cap Status",
"%.0f", 0, 9999, 1, 0);
98 DeviceStatusNP[STATUS_DEW_POWER].fill(
"STATUS_DEW_POWER",
"Dew Power",
"%.0f", 0, 100, 1, 0);
99 DeviceStatusNP[STATUS_AUTO_DEW].fill(
"STATUS_AUTO_DEW",
"Auto Dew Active",
"%.0f", 0, 1, 1, 0);
100 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].fill(
"STATUS_DEW_AGGRESSIVE",
"Dew Aggressiveness (0-10)",
"%.0f", 0, 10, 1, 0);
101 DeviceStatusNP[STATUS_LIGHT_SENSOR].fill(
"STATUS_LIGHT_SENSOR",
"Light Sensor",
"%.0f", 0, 100, 1, 0);
105 UptimeNP[0].fill(
"UPTIME_SECONDS",
"Uptime (s)",
"%.0f", 0, 1e9, 1, 0);
109 RebootSP[0].fill(
"REBOOT",
"Reboot",
ISS_OFF);
113 DewAggressivenessNP[0].fill(
"DEW_AGGRESSIVENESS_VALUE",
"Aggressiveness (0-10)",
"%.0f", 0, 10, 1, 5);
117 ThresholdNP[0].fill(
"THRESHOLD_VALUE",
"Threshold (1-50)",
"%.0f", 1, 50, 1, 10);
123 SaveDewSP[0].fill(
"SAVE_DEW_LEVELS",
"Save",
ISS_OFF);
127 AutoCloseSP[0].fill(
"AUTO_CLOSE_ENABLE",
"Enable",
ISS_OFF);
128 AutoCloseSP[1].fill(
"AUTO_CLOSE_DISABLE",
"Disable",
ISS_ON);
133 WifiFactoryResetSP[0].fill(
"WIFI_FACTORY_RESET",
"Reset",
ISS_OFF);
138 wifi.initProperties(NETWORK_TAB,
139 [
this](
const char *name) {
loadConfig(
true, name); },
142 wifi.allowOpenNetworks(
true);
146 serialConnection->setPortMatchPattern(
"FlatMaster");
147 serialConnection->registerHandshake([&]()
155 tcpConnection->setDefaultHost(
"fmneo.local");
157 tcpConnection->registerHandshake([&]()
171 wifi.ISGetProperties();
194 wifi.updateProperties(
true, PortFD);
214 wifi.updateProperties(
false, -1);
231 return "Pegasus FlatMaster Neo";
234void PegasusFlatMasterNeo::updateFirmwareVersion()
236 char response[16] = {0};
238 if(sendCommand(
"FV", response))
251bool PegasusFlatMasterNeo::Ack()
255 PortFD = m_IsTCP ? tcpConnection->getPortFD() : serialConnection->getPortFD();
256 if (m_IsTCP && !wifi.login(PortFD))
260 char response[NEO_LEN] = {0};
261 if (sendCommand(
"F#", response))
263 if (strstr(response,
"FMNEO") !=
nullptr)
265 updateFirmwareVersion();
269 LOGF_ERROR(
"Ack failed: unexpected response '%s'", response);
276 snprintf(
cmd, 16,
"FE:%d", enable ? 1 : 0);
277 return sendEchoCommand(
cmd);
283 snprintf(
cmd, 16,
"FL:%d", value);
284 if (!sendEchoCommand(
cmd))
294bool PegasusFlatMasterNeo::ignoredWhileLoadingConfig(
const char *dev,
const char *name)
const
297 static const char *
const stored[] = {
"DEW_HEATER",
"CAP_ANGLE",
"WEATHER_OFFSET",
"DEW_AGGRESSIVENESS",
298 "DEW_THRESHOLD",
"WIFI_CHANNEL",
"HOTSPOT_CREDENTIALS",
"AUTO_DEW",
299 "AUTO_CLOSE",
"HOTSPOT_STATUS"
304 for (
const char *property : stored)
305 if (strcmp(name, property) == 0)
312 if (ignoredWhileLoadingConfig(dev, name))
315 if (wifi.ISNewNumber(dev, name, values, names,
n))
321 if (strstr(name,
"WEATHER_"))
329 if (DewHeaterNP.isNameMatch(name))
331 if (setDewHeater(
static_cast<uint8_t
>(values[0])))
333 DewHeaterNP.update(values, names,
n);
334 DewHeaterNP.setState(
IPS_OK);
342 if (CapAngleNP.isNameMatch(name))
344 if (setCapAngle(
static_cast<uint16_t
>(values[0])))
346 CapAngleNP.update(values, names,
n);
347 CapAngleNP.setState(
IPS_OK);
355 if (WeatherOffsetNP.isNameMatch(name))
358 for (
int i = 0; i <
n; i++)
360 if (strcmp(names[i],
"OFFSET_TEMPERATURE") == 0)
361 ok &= setTemperatureOffset(values[i]);
362 else if (strcmp(names[i],
"OFFSET_HUMIDITY") == 0)
363 ok &= setHumidityOffset(values[i]);
366 if (!getWeatherOffsets())
371 WeatherOffsetNP.apply();
376 if (DewAggressivenessNP.isNameMatch(name))
378 if (setDewAggressiveness(
static_cast<uint8_t
>(values[0])))
380 DewAggressivenessNP.update(values, names,
n);
381 DewAggressivenessNP.setState(
IPS_OK);
385 DewAggressivenessNP.apply();
389 if (ThresholdNP.isNameMatch(name))
391 if (setThreshold(
static_cast<uint8_t
>(values[0])))
393 ThresholdNP.update(values, names,
n);
394 ThresholdNP.setState(
IPS_OK);
410 if (ignoredWhileLoadingConfig(dev, name))
413 if (wifi.ISNewText(dev, name, texts, names,
n))
430 if (ignoredWhileLoadingConfig(dev, name))
433 if (wifi.ISNewSwitch(dev, name, states, names,
n))
447 if (AutoDewSP.isNameMatch(name))
449 AutoDewSP.update(states, names,
n);
450 bool enable = AutoDewSP[0].getState() ==
ISS_ON;
451 if (setAutoDew(enable))
452 AutoDewSP.setState(
IPS_OK);
459 if (RebootSP.isNameMatch(name))
463 int nbytes_written = 0;
465 RebootSP.setState(
IPS_OK);
467 LOG_INFO(
"Device restarts. Connect again in a few seconds.");
474 if (SaveDewSP.isNameMatch(name))
477 SaveDewSP.setState(
IPS_OK);
484 if (AutoCloseSP.isNameMatch(name))
486 AutoCloseSP.update(states, names,
n);
487 bool enable = AutoCloseSP[0].getState() ==
ISS_ON;
488 if (setAutoClose(enable))
489 AutoCloseSP.setState(
IPS_OK);
499 if (WifiFactoryResetSP.isNameMatch(name))
502 WifiFactoryResetSP.setState(
IPS_OK);
503 WifiFactoryResetSP.apply();
504 LOG_INFO(
"WiFi factory reset sent to device.");
524 wifi.saveConfigItems(fp);
530bool PegasusFlatMasterNeo::sendCommandBuffer(
const char *command,
char *res,
int res_len,
int timeout_sec)
532 int nbytes_written = 0, nbytes_read = 0, rc = -1;
538 snprintf(
cmd,
sizeof(
cmd), m_IsTCP ?
"%s\r\n" :
"%s\n", command);
541 const bool secret = strncmp(command,
"AP:", 3) == 0 || strncmp(command,
"WP:", 3) == 0;
542 LOGF_DEBUG(
"CMD <%s>", secret ?
"<password>" : command);
558 LOGF_ERROR(
"command: %s error: %s.", command, errstr);
570 tcflush(PortFD, TCIOFLUSH);
575 res[nbytes_read - 1] = 0;
576 if (nbytes_read > 1 && res[nbytes_read - 2] ==
'\r')
577 res[nbytes_read - 2] = 0;
580 LOGF_DEBUG(
"RES <%s>", strcmp(command,
"AL") == 0 ?
"<ssid>:<password>" : secret ?
"<password>" : res);
582 tcflush(PortFD, TCIOFLUSH);
587bool PegasusFlatMasterNeo::sendEchoCommand(
const char *
cmd)
589 char response[32] = {0};
590 if (!sendCommand(
cmd, response))
593 if (strcmp(response,
cmd) != 0)
595 LOGF_ERROR(
"Unexpected response to %s: '%s'",
cmd, response);
603uint8_t PegasusFlatMasterNeo::aggressivenessLevel(
double value)
606 return static_cast<uint8_t
>(std::max(0.0, value));
607 return static_cast<uint8_t
>(std::min(10.0, std::max(0.0,
round((value - 9) * 10.0 / 246.0))));
612 if (!sendEchoCommand(
"FS:0"))
616 m_CapTarget = CAP_STATUS_PARKED;
617 m_CapMoveStarted = std::chrono::steady_clock::now();
623 if (!sendEchoCommand(
"FS:1"))
627 m_CapTarget = CAP_STATUS_UNPARKED;
628 m_CapMoveStarted = std::chrono::steady_clock::now();
634 char response[16] = {0};
635 if (sendCommand(
"FH", response) && strstr(response,
"FH:1") !=
nullptr)
640bool PegasusFlatMasterNeo::setDewHeater(uint8_t value)
643 snprintf(
cmd, 16,
"DH:%d", value);
644 return sendEchoCommand(
cmd);
647bool PegasusFlatMasterNeo::setAutoDew(
bool enable)
650 snprintf(
cmd, 16,
"PD:%d", enable ? 1 : 0);
652 if (!sendEchoCommand(
cmd))
655 if (!getStatusData())
658 const bool actual = (DeviceStatusNP[STATUS_AUTO_DEW].getValue() == 1);
659 if (actual != enable)
661 LOGF_ERROR(
"AutoDew %s failed: device reports %s.", enable ?
"enable" :
"disable", actual ?
"enabled" :
"disabled");
668bool PegasusFlatMasterNeo::setCapAngle(uint16_t angle)
671 snprintf(
cmd, 16,
"CD:%d", angle);
672 return sendEchoCommand(
cmd);
686 wifi.updateConnection();
691bool PegasusFlatMasterNeo::getStatusData()
693 char response[NEO_LEN] = {0};
695 if (!sendCommand(
"FA", response))
697 LOG_ERROR(
"Error querying device status.");
702 std::vector<std::string> result = split(response,
":");
704 if (result.size() < FA_N)
706 LOGF_WARN(
"Received unexpected FA status format: %s", response);
717 const double lightIntensity = std::stod(result[FA_LIGHT_INTENSITY]);
718 const double lightActive = std::stod(result[FA_LIGHT_ACTIVE]);
719 const double capTargetAngle = std::stod(result[FA_CAP_TARGET_ANGLE]);
720 const double capActualAngle = std::stod(result[FA_CAP_ACTUAL_ANGLE]);
721 const double capStatus = std::stod(result[FA_CAP_STATUS]);
722 const double dewPower = std::stod(result[FA_DEW_POWER]);
723 const double autoDew = std::stod(result[FA_AUTO_DEW_STATUS]);
724 const double dewAggressive = std::stod(result[FA_DEW_AGGRESSIVE]);
725 const double lightSensor = std::stod(result[FA_LIGHT_SENSOR]);
729 DeviceStatusNP[STATUS_LIGHT_INTENSITY].setValue(lightIntensity);
730 DeviceStatusNP[STATUS_LIGHT_ACTIVE].setValue(lightActive);
731 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].setValue(capTargetAngle);
732 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].setValue(capActualAngle);
733 DeviceStatusNP[STATUS_CAP_STATUS].setValue(capStatus);
734 DeviceStatusNP[STATUS_DEW_POWER].setValue(dewPower);
735 DeviceStatusNP[STATUS_AUTO_DEW].setValue(autoDew);
736 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].setValue(aggressivenessLevel(dewAggressive));
737 DeviceStatusNP[STATUS_LIGHT_SENSOR].setValue(lightSensor);
738 DeviceStatusNP.setState(
IPS_OK);
739 DeviceStatusNP.apply();
742 const bool lightOn = (lightActive != 0);
760 if (
ParkCapSP.getState() ==
IPS_BUSY && (capStatus == CAP_STATUS_PARKED || capStatus == CAP_STATUS_UNPARKED)
761 && capStatus != m_CapTarget)
764 if (std::chrono::steady_clock::now() - m_CapMoveStarted > CAP_START_TIMEOUT)
766 LOGF_ERROR(
"Cap did not move, it is still %s.", capStatus == CAP_STATUS_PARKED ?
"closed" :
"open");
773 else if (capStatus == CAP_STATUS_PARKED)
783 else if (capStatus == CAP_STATUS_UNPARKED)
793 if (CapAngleNP[0].getValue() != capTargetAngle)
795 CapAngleNP[0].setValue(capTargetAngle);
796 CapAngleNP.setState(
IPS_OK);
801 if (DewHeaterNP[0].getValue() != dewPower || DewHeaterNP.getState() ==
IPS_IDLE)
803 DewHeaterNP[0].setValue(dewPower);
804 DewHeaterNP.setState(
IPS_OK);
807 const bool autoDewOn = (autoDew != 0);
811 AutoDewSP[autoDewOn ? 0 : 1].setState(
ISS_ON);
812 AutoDewSP.setState(
IPS_OK);
815 const uint8_t level = aggressivenessLevel(dewAggressive);
816 if (DewAggressivenessNP[0].getValue() != level || DewAggressivenessNP.getState() ==
IPS_IDLE)
818 DewAggressivenessNP[0].setValue(level);
819 DewAggressivenessNP.setState(
IPS_OK);
820 DewAggressivenessNP.apply();
823 catch (
const std::exception &e)
825 LOGF_ERROR(
"Error parsing FA status data: %s", e.what());
829 lastStatusData = result;
833bool PegasusFlatMasterNeo::getWeatherOffsets()
835 char response[NEO_LEN] = {0};
837 if (!sendCommand(
"CR", response))
839 LOG_ERROR(
"Error querying weather offsets.");
844 std::vector<std::string> result = split(response,
":");
846 if (result.size() < CR_N)
848 LOGF_WARN(
"Received unexpected CR offset format: %s", response);
854 WeatherOffsetNP[OFFSET_TEMPERATURE].setValue(std::stod(result[CR_TEMP_OFFSET]));
855 WeatherOffsetNP[OFFSET_HUMIDITY].setValue(std::stod(result[CR_HUM_OFFSET]));
856 WeatherOffsetNP.setState(
IPS_OK);
857 WeatherOffsetNP.apply();
859 catch (
const std::exception &e)
861 LOGF_ERROR(
"Error parsing CR offset data: %s", e.what());
868bool PegasusFlatMasterNeo::setTemperatureOffset(
double value)
871 char response[16] = {0};
872 snprintf(
cmd, 16,
"CT:%.1f", value);
874 if (!sendCommand(
cmd, response))
880bool PegasusFlatMasterNeo::setHumidityOffset(
double value)
884 snprintf(
cmd, 16,
"CH:%d",
static_cast<int>(std::lround(value)));
885 return sendEchoCommand(
cmd);
888bool PegasusFlatMasterNeo::getWeatherData()
890 char response[NEO_LEN] = {0};
892 if (!sendCommand(
"ES", response))
894 LOG_ERROR(
"Error querying weather data.");
900 std::vector<std::string> result = split(response,
":");
902 if (result.size() < WI_N)
904 LOGF_WARN(
"Received unexpected weather data format: %s", response);
908 if (result == lastWeatherData)
914 const double temperature = std::stod(result[WI_TEMPERATURE]);
917 if (lastWeatherData.empty())
918 LOG_WARN(
"No temperature/humidity sensor data available.");
919 lastWeatherData = result;
923 setParameterValue(
"WEATHER_HUMIDITY", std::fabs(std::stod(result[WI_HUMIDITY])));
926 catch (
const std::exception &e)
928 LOGF_ERROR(
"Error parsing weather data: %s", e.what());
938 lastWeatherData = result;
942bool PegasusFlatMasterNeo::getUptime()
944 char response[16] = {0};
945 if (!sendCommand(
"FU", response))
949 const char *val = strstr(response,
"FU:");
950 UptimeNP[0].setValue(atof(val ? val + 3 : response));
951 UptimeNP.setState(
IPS_OK);
956bool PegasusFlatMasterNeo::getThreshold()
958 char response[16] = {0};
959 if (!sendCommand(
"DT", response))
962 const char *val = strstr(response,
"DT:");
966 int threshold = atoi(val + 3);
967 if (threshold < 1 || threshold > 50)
969 LOGF_WARN(
"DT returned %d which is outside the valid range [1..50], ignoring.", threshold);
973 ThresholdNP[0].setValue(threshold);
974 ThresholdNP.setState(
IPS_OK);
979bool PegasusFlatMasterNeo::setThreshold(uint8_t value)
981 if (value < 1 || value > 50)
983 LOGF_ERROR(
"Threshold %d is outside the valid range [1..50].", value);
987 snprintf(
cmd,
sizeof(
cmd),
"DT:%d", value);
988 return sendEchoCommand(
cmd);
994bool PegasusFlatMasterNeo::setDewAggressiveness(uint8_t level)
997 snprintf(
cmd,
sizeof(
cmd),
"DA:%d", level);
998 return sendEchoCommand(
cmd);
1001bool PegasusFlatMasterNeo::saveDewLevels()
1004 char response[16] = {0};
1005 sendCommand(
"DSTR", response);
1006 if (strncmp(response,
">>", 2) == 0)
1008 LOG_WARN(
"This firmware does not support saving the dew levels (DSTR).");
1014bool PegasusFlatMasterNeo::getAutoClose()
1016 char response[16] = {0};
1017 if (!sendCommand(
"DC:99", response))
1020 const bool on = (strcmp(response,
"DC:1") == 0);
1021 AutoCloseSP.reset();
1022 AutoCloseSP[on ? 0 : 1].setState(
ISS_ON);
1023 AutoCloseSP.setState(
IPS_OK);
1024 AutoCloseSP.apply();
1028bool PegasusFlatMasterNeo::setAutoClose(
bool enable)
1031 snprintf(
cmd,
sizeof(
cmd),
"DC:%d", enable ? 1 : 0);
1032 return sendEchoCommand(
cmd);
1035bool PegasusFlatMasterNeo::wifiFactoryReset()
1039 int nbytes_written = 0;
1043std::vector<std::string> PegasusFlatMasterNeo::split(
const std::string &input,
const std::string &sep)
1045 std::vector<std::string> result;
1047 std::sregex_token_iterator it(input.begin(), input.end(), re, -1);
1048 std::sregex_token_iterator
end;
1049 for (; it !=
end; ++it)
1050 result.push_back(it->str());
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
The TCP class manages connection with devices over the network via TCP/IP. Upon successful connection...
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.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
virtual bool Disconnect()
Disconnect from device.
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...
bool isConfigLoading() const
isConfigLoading Check if driver configuration is currently in the process of getting loaded.
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg=nullptr)
Set connection switch status in the client.
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....
friend class WeatherInterface
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)
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.
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
friend class LightBoxInterface
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
DustCapInterface(DefaultDevice *device)
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
Provides generic container for INDI properties.
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
static constexpr int TCP_PORT
Port of the TCP command socket.
static void drain(int portFD)
Discard pending input. tcflush() only works on a serial port, so over TCP a line end left behind by a...
virtual bool 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_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
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.
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,...)
*brief user defined string literal for JSON values *sa std::size_t n
#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,...)
@ discarded
discarded by the parser callback function
*brief create JSON pointer *sa reference_tokens end()
double round(double value, int decimal_places)