53 m_ParametersGroup = paramsGroup;
95 for (
int i = 0; i <
nRanges; i++)
115 for (
int i = 0; i <
nRanges; i++)
166 m_UpdateTimer.
start(5000);
191 "Weather override is enabled. Observatory is not safe. Turn off override as soon as possible.");
228 m_UpdateTimer.
start();
235 for (
int i = 0; i <
nRanges; i++)
262 "updateWeather() must be implemented in Weather device child class to update GEOGRAPHIC_COORD properties.");
271 numMaxOk, percWarning);
276 double *warn =
static_cast<double *
>(malloc(
sizeof(
double)));
287 createParameterRange(name, label);
324 "Unable to find parameter %s in list of existing parameters!", param.c_str());
330 double warn = *(
static_cast<double *
>(parameter.aux0));
331 double rangeWarn = (parameter.max - parameter.min) * (warn / 100);
333 if ((parameter.value < parameter.min) || (parameter.value > parameter.max))
339 else if ( ((parameter.value < (parameter.min + rangeWarn)) && parameter.min != 0)
340 || ((parameter.value > (parameter.max - rangeWarn)) && parameter.max != 0))
388 "Warning: Parameter %s value (%g) is in the warning zone!",
395 "Caution: Parameter %s value (%g) is in the danger zone!",
421 void WeatherInterface::createParameterRange(std::string name, std::string label)
432 IUFillNumber(&rangesN[2],
"PERC_WARN",
"% for Warning",
"%g", 0, 100, 1,
437 snprintf(propName,
MAXINDINAME,
"%s", name.c_str());
441 m_ParametersGroup.c_str(),
450 for (
int i = 0; i <
nRanges; i++)
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
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)
void setSingleShot(bool singleShot)
Set whether the timer is a single-shot timer.
void callOnTimeout(const std::function< void()> &callback)
void start()
Starts or restarts the timer with the timeout specified in interval.
void setInterval(int msec)
Set the timeout interval in milliseconds.
virtual ~WeatherInterface()
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process weather switch properties.
bool syncCriticalParameters()
updateWeatherState Send update weather state to client
virtual IPState updateWeather()
updateWeather Update weather conditions from device or service. The function should not change the st...
void setParameterValue(std::string name, double value)
setParameterValue Update weather parameter value
bool setCriticalParameter(std::string param)
setCriticalParameter Set parameter that is considered critical to the operation of the observatory....
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process weather number properties.
ILight * critialParametersL
WeatherInterface(DefaultDevice *defaultDevice)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save parameters ranges in the config file.
ILightVectorProperty critialParametersLP
INDI::PropertySwitch OverrideSP
INumberVectorProperty ParametersNP
IPState checkParameterState(const std::string ¶m) const
checkParameterState Checks the given parameter against the defined bounds
void addParameter(std::string name, std::string label, double numMinOk, double numMaxOk, double percWarning)
addParameter Add a physical weather measurable parameter to the weather driver. The weather value has...
void checkWeatherUpdate()
checkWeatherUpdate Calls updateWeather and update critical parameters accordingly.
void initProperties(const char *statusGroup, const char *paramsGroup)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
INDI::PropertySwitch RefreshSP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
INDI::PropertyNumber UpdatePeriodNP
INumberVectorProperty * ParametersRangeNP
void IUFillLight(ILight *lp, const char *name, const char *label, IPState s)
Assign attributes for a light property. The light's auxiliary elements will be set to NULL.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
void IUFillLightVector(ILightVectorProperty *lvp, ILight *lp, int nlp, const char *dev, const char *name, const char *label, const char *group, IPState s)
Assign attributes for a light vector property. The vector's auxiliary elements will be set to NULL.
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
void IDSetLight(const ILightVectorProperty *lvp, const char *fmt,...)
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
#define DEBUGDEVICE(device, priority, msg)
#define DEBUGFDEVICE(device, priority, msg,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.
Number vector property descriptor.