42 return (
const char *)
"Weather Simulator";
59 ControlWeatherNP[CONTROL_WEATHER].
fill(
"Weather",
"Weather",
"%.f", 0, 1, 1, 0);
60 ControlWeatherNP[CONTROL_TEMPERATURE].
fill(
"Temperature",
"Temperature",
"%.2f", -50, 70, 10, 15);
61 ControlWeatherNP[CONTROL_HUMIDITY].
fill(
"Humidity",
"Humidity",
"%.f", 0, 100, 5, 0);
62 ControlWeatherNP[CONTROL_WIND].
fill(
"Wind",
"Wind",
"%.2f", 0, 100, 5, 0);
63 ControlWeatherNP[CONTROL_GUST].
fill(
"Gust",
"Gust",
"%.2f", 0, 50, 5, 0);
64 ControlWeatherNP[CONTROL_RAIN].
fill(
"Precip",
"Precip",
"%.f", 0, 100, 10, 0);
69 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -10, 30, 15);
70 addParameter(
"WEATHER_HUMIDITY",
"Humidity (%)", 0, 100, 15);
71 addParameter(
"WEATHER_WIND_SPEED",
"Wind (kph)", 0, 20, 15);
72 addParameter(
"WEATHER_WIND_GUST",
"Gust (kph)", 0, 20, 15);
73 addParameter(
"WEATHER_RAIN_HOUR",
"Precip (mm)", 0, 0, 0);
99 setParameterValue(
"WEATHER_FORECAST", ControlWeatherNP[CONTROL_WEATHER].getValue());
100 setParameterValue(
"WEATHER_TEMPERATURE", ControlWeatherNP[CONTROL_TEMPERATURE].getValue());
101 setParameterValue(
"WEATHER_HUMIDITY", ControlWeatherNP[CONTROL_HUMIDITY].getValue());
102 setParameterValue(
"WEATHER_WIND_SPEED", ControlWeatherNP[CONTROL_WIND].getValue());
103 setParameterValue(
"WEATHER_WIND_GUST", ControlWeatherNP[CONTROL_GUST].getValue());
104 setParameterValue(
"WEATHER_RAIN_HOUR", ControlWeatherNP[CONTROL_RAIN].getValue());
115 ControlWeatherNP.
update(values, names, n);
117 ControlWeatherNP.
apply();
118 LOG_INFO(
"Values are updated and should be active on the next weather update.");
130 ControlWeatherNP.
save(fp);
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)
void addDebugControl()
Add Debug control to the driver.
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)
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....
void setParameterValue(std::string name, double value)
setParameterValue Update weather parameter value
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
void setWeatherConnection(const uint8_t &value)
setWeatherConnection Set Weather connection mode. Child class should call this in the constructor bef...
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
const char * getDefaultName() override
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
bool Disconnect() override
Disconnect from device.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual IPState updateWeather() override
updateWeather Update weather conditions from device or service. The function should not change the st...
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
std::unique_ptr< WeatherSimulator > weatherSimulator(new WeatherSimulator())