Instrument Neutral Distributed Interface INDI  1.9.2
Protected Member Functions | Protected Attributes | List of all members
INDI::WeatherInterface Class Reference

Provides interface to implement weather reporting functionality. More...

#include <indiweatherinterface.h>

Inheritance diagram for INDI::WeatherInterface:
INDI::Weather LX200_OnStep PegasusPPB PegasusPPBA PegasusUPB MBox OpenWeatherMap Vantage WeatherSafetyProxy WeatherSimulator WeatherWatcher WunderGround

Protected Member Functions

 WeatherInterface (DefaultDevice *defaultDevice)
 
virtual ~WeatherInterface ()
 
void initProperties (const char *statusGroup, const char *paramsGroup)
 Initilize focuser properties. It is recommended to call this function within initProperties() of your primary device. More...
 
bool updateProperties ()
 updateProperties Define or Delete Rotator properties based on the connection status of the base device More...
 
bool processNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process focus number properties. More...
 
virtual IPState updateWeather ()
 updateWeather Update weather conditions from device or service. The function should not change the state of any property in the device as this is handled by Weather. It should only update the raw values. More...
 
virtual bool saveConfigItems (FILE *fp)
 saveConfigItems Save parameters ranges in the config file. More...
 
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 three zones: More...
 
bool setCriticalParameter (std::string param)
 setCriticalParameter Set parameter that is considered critical to the operation of the observatory. The parameter state can affect the overall weather driver state which signals the client to take appropriate action depending on the severity of the state. More...
 
void setParameterValue (std::string name, double value)
 setParameterValue Update weather parameter value More...
 
IPState checkParameterState (const std::string &param) const
 checkParameterState Checks the given parameter against the defined bounds More...
 
IPState checkParameterState (const INumber &parameter) const
 
bool syncCriticalParameters ()
 updateWeatherState Send update weather state to client More...
 

Protected Attributes

INumberParametersN {nullptr}
 
INumberVectorProperty ParametersNP
 
INumberVectorPropertyParametersRangeNP {nullptr}
 
uint8_t nRanges {0}
 
ILightcritialParametersL {nullptr}
 
ILightVectorProperty critialParametersLP
 

Detailed Description

Provides interface to implement weather reporting functionality.

The weather functionality can be an independent device (e.g. weather station), or weather-related reports within another device.

When developing a driver for a fully independent weather device, use INDI::Weather directly. To add focus functionality to an existing driver, subclass INDI::WeatherInterface. In your driver, then call the necessary focuser interface functions.

FunctionWhere to call it from your driver
WI::initPropertiesinitProperties()
WI::updatePropertiesupdateProperties()
WI::processNumberISNewNumber(...) Check if the property name contains WEATHER_* and then call WI::processNumber(..) for such properties
WI::processSwitchISNewSwitch(...)

Implement and overwrite the rest of the virtual functions as needed. INDI Pegasus Ultimate Power Box driver is a good example to check for an actual implementation of a weather interface within an auxiliary driver.

Author
Jasem Mutlaq

Definition at line 55 of file indiweatherinterface.h.

Constructor & Destructor Documentation

◆ WeatherInterface()

INDI::WeatherInterface::WeatherInterface ( DefaultDevice defaultDevice)
explicitprotected

Definition at line 30 of file indiweatherinterface.cpp.

◆ ~WeatherInterface()

INDI::WeatherInterface::~WeatherInterface ( )
protectedvirtual

Definition at line 34 of file indiweatherinterface.cpp.

Member Function Documentation

◆ addParameter()

void INDI::WeatherInterface::addParameter ( std::string  name,
std::string  label,
double  numMinOk,
double  numMaxOk,
double  percWarning 
)
protected

addParameter Add a physical weather measurable parameter to the weather driver. The weather value has three zones:

  1. OK: Set minimum and maximum values for acceptable values.
  2. Warning: Set minimum and maximum values for values outside of Ok range and in the dangerous warning zone.
  3. Alert: Any value outsize of Ok and Warning zone is marked as Alert.
Parameters
nameName of parameter
labelLabel of paremeter (in GUI)
numMinOkminimum Ok range value.
numMaxOkmaximum Ok range value.
percWarningpercentage for Warning.

Definition at line 131 of file indiweatherinterface.cpp.

◆ checkParameterState() [1/2]

IPState INDI::WeatherInterface::checkParameterState ( const INumber parameter) const
protected

Definition at line 193 of file indiweatherinterface.cpp.

◆ checkParameterState() [2/2]

IPState INDI::WeatherInterface::checkParameterState ( const std::string &  param) const
protected

checkParameterState Checks the given parameter against the defined bounds

Parameters
paramName of parameter to check.
Returns
IPS_IDLE: The given parameter name is not valid.
IPS_OK: The given parameter is within the safe zone.
IPS_BUSY: The given parameter is in the warning zone.
IPS_ALERT: The given parameter is in the danger zone.

Definition at line 217 of file indiweatherinterface.cpp.

◆ initProperties()

void INDI::WeatherInterface::initProperties ( const char *  statusGroup,
const char *  paramsGroup 
)
protected

Initilize focuser properties. It is recommended to call this function within initProperties() of your primary device.

Parameters
statusGroupgroup for status properties
paramsGroupgroup for parameter properties

Definition at line 48 of file indiweatherinterface.cpp.

◆ processNumber()

bool INDI::WeatherInterface::processNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
protected

Process focus number properties.

Definition at line 96 of file indiweatherinterface.cpp.

◆ saveConfigItems()

bool INDI::WeatherInterface::saveConfigItems ( FILE *  fp)
protectedvirtual

saveConfigItems Save parameters ranges in the config file.

Parameters
fppointer to open config file
Returns
true of success, false otherwise.

Reimplemented in LX200_OnStep, INDI::Weather, WeatherSafetyProxy, OpenWeatherMap, WeatherWatcher, WeatherSimulator, PegasusUPB, PegasusPPBA, PegasusPPB, and WunderGround.

Definition at line 312 of file indiweatherinterface.cpp.

◆ setCriticalParameter()

bool INDI::WeatherInterface::setCriticalParameter ( std::string  param)
protected

setCriticalParameter Set parameter that is considered critical to the operation of the observatory. The parameter state can affect the overall weather driver state which signals the client to take appropriate action depending on the severity of the state.

Parameters
paramName of critical parameter.
Returns
True if critical parameter was set, false if parameter is not found.

Definition at line 167 of file indiweatherinterface.cpp.

◆ setParameterValue()

void INDI::WeatherInterface::setParameterValue ( std::string  name,
double  value 
)
protected

setParameterValue Update weather parameter value

Parameters
namename of weather parameter
valuenew value of weather parameter;

Definition at line 155 of file indiweatherinterface.cpp.

◆ syncCriticalParameters()

bool INDI::WeatherInterface::syncCriticalParameters ( )
protected

updateWeatherState Send update weather state to client

Returns
true if any parameters changed from last update. False if no states changed.

Definition at line 230 of file indiweatherinterface.cpp.

◆ updateProperties()

bool INDI::WeatherInterface::updateProperties ( )
protected

updateProperties Define or Delete Rotator properties based on the connection status of the base device

Returns
True if successful, false otherwise.

Definition at line 61 of file indiweatherinterface.cpp.

◆ updateWeather()

IPState INDI::WeatherInterface::updateWeather ( )
protectedvirtual

updateWeather Update weather conditions from device or service. The function should not change the state of any property in the device as this is handled by Weather. It should only update the raw values.

Returns
Return overall state. The state should be IPS_OK if data is valid. IPS_BUSY if weather update is in progress. IPS_ALERT is there is an error. The clients will only accept values with IPS_OK state.

Reimplemented in LX200_OnStep, WeatherSafetyProxy, PegasusUPB, OpenWeatherMap, PegasusPPBA, WeatherWatcher, MBox, WeatherSimulator, Vantage, PegasusPPB, and WunderGround.

Definition at line 124 of file indiweatherinterface.cpp.

Member Data Documentation

◆ critialParametersL

ILight* INDI::WeatherInterface::critialParametersL {nullptr}
protected

Definition at line 157 of file indiweatherinterface.h.

◆ critialParametersLP

ILightVectorProperty INDI::WeatherInterface::critialParametersLP
protected

Definition at line 158 of file indiweatherinterface.h.

◆ nRanges

uint8_t INDI::WeatherInterface::nRanges {0}
protected

Definition at line 154 of file indiweatherinterface.h.

◆ ParametersN

INumber* INDI::WeatherInterface::ParametersN {nullptr}
protected

Definition at line 149 of file indiweatherinterface.h.

◆ ParametersNP

INumberVectorProperty INDI::WeatherInterface::ParametersNP
protected

Definition at line 150 of file indiweatherinterface.h.

◆ ParametersRangeNP

INumberVectorProperty* INDI::WeatherInterface::ParametersRangeNP {nullptr}
protected

Definition at line 153 of file indiweatherinterface.h.


The documentation for this class was generated from the following files: