Instrument Neutral Distributed Interface INDI  1.9.5
openweathermap.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
4 
5  INDI Weather Underground (TM) Weather Driver
6 
7  Modified for OpenWeatherMap API by Jarno Paananen
8 
9  This program is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by the Free
11  Software Foundation; either version 2 of the License, or (at your option)
12  any later version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17  more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 
24  The full GNU General Public License is included in this distribution in the
25  file called LICENSE.
26 *******************************************************************************/
27 
28 #pragma once
29 
30 #include "indiweather.h"
31 #include "indipropertytext.h"
32 
34 {
35  public:
37  virtual ~OpenWeatherMap();
38 
39  // Generic indi device entries
40  bool Connect() override;
41  bool Disconnect() override;
42  const char *getDefaultName() override;
43 
44  virtual bool initProperties() override;
45  virtual void ISGetProperties(const char *dev) override;
46  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
47 
48  protected:
49  virtual IPState updateWeather() override;
50 
51  virtual bool saveConfigItems(FILE *fp) override;
52  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
53 
54  private:
55  INDI::PropertyText owmAPIKeyTP{1};
56 
57  double owmLat, owmLong;
58 };
indipropertytext.h
INDI::PropertyText
Definition: indipropertytext.h:27
OpenWeatherMap::OpenWeatherMap
OpenWeatherMap()
Definition: openweathermap.cpp:46
IPState
IPState
Property state.
Definition: indiapi.h:158
OpenWeatherMap::updateWeather
virtual IPState updateWeather() override
updateWeather Update weather conditions from device or service. The function should not change the st...
Definition: openweathermap.cpp:153
INDI::Weather
Definition: indiweather.h:68
OpenWeatherMap::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: openweathermap.cpp:84
OpenWeatherMap::~OpenWeatherMap
virtual ~OpenWeatherMap()
Definition: openweathermap.cpp:57
OpenWeatherMap::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: openweathermap.cpp:358
OpenWeatherMap::Connect
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: openweathermap.cpp:67
OpenWeatherMap::ISGetProperties
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: openweathermap.cpp:112
OpenWeatherMap::ISNewText
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: openweathermap.cpp:127
OpenWeatherMap::getDefaultName
const char * getDefaultName() override
Definition: openweathermap.cpp:62
name
const char * name
Definition: indiserver.c:116
OpenWeatherMap
Definition: openweathermap.h:33
OpenWeatherMap::updateLocation
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update weather station location.
Definition: openweathermap.cpp:143
OpenWeatherMap::Disconnect
bool Disconnect() override
Disconnect from device.
Definition: openweathermap.cpp:79
indiweather.h