Instrument Neutral Distributed Interface INDI  1.9.5
indiweatherinterface.h
Go to the documentation of this file.
1 /*
2  Weather Interface
3  Copyright (C) 2018 Jasem Mutlaq (mutlaqja@ikarustech.com)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #pragma once
22 
23 #include "indibase.h"
24 
25 #include <stdint.h>
26 #include <string>
27 
28 // Alias
30 
31 namespace INDI
32 {
33 
56 {
57  public:
58 
59  protected:
60  explicit WeatherInterface(DefaultDevice *defaultDevice);
61  virtual ~WeatherInterface();
62 
69  void initProperties(const char *statusGroup, const char *paramsGroup);
70 
75  bool updateProperties();
76 
78  bool processNumber(const char *dev, const char *name, double values[], char *names[], int n);
79 
88  virtual IPState updateWeather();
89 
95  virtual bool saveConfigItems(FILE *fp);
96 
112  void addParameter(std::string name, std::string label, double numMinOk, double numMaxOk, double percWarning);
113 
121  bool setCriticalParameter(std::string param);
122 
128  void setParameterValue(std::string name, double value);
129 
138  IPState checkParameterState(const std::string &param) const;
139 
140  IPState checkParameterState(const INumber &parameter) const;
141 
146  bool syncCriticalParameters();
147 
148  // Parameters
149  INumber *ParametersN {nullptr};
151 
152  // Parameter Ranges
154  uint8_t nRanges {0};
155 
156  // Weather status
159 
160  private:
161  void createParameterRange(std::string name, std::string label);
162  DefaultDevice *m_defaultDevice { nullptr };
163  std::string m_ParametersGroup;
164 };
165 }
INDI::WeatherInterface::initProperties
void initProperties(const char *statusGroup, const char *paramsGroup)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
Definition: indiweatherinterface.cpp:48
indibase.h
INDI::WeatherInterface::setCriticalParameter
bool setCriticalParameter(std::string param)
setCriticalParameter Set parameter that is considered critical to the operation of the observatory....
Definition: indiweatherinterface.cpp:167
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::WeatherInterface::critialParametersL
ILight * critialParametersL
Definition: indiweatherinterface.h:157
_ILightVectorProperty
Light vector property descriptor.
Definition: indiapi.h:415
INumber
One number descriptor.
INDI::WeatherInterface::syncCriticalParameters
bool syncCriticalParameters()
updateWeatherState Send update weather state to client
Definition: indiweatherinterface.cpp:230
INDI::WeatherInterface::ParametersNP
INumberVectorProperty ParametersNP
Definition: indiweatherinterface.h:150
ILight
One light descriptor.
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::WeatherInterface::nRanges
uint8_t nRanges
Definition: indiweatherinterface.h:154
INDI::WeatherInterface::critialParametersLP
ILightVectorProperty critialParametersLP
Definition: indiweatherinterface.h:158
INDI::WeatherInterface::saveConfigItems
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save parameters ranges in the config file.
Definition: indiweatherinterface.cpp:312
INDI::WeatherInterface::processNumber
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
Definition: indiweatherinterface.cpp:96
INDI::WeatherInterface::addParameter
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...
Definition: indiweatherinterface.cpp:131
INDI::WeatherInterface::checkParameterState
IPState checkParameterState(const std::string &param) const
checkParameterState Checks the given parameter against the defined bounds
Definition: indiweatherinterface.cpp:217
name
const char * name
Definition: indiserver.c:116
INDI::WeatherInterface::WeatherInterface
WeatherInterface(DefaultDevice *defaultDevice)
Definition: indiweatherinterface.cpp:30
INDI::WeatherInterface::~WeatherInterface
virtual ~WeatherInterface()
Definition: indiweatherinterface.cpp:34
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::WeatherInterface
Provides interface to implement weather reporting functionality.
Definition: indiweatherinterface.h:55
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
INDI::WeatherInterface::ParametersN
INumber * ParametersN
Definition: indiweatherinterface.h:149
INDI::WeatherInterface::ParametersRangeNP
INumberVectorProperty * ParametersRangeNP
Definition: indiweatherinterface.h:153
INDI::WeatherInterface::updateProperties
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
Definition: indiweatherinterface.cpp:61
INDI::WeatherInterface::updateWeather
virtual IPState updateWeather()
updateWeather Update weather conditions from device or service. The function should not change the st...
Definition: indiweatherinterface.cpp:124
INDI::WeatherInterface::setParameterValue
void setParameterValue(std::string name, double value)
setParameterValue Update weather parameter value
Definition: indiweatherinterface.cpp:155