Instrument Neutral Distributed Interface INDI 2.2.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 double previousForecast; // Store the previous forecast value
59};
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...
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update weather station location.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
const char * getDefaultName() override
virtual IPState updateWeather() override
updateWeather Update weather conditions from device or service. The function should not change the st...
bool Disconnect() override
Disconnect from device.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual ~OpenWeatherMap()
IPState
Property state.
Definition indiapi.h:158